Learn R Programming

⚠️There's a newer version (3.10.2) of this package.Take me there.

See the NEWS file for recent updates!

ctsem allows for easy specification and fitting of a range of continuous and discrete time dynamic models, including multiple indicators (dynamic factor analysis), multiple, potentially higher order processes, and time dependent (varying within subject) and time independent (not varying within subject) covariates. Classic longitudinal models like latent growth curves and latent change score models are also possible. Version 1 of ctsem provided SEM based functionality by linking to the OpenMx software, allowing mixed effects models (random means but fixed regression and variance parameters) for multiple subjects. For version 2 of the R package ctsem, we include a Bayesian specification and fitting routine that uses the Stan probabilistic programming language, via the rstan package in R. This allows for all parameters of the dynamic model to individually vary, using an estimated population mean and variance, and any time independent covariate effects, as a prior. ctsem version 1 is documented in a JSS publication (Driver, Voelkle, Oud, 2017), and in R vignette form at https://cran.r-project.org/package=ctsem/vignettes/ctsem.pdf . The Bayesian approach is outlined in Introduction to Hierarchical Continuous Time Dynamic Modelling with ctsem, at https://www.researchgate.net/publication/310747987_Introduction_to_Hierarchical_Continuous_Time_Dynamic_Modelling_With_ctsem . To cite ctsem please use the citation("ctsem") command in R.

Copy Link

Version

Install

install.packages('ctsem')

Monthly Downloads

899

Version

2.9.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Charles Driver

Last Published

April 13th, 2019

Functions in ctsem (2.9.0)

ctExample1TIpred

ctExample1TIpred
ctExample2level

ctExample2level
ctModel

Define a ctsem model
ctStanDiscreteParsPlot

ctStanDiscreteParsPlot
ctStanTIpredeffects

Get time independent predictor effect estimates
ctExample3

ctExample3
ctLongToWide

ctLongToWide Restructures time series / panel data from long format to wide format for ctsem analysis
ctStanDiscretePars

ctStanDiscretePars
ctStanTIpredMarginal

Plot marginal relationships between covariates and parameters for a ctStanFit object.
longexample

longexample
msquare

Right multiply a matrix by its transpose.
Kalman

Kalman
ctExample2

ctExample2
ctKalman

ctKalman
ctRefineTo

ctRefineTo
ctKalmanPlot

ctKalmanPlot
ctStanContinuousPars

ctStanContinuousPars
ctGenerate

ctGenerate
ctGenerateFromFit

Generates data according to the model estimated in a ctsemFit object.#'
ctStanParMatrices

Returns population system matrices from a ctStanFit object, and vector of values for free parameters.
ctDiscretiseData

Discretise long format continuous time (ctsem) data to specific timestep.
ctStanParnames

ctStanParnames
datastructure

datastructure
ctModelFromFit

Extract a ctsem model structure with parameter values from a ctsem fit object.
ctPostPredict

Posterior predictive type check for ctsemFit.
ctPoly

Plots uncertainty bands with shading
ctMultigroupFit

Fits a multiple group continuous time model.
ctExample4

ctExample4
ctIndplot

ctIndplot
ctFit

Fit a ctsem object
ctIntervalise

Converts absolute times to intervals for wide format ctsem panel data
optimstan

Optimize / importance sample a stan or ctStan model.
extract

Extract samples from a ctStanFit object
ctExample1

ctExample1
ctPlotArray

Plots three dimensional y values for quantile plots
ctPlot

ctPlot
plot.ctStanFit

plot.ctStanFit
ctStanFit

ctStanFit
stan_postcalc

Compute functions of matrices from samples of a stanfit object
ctStanGenerateData

Add a $generated object to ctstanfit object, with random data generated from posterior of ctstanfit object
ctStanKalman

Get Kalman filter estimates from a ctStanFit object
ctStanPlotPost

ctStanPlotPost
ctStanModel

Convert a frequentist (omx) ctsem model specification to Bayesian (Stan).
ctStanUpdModel

Update an already compiled and fit ctStanFit object
stan_checkdivergences

Analyse divergences in a stanfit object
stan_unconstrainsamples

Convert samples from a stanfit object to the unconstrained scale
ctStanPostPredict

Compares model implied density and values to observed, for a ctStanFit object.
ctWideNames

ctWideNames sets default column names for wide ctsem datasets. Primarily intended for internal ctsem usage.
inv_logit

Inverse logit
isdiag

Diagnostics for ctsem importance sampling
plot.ctStanModel

Prior plotting
plot.ctsemFit

Plotting function for object class ctsemFit
summary.ctStanFit

summary.ctStanFit
stan_confidenceRegion

Extract functions of multiple variables from a stanfit object
ctWideToLong

ctWideToLong Convert ctsem wide to long format
plot.ctsemFitMeasure

Misspecification plot using ctCheckFit output
summary.ctsemFit

Summary function for ctsemFit object
plot.ctsemMultigroupFit

Plot function for ctsemMultigroupFit object
ctsem

ctsem
ctstantestdat

ctstantestdat
ctstantestfit

ctstantestfit
sdpcor2cov

sdcor2cov
stanWplot

Runs stan, and plots sampling information while sampling.
summary.ctsemMultigroupFit

Summary function for ctsemMultigroupFit object
ctCompareExpected

ctCompareExpected Compares model implied to observed means and covariances for panel data fit with ctsem.
ctDeintervalise

ctDeintervalise
ctDensity

ctDensity
Oscillating

Oscillating
ctDiscretePars

ctDiscretePars
ctCI

ctCI Computes confidence intervals on specified parameters / matrices for already fitted ctsem fit object.
AnomAuth

AnomAuth
ctCheckFit

Check absolute fit of ctFit or ctStanFit object.
ctCollapse

ctCollapse Easily collapse an array margin using a specified function.