Learn R Programming

ctsem (version 1.1.5.2)

ctPSMfit: ctPSMfit

Description

Fits a specified ctsem model (without predictors) using the PSM package.

Usage

ctPSMfit(datawide, ctmodelobj, omxStartValues = NULL, ...)

Arguments

datawide
a dataset in the wide format used by ctsem.
ctmodelobj
A ctsem model specified using ctModel. As predictors (covariates) are not implemented currently, ensure the model contains none of these or the fit may fail.
omxStartValues
Named vector of start values, equivalent to this argument for ctFit.
...
Additional parameters to pass to PSM.#'

Value

  • PSM fit data

Examples

Run this code
## Examples set to 'dontrun' because they take longer than 5s. 

generatingModel <- ctModel(n.latent = 1, n.manifest = 1, Tpoints = 10,
LAMBDA = diag(1), DRIFT = matrix(-.3, nrow = 1),
MANIFESTVAR = diag(1),
CINT = matrix(3, 1, 1),
DIFFUSION = t(chol(diag(5, 1))))

dat <- ctGenerate(generatingModel, n.subjects=10, burnin=300)

### ctsem model and fit
ctsemModel <- ctModel(n.latent=1, n.manifest = 1, Tpoints = 10,
  LAMBDA = diag(1))
ctsemFit <- ctFit(dat, ctsemModel, stationary = c('T0VAR'))

### fit with PSM
psmFit <- ctPSMfit(dat, omxStartValues = 
    omxGetParameters(ctsemFit$mxobj), ctsemModel)

Run the code above in your browser using DataLab