mxMmodModel {mxmmod} | R Documentation |
Create an MMOD
Description
This function builds a Measurement Model of Derivatives (MMOD; Estabrook 2015) with a given factor structure.
Usage
mxMmodModel(
data,
modelName,
idvar,
timevar,
structure,
orthogonal = F,
embed_dim = NULL,
fiml = F
)
Arguments
data |
a data frame with measurements in long format |
modelName |
name for the resulting model |
idvar |
name of column for subject IDs |
timevar |
name of column for measurement occasion |
structure |
factor structure, see 'Details' |
orthogonal |
if true, fix correlations between factors to 0 (A factor and its derivatives will still intercorrelate) |
embed_dim |
time delay embedding dimension |
fiml |
if true, use raw data to fit model with FIML. Otherwise, fit using cov matrix (dropping missing values if necessary). |
Details
The structure
argument is a list of latent factors and their mappings to manifest
variables. For example, a one factor structure would be:
list(F1 = c('m1', 'm2', 'm3', 'm4', 'm5', 'm6'))
And a two factor structure would be:
list(F1 = c('m1', 'm2', 'm3'), F2 = c('m4', 'm5', 'm6'))
Value
an MMOD as an mxModel object
Examples
data(nlsy97depression)
# Fit one factor MMOD
structure <- list(
F1 = c('nervous', 'down', 'depressed', 'calm', 'happy')
)
mmod_model <- mxMmodModel(data=nlsy97depression,
modelName='1 Factor MMOD',
idvar='pid', timevar='occasion', structure=structure)
mmod_fit <- OpenMx::mxRun(mmod_model)
summary(mmod_fit)