Learn R Programming

ctsem (version 2.1.0)

ctGenerate: ctGenerate

Description

This function generates data according to the specified ctsem model object.

Usage

ctGenerate(ctmodelobj, n.subjects = 1000, burnin = 0, dtmean = 1, logdtsd = 0, wide = TRUE, simultdpredeffect = FALSE)

Arguments

ctmodelobj
ctsem model object from ctModel.
n.subjects
Number of subjects to output.
burnin
Number of initial time points to discard (to simulate stationary data)
dtmean
Positive numeric. Average time interval (delta T) to use.
logdtsd
Numeric. Standard deviation for variability of the time interval.
wide
Logical. Output in wide format?
simultdpredeffect
logical - whether time dependent predictors impact instantaneously, or an instant *after* instantaneously. Switch reflects difference between ctStanFit and ctFit.

Details

TRAITTDPREDCOV and TIPREDCOV matrices are not accounted for, at present. The first 1:n.TDpred rows and columns of TDPREDVAR are used for generating tdpreds at each time point.

Examples

Run this code
#generate data for 2 process model, each process measured by noisy indicator, 
#stable individual differences in process levels.

generatingModel<-ctModel(Tpoints=8,n.latent=2,n.TDpred=0,n.TIpred=0,n.manifest=2,
 MANIFESTVAR=diag(.1,2),
 LAMBDA=diag(1,2),
 DRIFT=matrix(c(-.2,-.05,-.1,-.1),nrow=2),
 TRAITVAR=matrix(c(.5,.2,0,.8),nrow=2),
 DIFFUSION=matrix(c(1,.2,0,4),2),
 CINT=matrix(c(1,0),nrow=2),
 T0MEANS=matrix(0,ncol=1,nrow=2),
 T0VAR=diag(1,2))

data<-ctGenerate(generatingModel,n.subjects=15,burnin=10)

Run the code above in your browser using DataLab