Package: ctsem 4.0.0

ctsem: Continuous Time Structural Equation Modelling

Hierarchical continuous (and discrete) time state space modelling, for linear and nonlinear systems measured by continuous, binary, ordinal, count or censored variables. The subject specific dynamic system is a stochastic differential equation (SDE) or difference equation, measured through a (typically) multivariate factor model. Individual differences on any parameter, at one or more nested levels, are integrated out by an augmented Kalman filter or a Laplace approximation, or sampled. Estimation is by maximum likelihood or maximum a posteriori optimisation, with uncertainty from the Hessian, importance sampling or the bootstrap, or by sampling the posterior, using either 'Stan' or an optional 'Julia' engine that ctJuliaInstall() sets up. See <https://github.com/cdriveraus/ctsem/raw/master/vignettes/hierarchicalmanual.pdf> for details, and <https://osf.io/preprints/psyarxiv/4q9ex_v3> for a detailed tutorial. For the conceptual overview of the hierarchical Bayesian linear SDE approach, see <https://www.researchgate.net/publication/324093594_Hierarchical_Bayesian_Continuous_Time_Dynamic_Modeling>. Exogenous inputs may also be included; for an overview of such possibilities see <https://www.researchgate.net/publication/328221807_Understanding_the_Time_Course_of_Interventions_with_Continuous_Time_Dynamic_Models>. <https://cdriver.netlify.app/> contains some tutorial blog posts.

Authors:Charles Driver [aut, cre, cph], Manuel Voelkle [aut, cph], Han Oud [aut, cph], Trustees of Columbia University [cph]

ctsem_4.0.0.tar.gz
ctsem_4.0.0.zip(r-4.7-x86_64)ctsem_4.0.0.zip(r-4.7-arm64)ctsem_4.0.0.zip(r-4.6-x86_64)ctsem_4.0.0.zip(r-4.6-arm64)ctsem_4.0.0.zip(r-4.5-x86_64)
ctsem_4.0.0.tgz(r-4.6-x86_64)ctsem_4.0.0.tgz(r-4.6-arm64)ctsem_4.0.0.tgz(r-4.5-x86_64)ctsem_4.0.0.tgz(r-4.5-arm64)
ctsem_4.0.0.tar.gz(r-4.7-arm64)ctsem_4.0.0.tar.gz(r-4.7-x86_64)ctsem_4.0.0.tar.gz(r-4.6-arm64)ctsem_4.0.0.tar.gz(r-4.6-x86_64)
ctsem_4.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
ctsem/json (API)

# Install 'ctsem' in R:
install.packages('ctsem', repos = c('https://cdriveraus.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/cdriveraus/ctsem/issues

Pkgdown/docs site:https://cdriveraus.github.io

Uses libs:
  • onetbb– Parallelism library for C++
  • c++– GNU Standard C++ Library v3
Datasets:

On CRAN:

Conda:

stochastic-differential-equationstime-seriesonetbbcpp

7.20 score 52 stars 1 packages 1.4k downloads 2 mentions 107 exports 61 dependencies

Last updated from:157e1e5a0d. Checks:11 WARNING, 3 ERROR, 1 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64WARNING815
linux-devel-x86_64WARNING710
source / vignettesERROR780
linux-release-arm64WARNING732
linux-release-x86_64WARNING873
macos-release-arm64WARNING809
macos-release-x86_64WARNING1296
macos-oldrel-arm64WARNING842
macos-oldrel-x86_64WARNING1415
windows-devel-arm64ERROR1013
windows-devel-x86_64WARNING1101
windows-release-arm64ERROR1067
windows-release-x86_64WARNING1051
windows-oldrel-x86_64WARNING1052
wasm-releaseOK370

Exports:ctACFctACFresidualsctAddSamplesctCheckFitctChisqTestctCollapsectCovctCoverageCheckctDeintervalisectDiscreteParsctDiscreteParsPlotctDiscretiseDatactDocsctEmpiricalBayesFitctExtractctFitctFitAddSamplesctFitAdequacyctFitCheckCovctFitCovCheckctFitCovCheckPlotctFitProfilectFitUncertaintyctFitUpdatectFitUpdateModelctGeneratectGenerateFromFitctGenerateFromPriorsctIdentifyctIntervalisectJuliaEvaluatectJuliaInstallctJuliaKillctJuliaProcessesctJuliaSetupctJuliaStatusctKalmanctKalmanArrayctLaplaceCheckctLongToWidectLOOctModelctModelConvertOMXctModelCoverage_checkctModelHigherOrderctModelImprovectModelIsNonlinearctModelLatentLevelctModelLatexctModelMatricesctModelMatrices<-ctModelPeriodicComponentctModelProposalsctModelSlowComponentctModelUniqueProcessctNetworkctNetworkPlotctOptimUncertaintyctParctParticleLikctPeriodicPhasesctPhasePortraitctPlotArrayctPlotPosteriorctPolyctPostPredDatactPostPredictctPostPredPlotsctPredictctPredictTIPctRawParnamesctReportctResidualsctScoreTestctStanContinuousParsctStanDiscreteParsctStanDiscreteParsPlotctStanFitctStanFitUpdatectStanGeneratectStanGenerateFromFitctStanKalmanctStanModelctStanParnamesctStanPlotPostctStanPostPredictctStanSubjectParsctStanTIpredeffectsctStanUpdModelctStateDependencePlotctSubjectParsctSummaryMatricesctTIpredEffectsctTracePlotctVarianceDecompositionctWideNamesctWideToLonginv_logitlog1p_expplot.ctKalmanDFplotctACFsdpcor2covstan_reinitsfstan_unconstrainsamplesstandatact_specificsubjectsstanWplottest_isclose

Dependencies:abindbackportsBHcallrcheckmateclicOdecorpcorcpp11data.tableDerivdescdistributionalexpmfarvergenericsggplot2gluegridExtragtableinlineisobandlabelinglatticelifecycleloomagrittrMASSMatrixmatrixStatsmizemvtnormnumDerivotelparallellypillarpkgbuildpkgconfigplyrpngposteriorprocessxpsQuickJSRR6RColorBrewerRcppRcppEigenRcppParallelrlangrstanrstantoolsS7scalesStanHeaderstensorAtibbleutf8vctrsviridisLitewithr

Readme and manuals

Help Manual

Help pageTopics
ctsemctsem-package ctsem
AnomAuthAnomAuth
Likelihood-ratio tests between nested ctsem fitsanova.ctJuliaFit anova.ctStanFit
Continuous Time Autocorrelation Function (ctACF)ctACF
Calculate Continuous Time Autocorrelation Function (ACF) for Standardized Residuals of ctsem fit.ctACFresiduals
Chi Square test wrapper for ctsem fit objects.ctChisqTest
ctCollapse Easily collapse an array margin using a specified function.ctCollapse
Context dependence of reported model matricesctContextDependence
Write a covariance matrix as the cells a ctsem model readsctCov
Check interval coverage by simulationctCoverageCheck
ctDeintervalisectDeintervalise
ctDiscreteParsctDiscretePars ctStanDiscretePars
ctDiscreteParsPlotctDiscreteParsPlot ctStanDiscreteParsPlot
Discretise long format continuous time (ctsem) data to specific timestep.ctDiscretiseData
Get documentation pdf for ctsemctDocs
Empirical Bayes subject-wise ctsem fitsctEmpiricalBayesFit
ctExample1ctExample1
ctExample1TIpredctExample1TIpred
ctExample2ctExample2
ctExample2levelctExample2level
ctExample3ctExample3
ctExample4ctExample4
Extract samples from a ctsem fitctExtract extract
Fit a ctsem modelctFit ctStanFit
Append pseudo-posterior samples to an optimized ctStanFit object (deprecated)ctAddSamples ctFitAddSamples
Adequacy of a fitted model, as testsctFitAdequacy
Visual lagged covariance or correlation diagnostics for ctsem fits.ctFitCheckCov ctFitCovCheck
ctFitCovCheckPlotctFitCovCheckPlot
Profile likelihood for a ctsem julia fitctFitProfile
Compute or sample a fit's uncertaintyctFitUncertainty ctOptimUncertainty
Update a fit to new data, or to the current version of ctsemctFitUpdate ctStanFitUpdate
ctGeneratectGenerate
Generate data from a fitted modelctGenerateFromFit ctStanGenerateFromFit
Generate data from a model's priors (deprecated)ctGenerateFromPriors ctStanGenerate
Check which parameters a dataset can inform, before fittingctIdentify
Converts absolute times to intervals for wide format ctsem panel datactIntervalise
Evaluate a julia model's likelihood and gradient at given parametersctJuliaEvaluate
Set up the Julia backendctJuliaInstall
Stop Julia processes started for ctsemctJuliaKill
Julia processes started for ctsemctJuliaProcesses
Configure the Julia engine used by ctsemctJuliaSetup
Report Julia backend availabilityctJuliaStatus
Get Kalman filter estimates from a ctStanFit objectctKalmanArray ctStanKalman
Measure, and optionally correct, the Laplace approximation error in a fitctLaplaceCheck
ctLongToWide Restructures time series / panel data from long format to wide format for ctsem analysisctLongToWide
Cross validation for ctsem fits: K fold by refitting, or PSIS for Laplace fitsctLOO
Define a ctsem modelctModel
Convert an old OpenMx-style ctsem model to the modern ctsem model format.ctModelConvertOMX ctStanModel
Raise the order of a ctsem model's latent processes.ctModelHigherOrder
Improve a model step by step, from score tests and predictive checksctModelImprove
Does a model or fit have context-dependent (nonlinear) matrix cells?ctModelIsNonlinear
Put subjects' levels in the latent processes rather than in the indicatorsctModelLatentLevel
Generate and optionally compile latex equation of subject level ctsem model.ctModelLatex
Matrix view for ctStanModel objectsctModelMatrices ctModelMatrices<-
Add a cycle, such as a daily rhythm, that drives a model's latent processesctModelPeriodicComponent
Changes the score tests and adequacy checks proposectModelProposals
Add slow processes that drive a model's latent processesctModelSlowComponent
Give indicators processes of their ownctModelUniqueProcess
Temporal and contemporaneous networks of a continuous time modelctNetwork
Draw the temporal and contemporaneous networks of a continuous time modelctNetworkPlot
Optimiser settings for ctFitctOptimControl
Write a parameter specificationctPar
Check a julia-backend fit against a particle-filter likelihoodctParticleLik
The phase predictors a cycle added by ctModelPeriodicComponent readsctPeriodicPhases
Phase portrait of a fitted continuous time modelctPhasePortrait
Plots three dimensional y values for quantile plotsctPlotArray
Prior and posterior distributions of a fit's parametersctPlotPosterior ctStanPlotPost
Plots uncertainty bands with shadingctPoly
Create a data.table to compare data generated from a ctsem fit with the original data.ctPostPredData
Posterior predictive checks for a ctsem fitctPostPredict ctStanPostPredict
Posterior predictive checks for a ctsem fitctPostPredPlots
ctPredictctKalman ctPredict
ctPredictTIPctPredictTIP
ctRawParnamesctRawParnames ctStanParnames
Write a folder of summary, diagnostic and interpretation output for a fitctReport
Extract Standardized Residuals from a ctsem FitctResiduals
Score tests for relaxing a fitted modelctScoreTest
Options ctsem readsctsem-options
ctstantestdatctstantestdat
ctstantestfitctstantestfit
How model matrix cells vary with a latent statectStateDependencePlot
Extract an array of subject specific parameters from a fitctStanSubjectPars ctSubjectPars
ctSummaryMatricesctStanContinuousPars ctSummaryMatrices
Get time independent predictor effect estimatesctStanTIpredeffects ctTIpredEffects
Plot how a fit reached its estimatectTracePlot
Decompose model implied variance into between person, process and measurementctVarianceDecomposition
ctWideNames sets default column names for wide ctsem datasets. Primarily intended for internal ctsem usage.ctWideNames
ctWideToLong Convert ctsem wide to long formatctWideToLong
datastructuredatastructure
Inverse logitinv_logit
log1p_explog1p_exp
longexamplelongexample
OscillatingOscillating
Plot the adequacy checksplot.ctFitAdequacy
Plot a profile likelihoodplot.ctFitProfile
Plots for ctJuliaFit objectsplot.ctJuliaFit
Plots prediction output from ctPredict.plot.ctKalmanDF
Plot a model improvement searchplot.ctModelImprove
Plot score testsplot.ctScoreTest
plot.ctStanFitctStanPlot plot.ctStanFit
Prior plottingplot.ctStanModel
Plot an approximate continuous-time ACF object from ctACFplotctACF
Print a profile likelihoodprint.ctFitProfile
Print a ctsem modelprint.ctStanModel
Print ctStanFit summariesprint.summary.ctStanFit
sdcor2covsdpcor2cov
Quickly initialise stanfit object from model and datastan_reinitsf
Convert samples from a stanfit object to the unconstrained scalestan_unconstrainsamples
Adjust standata from ctsem to only use specific subjectsstandatact_specificsubjects
Optimize / importance sample a stan or ctStan model.stanoptimis
Runs stan, and plots sampling information while sampling.stanWplot
Summarise discrete time effect curvessummary.ctDiscretePars
Summarise empirical Bayes subject-wise ctsem fitssummary.ctEmpiricalBayesFit
Summarise a ctsem fitsummary.ctJuliaFit summary.ctStanFit
Tests if 2 values are close to each othertest_isclose