View source: R/ctGenerateFromFit.R
ctGenerateFromFit | R Documentation |
Generates data according to the model estimated in a ctsemFit object.
ctGenerateFromFit(
fit,
timestep = "asdata",
n.subjects = 100,
timerange = "asdata",
predictorSubjects = "all",
...
)
fit |
object of class ctsemFit as returned from ctFit. |
timestep |
positive numeric value indicating the time interval to use for data generation. |
n.subjects |
integer. Number of subjects worth of data to generate |
timerange |
either 'asdata' to calculate range based on data in fit object, or vector of length 2 specifying min and max times for generation. |
predictorSubjects |
vector of integers, or string 'all', defining which subjects to sample time dependent and independent predictors from. |
... |
parameters to pass to ctGenerate function, such as wide=FALSE. |
matrix of generated data
data(AnomAuth)
AnomAuthmodel <- ctModel(LAMBDA = matrix(c(1, 0, 0, 1), nrow = 2, ncol = 2),
Tpoints = 5, n.latent = 2, n.manifest = 2, MANIFESTVAR=diag(0, 2))
AnomAuthfit <- ctFit(AnomAuth, AnomAuthmodel)
dwide <- ctGenerateFromFit(AnomAuthfit,timestep=1,n.subjects=5,wide=TRUE)
head(dwide)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.