Package 'mxmmod'

Title: Measurement Model of Derivatives in 'OpenMx'
Description: Provides a convenient interface in 'OpenMx' for building Estabrook's (2015) <doi:10.1037/a0034523> Measurement Model of Derivatives (MMOD).
Authors: Kyle D. Husmann [aut, cre], Timothy R. Brick [aut], Ryne Estabrook [aut]
Maintainer: Kyle D. Husmann <[email protected]>
License: Apache License 2.0
Version: 1.1.0
Built: 2024-10-31 04:21:02 UTC
Source: https://github.com/khusmann/mxmmod

Help Index


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)

NLSY97 Longitudinal Depression Scale Data

Description

A 5-item depression scale used on the National Longitudinal Survey of Youth, 1997 sample (NLSY97). Individuals were assessed in 2000, 2002, and 2004. All items are assessed on a 4-point likert scale.

Usage

nlsy97depression

Format

A data frame with 26952 rows and 7 variables:

pid

Unique ID of participant

sex

Sex of participant

birth_m

Birth Month

birth_y

Birth Year

occasion

Measurement occasion

nervous

How often participant felt 'like a nervous person'

calm

How often participant felt 'calm and peaceful'

down

How often participant felt 'down or blue'

happy

How often participant felt 'like a happy person'

depressed

How often participant felt 'depressed'

Source

https://www.bls.gov/nls/nlsy97.htm