na.satcor: Fit a Saturated Correlates Model

View source: R/na.satcor.R

na.satcorR Documentation

Fit a Saturated Correlates Model

Description

This function estimates a confirmatory factor analysis model (cfa.satcor function), structural equation model (sem.satcor function), growth curve model (growth.satcor function), or latent variable model (lavaan.satcor function) in the R package lavaan using full information maximum likelihood (FIML) method to handle missing data while automatically specifying a saturated correlates model to incorporate auxiliary variables into a substantive model without affecting the parameter estimates, the standard errors, or the estimates of quality of fit (Graham, 2003).

Usage

na.satcor(model, data, aux, fun = c("cfa", "sem", "growth", "lavaan"),
          check = TRUE, ...)

cfa.satcor(model, data, aux, check = TRUE, ...)

sem.satcor(model, data, aux, check = TRUE, ...)

growth.satcor(model, data, aux, check = TRUE, ...)

lavaan.satcor(model, data, aux, check = TRUE, ...)

Arguments

model

a character string indicating the lavaan model syntax without the auxiliary variables specified in aux.

data

a data frame containing the observed variables used in the lavaan model syntax specified in model and the auxiliary variables specified in aux.

aux

a character vector indicating the names of the auxiliary variables in the data frame specified in data that will be added to the lavaan model syntax specified in model. Note that this function can only incorporate continuous auxiliary variables, i.e., the function cannot deal with categorical auxiliary variables.

fun

a character string indicating the name of a specific lavaan function used to fit model, i.e., cfa, sem, growth, or lavaan. Note that this argument is only required for the function na.satcor.

check

logical: if TRUE (default), argument specification is checked.

...

additional arguments passed to the lavaan function.

Value

An object of class lavaan, for which several methods are available in the R package lavaan, including a summary method.

Note

This function is a modified copy of the auxiliary(), cfa.auxiliary(), sem.auxiliary(), growth.auxiliary(), and lavaan.auxiliary() functions in the semTools package by Terrence D. Jorgensen et al. (2022).

Author(s)

Takuya Yanagida

References

Graham, J. W. (2003). Adding missing-data-relevant variables to FIML-based structural equation models. Structural Equation Modeling, 10(1), 80-100. https://doi.org/10.1207/S15328007SEM1001_4

Jorgensen, T. D., Pornprasertmanit, S., Schoemann, A. M., & Rosseel, Y. (2022). semTools: Useful tools for structural equation modeling. R package version 0.5-6. Retrieved from https://CRAN.R-project.org/package=semTools

Examples

## Not run: 
# Load lavaan package
library(lavaan)

#----------------------------------------------------------------------------
# Example 1: Saturated correlates model for the sem function

# Model specification
model <- 'Ozone ~ Wind'

# Model estimation using the sem.satcor function
mod.fit <- sem.satcor(model, data = airquality, aux = c("Temp", "Month"))

# Model estimation using the na.satcor function
mod.fit <- na.satcor(model, data = airquality, fun = "sem", aux = c("Temp", "Month"),
                     estimator = "MLR")

# Result summary
summary(mod.fit)

## End(Not run)

misty documentation built on Oct. 24, 2024, 5:10 p.m.

Related to na.satcor in misty...