Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ctStanModel

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


Description

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

Usage

ctStanModel(ctmodelobj, type = "stanct", tipredDefault = TRUE)

Arguments

ctmodelobj

ctsem model object of type 'omx' (default)

type

either 'stanct' for continuous time, or 'standt' for discrete time.

tipredDefault

Logical. TRUE sets any parameters with unspecified time independent predictor effects to have effects estimated, FALSE fixes the effect to zero unless individually specified.

Value

List object of class ctStanModel, with random effects specified for any intercept type parameters (T0MEANS, MANIFESTMEANS, and or CINT), and time independent predictor effects for all parameters. Adjust these after initial specification by directly editing the pars subobject, so model$pars .

Examples

model <- ctModel(type='omx', Tpoints=50,
n.latent=2, n.manifest=1, 
manifestNames='sunspots', 
latentNames=c('ss_level', 'ss_velocity'),
LAMBDA=matrix(c( 1, 'ma1' ), nrow=1, ncol=2),
DRIFT=matrix(c(0, 1,   'a21', 'a22'), nrow=2, ncol=2, byrow=TRUE),
MANIFESTMEANS=matrix(c('m1'), nrow=1, ncol=1),
# MANIFESTVAR=matrix(0, nrow=1, ncol=1),
CINT=matrix(c(0, 0), nrow=2, ncol=1),
DIFFUSION=matrix(c(
  0, 0,
  0, "diffusion"), ncol=2, nrow=2, byrow=TRUE))

stanmodel=ctStanModel(model)

ctsem

Continuous Time Structural Equation Modelling

v3.4.3
GPL-3
Authors
Charles Driver [aut, cre, cph], Manuel Voelkle [aut, cph], Han Oud [aut, cph], Trustees of Columbia University [cph]
Initial release
2021-04-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.