Description Usage Arguments Author(s) Examples
View source: R/createARCLModel.R
createARCLModel creates an ARCL(1)-SEM model with OpenMx with >= 1 latent variables and 1 manifest per latent and time point for data simulation. It returns the covariance based and a raw data based model
1 2 3 | createARCLModel(sampleSize, numLatent, Timepoints, burning, Avalues, Afree,
Alabel, Svalues, Sfree, Slabel, S_firstObsAllFree = TRUE,
SimulatedDataSet)
|
sampleSize |
sample size |
numLatent |
number of latent varaibles per time point |
Timepoints |
number of time points observed in the final data set |
burning |
number of observations to burn before the initial time point |
Avalues |
values in ARCL matrix |
Afree |
free parameters in ARCL matrix |
Alabel |
labels parameters for ARCL matrix |
Svalues |
values in S matrix |
Sfree |
free parameters in S matrix |
Slabel |
labels parameters for S matrix |
S_firstObsAllFree |
should all initial observations be allowed to correlate? |
Jannik Orzek
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | library(OpenMx)
Alabel <- matrix(c("a11", "a12", "a13", "a14", "a15", "a21", "a22", "a23", "a24", "a25", "a31", "a32", "a33", "a34", "a35", "a41", "a42", "a43", "a44", "a45", "a51", "a52", "a53", "a54", "a55"), nrow = 5, byrow = T)
Avalues <- diag(.5,nrow=5,ncol = 5)
Avalues[2:5,1] <-.3
Avalues[3:5,2] <-.3
Avalues[4,5] <-.3
Afree <- matrix(TRUE, 5,5)
Alabel <- matrix(c("a11", "a12", "a13", "a14", "a15", "a21", "a22", "a23", "a24", "a25", "a31", "a32", "a33", "a34", "a35", "a41", "a42", "a43", "a44", "a45", "a51", "a52", "a53", "a54", "a55"), nrow = 5, byrow = T)
Svalues <- diag(.75,nrow=5,ncol = 5)
Sfree <- diag(TRUE, 5,5)
Slabel <- matrix(c("s11", NA, NA, NA, NA,
NA, "s22", NA, NA, NA,
NA, NA, "s33", NA, NA,
NA, NA, NA, "s44", NA,
NA, NA, NA, NA, "s55"), nrow = 5, byrow = T)
Svalues_init <- diag(1,nrow=5,ncol = 5)
Sfree_init <- diag(TRUE, 5,5)
Slabel_init <- matrix(NA, nrow = 5, byrow = T)
simObj <- simARCL(numLatent = 5, Timepoints = 4, burning = 10,
Avalues = Avalues, Alabel = Alabel, Afree = Afree,
Svalues = Svalues, Sfree = Sfree, Slabel = Slabel,
Svalues_init = Svalues_init, Sfree_init = Sfree_init, Slabel_init = Slabel_init,
sampleSize = 1000, S_firstObsAllFree = T)
temp <- mxRun(simObj$mxARCL_cov)
summary(temp)
temp2 <- mxTryHard(simObj$mxARCL_FIML)
summary(temp2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.