Learn R Programming

semlbci (version 0.11.5)

check_sem_out: Pre-analysis Check For 'semlbci'

Description

Check the output passed to semlbci()

Usage

check_sem_out(
  sem_out,
  robust = c("none", "satorra.2000"),
  multigroup_ok = TRUE
)

Value

A numeric vector of one element. If 0, the model and estimation method are officially supported. If larger than zero, then the model and method are not officially supported but users can still try to use semlbci() on it at their own risks. If less than zero, then the model and/or the method are officially not supported.

The attributes info contains the reason for a value other than zero.

Arguments

sem_out

The output from an SEM analysis. Currently only supports a lavaan::lavaan object.

robust

Whether the LBCI based on robust likelihood ratio test is to be found. Only "satorra.2000" in lavaan::lavTestLRT() is supported for now. If "none", the default, then likelihood ratio test based on maximum likelihood estimation will be used.

multigroup_ok

If TRUE, will not check whether the model is a multiple-group model. Default is TRUE.

Details

It checks whether the model and the estimation method in the sem_out object passed to semlbci() are supported by the current version of semlbci(). This function is to be used by semlbci() but is exported such that the compatibility of an SEM output can be checked directly.

Estimation methods (estimator in lavaan::lavaan()) currently supported:

  • Maximum likelihood (ML) and its variants (e.g., MLM, MLR). For methods with robust test statistics (e.g., MLR), only robust LBCIs (robust = "satorra.2000" in calling semlbci()) can be requested.

Estimation methods not yet supported:

  • Generalized least squares (GLS).

  • Weighted least squares (a.k.a. asymptotically distribution free) (WLS) and its variants (e.g., WLSMV).

  • Unweighted least squares (ULS).

  • Diagonally weighted least squares (DWLS).

  • Other methods not listed.

Models supported:

  • Single-group models with continuous variables.

  • Multiple-group models with continuous variables.

Models not tested:

  • Models with categorical variables.

Models not yet supported:

  • Models with formative factors.

  • Multilevel models.

See Also

semlbci(), ci_i_one()

Examples

Run this code
library(lavaan)
data(cfa_two_factors)
mod <-
"
f1 =~ x1 + x2 + x3
f2 =~ x4 + x5 + x6
"

fit <- sem(mod, cfa_two_factors)

# Should be 0
check_sem_out(fit)

fit2 <- sem(mod, cfa_two_factors, estimator = "DWLS")

# Should be negative because DWLS is officially not supported
check_sem_out(fit2)

fit3 <- sem(mod, cfa_two_factors, estimator = "MLR")

# Should be negative because MLR is supported only if
# robust is set to "satorra.2000"
check_sem_out(fit3)

# Should be zero because robust is set to "satorra.2000"
check_sem_out(fit3, robust = "satorra.2000")

Run the code above in your browser using DataLab