Introduction

In SEM, one of the first steps is to evaluate the model’s global fit. This is commonly done by presenting multiple fit indices, with some of the most common being based on the model’s $$\chi^2$$. We have developed Bayesian versions of these indices (Garnier-Villarreal and Jorgensen 2020) that can be computed with blavaan.

Noncentrality-Based Fit Indices

This group of indices compares the hypothesized model against the perfect saturated model. It specifically uses the noncentrality parameter $$\hat{\lambda} = \chi^2 - df$$, with the df being adjusted by different model/data characterictics. Specific indices include Root Mean Square Error of approximation (RMSEA), McDonald’s centrality index (Mc), gamma-hat ($$\hat{\Gamma}$$), and adjusted gamma-hat ($$\hat{\Gamma}_{adj}$$).

We will show an example with the Holzinger and Swineford (1939) example. You first estimate your SEM/CFA model as usual

HS.model <- ' visual  =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed   =~ x7 + x8 + x9 '

fit <- bcfa(HS.model, data=HolzingerSwineford1939, std.lv=TRUE)

You then need to pass the model to the blavFitIndices() function

gl_fits <- blavFitIndices(fit)

Finally, you can describe the posterior distribution for each of the indices with their summary() function. With this call, we see the 3 central tendency measures (mean median, and mode), the standard deviation, and the 90% Credible Interval

summary(gl_fits, central.tendency = c("mean","median","mode"), prob = .90)
##
## Posterior summary statistics and highest posterior density (HPD) 90% credible intervals for devm-based fit indices:
##
##                EAP Median   MAP    SD lower upper
## BRMSEA       0.099  0.098 0.098 0.005 0.089 0.106
## BGammaHat    0.956  0.957 0.957 0.004 0.950 0.964
## adjBGammaHat 0.907  0.908 0.909 0.010 0.893 0.923
## BMc          0.902  0.903 0.905 0.010 0.888 0.919

Incremental Fit Indices

Another group of fit indices compares the hypothesized model with the worst possible model, so they are called incremental indices. Such indices compare your model’s $$\chi^2_H$$ to the null model’s $$\chi^2_0$$ in different ways. Indices include the Comparative Fit Index (CFI), Tucker-Lewis Index (TLI), and Normed Fit Index (NFI).

To estimate these indices we need to defined and estimate the respective null model. The standard null model used by default in frequentist SEM programs (like lavaan) includes only the indicators variances and intercepts, and no covariances between items.

You can specify your null model by including only the respective indicator variances in your model syntax, such as

HS.model_null <- '
x1 ~~ x1
x2 ~~ x2
x3 ~~ x3
x4 ~~ x4
x5 ~~ x5
x6 ~~ x6
x7 ~~ x7
x8 ~~ x8
x9 ~~ x9 '

fit_null <- bcfa(HS.model_null, data=HolzingerSwineford1939)

Once you have your hypothesized and null models, you pass both to the blavFitIndices function, and now it will provide both types of fit indices

gl_fits_all <- blavFitIndices(fit, baseline.model = fit_null)

summary(gl_fits_all, central.tendency = c("mean","median","mode"), prob = .90)
##
## Posterior summary statistics and highest posterior density (HPD) 90% credible intervals for devm-based fit indices:
##
##                EAP Median   MAP    SD lower upper
## BRMSEA       0.099  0.098 0.098 0.005 0.089 0.106
## BGammaHat    0.956  0.957 0.957 0.004 0.950 0.964
## adjBGammaHat 0.907  0.908 0.909 0.010 0.893 0.923
## BMc          0.902  0.903 0.905 0.010 0.888 0.919
## BCFI         0.930  0.931 0.932 0.008 0.919 0.943
## BTLI         0.882  0.884 0.886 0.013 0.864 0.904
## BNFI         0.910  0.910 0.912 0.007 0.899 0.922

The summary() method now presents the central tendicy measure you asked for, standard deviation, and credible interval for the noncentrality and incremental fit indices.

Access the indices posterior distributions

You can also extract the posterior distributions for the respective indices, this way you can explore further details. For example, diagnostic plots using the bayesplot package.

dist_fits <- data.frame(gl_fits_all@indices)
head(dist_fits)
##       BRMSEA BGammaHat adjBGammaHat       BMc      BCFI      BTLI      BNFI
## 1 0.10306672 0.9526919    0.8987979 0.8942868 0.9234534 0.8713433 0.9034004
## 2 0.09975553 0.9555499    0.9049116 0.9006260 0.9281997 0.8793207 0.9079379
## 3 0.10019958 0.9551710    0.9041012 0.8997853 0.9276594 0.8784125 0.9074455
## 4 0.09812653 0.9569277    0.9078592 0.9036847 0.9312129 0.8843851 0.9110282
## 5 0.09998952 0.9553504    0.9044850 0.9001834 0.9285181 0.8798559 0.9084212
## 6 0.09970837 0.9555900    0.9049975 0.9007151 0.9291350 0.8808926 0.9090730

Once we have saved the posterior distributions, we can explore the the histogram and scatterplots between indices.

mcmc_pairs(dist_fits, pars = c("BRMSEA","BGammaHat","BCFI","BTLI"),
diag_fun = "hist")

Summary

You can estimate posterior distributions for $$\chi^2$$ based global fit indices. Notice that here we only presented the fit indices based on the recommended method devM and with the recommended number of parameters metric loo. These can be adjusted by the user if desired.

The general recommendation is to prefer $$\hat{\Gamma}$$ and CFI, as these have shown to be less sensitive to model and data characteristics.

These defaults and recommendations are made based on previous simulation research. For more details about the fit indices please see Garnier-Villarreal and Jorgensen (2020).

References

Garnier-Villarreal, Mauricio, and Terrence D Jorgensen. 2020. “Adapting Fit Indices for Bayesian Structural Equation Modeling: Comparison to Maximum Likelihood.” Psychological Methods 25 (1): 46–70. https://doi.org/dx.doi.org/10.1037/met0000224.
Holzinger, K. J., and F. A. Swineford. 1939. A Study of Factor Analysis: The Stability of a Bi-Factor Solution. Supplementary Educational Monograph 48. Chicago: University of Chicago Press.