Skip to contents

Specify a model

ctModel()
Define a ctsem model
ctModelLatex()
Generate and optionally compile latex equation of subject level ctsem model.
ctModelMatrices() `ctModelMatrices<-`()
Matrix view for ctStanModel objects
ctPar()
Write a parameter specification
ctCov()
Write a covariance matrix as the cells a ctsem model reads
ctModelHigherOrder()
Raise the order of a ctsem model's latent processes.
ctModelSlowComponent()
Add slow processes that drive a model's latent processes
ctModelPeriodicComponent()
Add a cycle, such as a daily rhythm, that drives a model's latent processes
ctPeriodicPhases()
The phase predictors a cycle added by ctModelPeriodicComponent reads
ctModelUniqueProcess()
Give indicators processes of their own
ctModelLatentLevel()
Put subjects' levels in the latent processes rather than in the indicators
ctModelConvertOMX()
Convert an old OpenMx-style ctsem model to the modern ctsem model format.
ctModelIsNonlinear()
Does a model or fit have context-dependent (nonlinear) matrix cells?
ctIdentify()
Check which parameters a dataset can inform, before fitting
print(<ctStanModel>)
Print a ctsem model
plot(<ctStanModel>)
Prior plotting

Prepare data

ctWideToLong()
ctWideToLong Convert ctsem wide to long format
ctLongToWide()
ctLongToWide Restructures time series / panel data from long format to wide format for ctsem analysis
ctWideNames()
ctWideNames sets default column names for wide ctsem datasets. Primarily intended for internal ctsem usage.
ctIntervalise()
Converts absolute times to intervals for wide format ctsem panel data
ctDeintervalise()
ctDeintervalise
ctDiscretiseData()
Discretise long format continuous time (ctsem) data to specific timestep.

Fit

ctFit()
Fit a ctsem model
ctOptimControl
Optimiser settings for ctFit
ctFitUpdate()
Update a fit to new data, or to the current version of ctsem
ctFitUncertainty() ctOptimUncertainty()
Compute or sample a fit's uncertainty
ctEmpiricalBayesFit()
Empirical Bayes subject-wise ctsem fits
summary(<ctEmpiricalBayesFit>)
Summarise empirical Bayes subject-wise ctsem fits
ctsem-options
Options ctsem reads

Inspect a fit

summary(<ctJuliaFit>) summary(<ctStanFit>)
Summarise a ctsem fit
print(<summary.ctStanFit>)
Print ctStanFit summaries
plot(<ctJuliaFit>)
Plots for ctJuliaFit objects
plot(<ctStanFit>)
plot.ctStanFit
ctSummaryMatrices()
ctSummaryMatrices
ctSubjectPars()
Extract an array of subject specific parameters from a fit
ctExtract()
Extract samples from a ctsem fit
ctRawParnames()
ctRawParnames
ctPlotPosterior()
Prior and posterior distributions of a fit's parameters
ctTIpredEffects()
Get time independent predictor effect estimates
ctPredictTIP()
ctPredictTIP
ctDiscretePars()
ctDiscretePars
ctDiscreteParsPlot()
ctDiscreteParsPlot
summary(<ctDiscretePars>)
Summarise discrete time effect curves
ctNetwork()
Temporal and contemporaneous networks of a continuous time model
ctNetworkPlot()
Draw the temporal and contemporaneous networks of a continuous time model
ctPhasePortrait()
Phase portrait of a fitted continuous time model
ctStateDependencePlot()
How model matrix cells vary with a latent state
ctContextDependence
Context dependence of reported model matrices
ctVarianceDecomposition()
Decompose model implied variance into between person, process and measurement
ctTracePlot()
Plot how a fit reached its estimate

Predict

ctPredict()
ctPredict
plot(<ctKalmanDF>)
Plots prediction output from ctPredict.
ctKalmanArray()
Get Kalman filter estimates from a ctStanFit object
ctResiduals()
Extract Standardized Residuals from a ctsem Fit

Check, compare and improve

ctReport()
Write a folder of summary, diagnostic and interpretation output for a fit
ctScoreTest()
Score tests for relaxing a fitted model
plot(<ctScoreTest>)
Plot score tests
ctFitAdequacy()
Adequacy of a fitted model, as tests
plot(<ctFitAdequacy>)
Plot the adequacy checks
ctModelImprove()
Improve a model step by step, from score tests and predictive checks
plot(<ctModelImprove>)
Plot a model improvement search
ctModelProposals()
Changes the score tests and adequacy checks propose
ctPostPredPlots()
Posterior predictive checks for a ctsem fit
ctPostPredict()
Posterior predictive checks for a ctsem fit
ctPostPredData()
Create a data.table to compare data generated from a ctsem fit with the original data.
ctFitCheckCov()
Visual lagged covariance or correlation diagnostics for ctsem fits.
ctFitCovCheckPlot()
ctFitCovCheckPlot
ctACF()
Continuous Time Autocorrelation Function (ctACF)
plotctACF()
Plot an approximate continuous-time ACF object from ctACF
ctACFresiduals()
Calculate Continuous Time Autocorrelation Function (ACF) for Standardized Residuals of ctsem fit.
anova(<ctJuliaFit>) anova(<ctStanFit>)
Likelihood-ratio tests between nested ctsem fits
ctChisqTest()
Chi Square test wrapper for ctsem fit objects.
ctLOO()
Cross validation for ctsem fits: K fold by refitting, or PSIS for Laplace fits
ctFitProfile()
Profile likelihood for a ctsem julia fit
plot(<ctFitProfile>)
Plot a profile likelihood
print(<ctFitProfile>)
Print a profile likelihood
ctLaplaceCheck()
Measure, and optionally correct, the Laplace approximation error in a fit
ctParticleLik()
Check a julia-backend fit against a particle-filter likelihood
ctCoverageCheck()
Check interval coverage by simulation

Generate data

ctGenerate()
ctGenerate
ctGenerateFromFit()
Generate data from a fitted model

Julia engine

ctJuliaInstall()
Set up the Julia backend
ctJuliaStatus()
Report Julia backend availability
ctJuliaSetup()
Configure the Julia engine used by ctsem
ctJuliaProcesses()
Julia processes started for ctsem
ctJuliaKill()
Stop Julia processes started for ctsem
ctJuliaEvaluate()
Evaluate a julia model's likelihood and gradient at given parameters

Datasets

ctExample1
ctExample1
ctExample1TIpred
ctExample1TIpred
ctExample2
ctExample2
ctExample2level
ctExample2level
ctExample3
ctExample3
ctExample4
ctExample4
longexample
longexample
Oscillating
Oscillating
AnomAuth
AnomAuth
datastructure
datastructure
ctstantestdat
ctstantestdat
ctstantestfit
ctstantestfit

Utilities

ctsem ctsem-package
ctsem
ctDocs()
Get documentation pdf for ctsem
ctCollapse()
ctCollapse Easily collapse an array margin using a specified function.
ctPlotArray()
Plots three dimensional y values for quantile plots
ctPoly()
Plots uncertainty bands with shading
inv_logit()
Inverse logit
log1p_exp()
log1p_exp
sdpcor2cov()
sdcor2cov
test_isclose()
Tests if 2 values are close to each other

Stan internals

Lower level functions of the Stan backend.

stanoptimis()
Optimize / importance sample a stan or ctStan model.
stan_reinitsf()
Quickly initialise stanfit object from model and data
stan_unconstrainsamples()
Convert samples from a stanfit object to the unconstrained scale
standatact_specificsubjects()
Adjust standata from ctsem to only use specific subjects
stanWplot()
Runs stan, and plots sampling information while sampling.

Deprecated

ctFitAddSamples()
Append pseudo-posterior samples to an optimized ctStanFit object (deprecated)
ctGenerateFromPriors()
Generate data from a model's priors (deprecated)