Learn R Programming

psychonetrics (version 0.17.8)

compare: Model comparison

Description

This function will print a table comparing multiple models on chi-square, AIC and BIC. When all compared models are fitted with a robust estimator, a Satorra-Bentler-family scaled chi-square difference test is added.

Usage

compare(..., scaled.test.method = c("auto", "satorra.bentler.2001",
        "satorra.bentler.2010", "satorra.2000"))

# S3 method for psychonetrics_compare print(x, ...)

Value

A data frame with chi-square values, degrees of freedoms, RMSEAs, AICs, and BICs, and---when all models are fitted with a robust estimator---scaled chi-square difference columns.

Arguments

...

Any number of psychonetrics models. Can be named to change the rownames of the output.

scaled.test.method

The scaled chi-square difference test to use when all compared models carry a robust scaling factor (see Details). "auto" (the default) selects the appropriate test from the models' scaled-test type, matching lavaan's lavTestLRT: the exact Satorra (2000) scaled-and-shifted test for the scaled-shifted (MLMV, WLSMV) and mean-and-variance-adjusted (MLMVS) estimators, and the Satorra-Bentler (2001) mean-scaled test for MLM / MLR. The remaining options force a specific test: "satorra.bentler.2001" (a mean-scaled test), "satorra.bentler.2010" (a strictly positive mean-scaled variant), or "satorra.2000" (an exact, scaled-and-shifted test, appropriate for the scaled-shifted estimators such as MLMV and WLSMV).

x

Output of the compare function.

Author

Sacha Epskamp

Details

When every compared model is fitted with a robust estimator (MLM, MLMV, MLMVS or MLR, or one of the least-squares estimators DWLS, WLS and ULS), two additional columns are added: Chisq_diff_scaled and p_value_scaled. These contain the Satorra-Bentler-family scaled chi-square difference test for each adjacent (nested) pair of models, sorted by degrees of freedom. The ordinary (unscaled) Chisq_diff, DF_diff and p_value columns are always present and unchanged. When the models are not fitted with a robust estimator (e.g. ordinary ML or FIML), the scaled columns are omitted entirely.

For an adjacent nested pair with the more constrained model \(M_0\) (degrees of freedom \(r_0\), unscaled chi-square \(T_0\), scaling factor \(c_0\)) nested in the less constrained model \(M_1\) (\(r_1\), \(T_1\), \(c_1\)), and \(m = r_0 - r_1\):

  • "satorra.bentler.2001" computes \(c_d = (r_0 c_0 - r_1 c_1)/m\) and \(T_d = (T_0 - T_1)/c_d\) (Satorra & Bentler, 2001).

  • "satorra.bentler.2010" replaces \(c_1\) by the scaling factor of \(M_1\) evaluated at \(M_0\)'s estimates, guaranteeing a positive statistic (Satorra & Bentler, 2010).

  • "satorra.2000" computes an exact, scaled-and-shifted statistic from the asymptotic covariance of the sample statistics (Satorra, 2000; Asparouhov & Muthen, 2010); this is the appropriate difference test for the scaled-shifted estimators MLMV and WLSMV.

The statistic is set to NA (with a warning) when the implied scaling factor is non-positive or a required building block cannot be computed.

References

Satorra, A. (2000). Scaled and adjusted restricted tests in multi-sample analysis of moment structures. In R. D. H. Heijmans, D. S. G. Pollock, & A. Satorra (Eds.), Innovations in multivariate statistical analysis (pp. 233-247). Kluwer Academic Publishers.

Satorra, A., & Bentler, P. M. (2001). A scaled difference chi-square test statistic for moment structure analysis. Psychometrika, 66(4), 507-514.

Satorra, A., & Bentler, P. M. (2010). Ensuring positiveness of the scaled difference chi-square test statistic. Psychometrika, 75(2), 243-248.

Asparouhov, T., & Muthen, B. (2010). Simple second order chi-square correction. Mplus technical appendix.

Examples

Run this code
if (FALSE) {
library("dplyr")

# Load data:
data(StarWars)

# Originally a partial measurement invariance model in
# https://psychonetrics.org/files/Epskampetal2017.pdf:
mod1 <- lvm(StarWars, lambda = matrix(1, 10), vars = paste0("Q", 1:10),
            identification = "variance", latents = "Force",
            estimator = "MLM") %>% runmodel

# A model fixing two prequel loadings to zero:
mod2 <- mod1 %>% fixpar("lambda", row = "Q4", col = "Force") %>%
  fixpar("lambda", row = "Q5", col = "Force") %>% runmodel

# Compare with the scaled (Satorra-Bentler 2001) difference test:
compare(full = mod1, restricted = mod2)
}

Run the code above in your browser using DataLab