Lavaan: Small N Chi Square Tests

by Arndt Regorz, MSc.
August 18, 2024

When the sample size is relatively small compared to the model complexity, then the chi square test of a CFA, SEM or Path Analysis can have an inflated type 1 error rate. This is called the model size effect (Shi et al, 2018).

To correct for that, there are different small N adjustments available. This tutorial shows you how to apply them using lavaan and the semTools package in R.

First, we need the packages lavaan and semTools.

library(lavaan)
library(semTools)

Then, we set up and run our model in the normal way. In this example I have chosen only the first 70 lines of the data frame in order to construct a situation with a small sample size.

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

cfa_fit_1 <- cfa(model_1,
data = HolzingerSwineford1939[1:70,])
summary(cfa_fit_1)

Then, we can call the small sample chi square tests with the chisqSmallN() funtion.

chisqSmallN(cfa_fit_1,
smallN.method = "all")

As a result, first we get the conventional chi square test results.

$standard
chisq df pvalue
47.585 24.000 0.003

Then, we get the results of four different small N adjustments for this test.

$swain
chisq df pvalue smallN.factor
44.852 24.000 0.006 0.943

$yuan.2015
chisq df pvalue smallN.factor
43.672 24.000 0.008 0.918

$yuan.2005
chisq df pvalue smallN.factor
44.073 24.000 0.007 0.926

$bartlett
chisq df pvalue smallN.factor
43.620 24.000 0.008 0.917

Based on Shi et al. (2018) I would use Yuan's test from 2015.

One important additional information: The small N adjustment is still based on the normality assumption. With non-normal data it can give false results.

References

Shi, D., Lee, T., & Terry, R. A. (2018). Revisiting the model size effect in structural equation modeling. Structural Equation Modeling: A Multidisciplinary Journal, 25(1), 21-40. https://doi.org/10.1080/10705511.2017.1369088

Citation

Regorz, A. (2024, August 18). Lavaan: Small N Chi Square Tests. Regorz Statistik. http://www.regorz-statistik.de/blog/lavaan_small_sample_chi_square.html