11  Hypothesis testing

11.1 Testing restrictions on model parameters

The chi-square test statistics of Section 8.5 evaluate the fit of a single model against the unrestricted (\mathsf{H}_1) alternative: the null hypothesis is the user-specified moment structure, and the alternative leaves the moment vector \boldsymbol{\sigma} completely free. In practice, many research questions are not about the model as a whole, but about specific restrictions on its parameters: whether two factor loadings are equal, whether a direct effect is zero once the indirect paths are included, or whether the loadings differ across groups. Each of these questions compares two models that differ only in a set of constraints, while sharing the same basic structure.

Statistics offers three classical routes to answer such questions: the likelihood ratio test, the Wald test, and the score (or Lagrange multiplier) test. The three tests are asymptotically equivalent: under the null hypothesis (and under a sequence of local alternatives) they converge to the same chi-square distribution. But they approach the problem from different angles, they require different ingredients, and they can disagree in finite samples. In lavaan, each of the three tests has a dedicated function: lavTestLRT(), lavTestWald(), and lavTestScore(). This chapter discusses the three functions in detail: their statistical background, their arguments, and their implementation (a map of the source files of the current implementation is given in the implementation notes at the end of this chapter, Section 11.6). The three functions were introduced briefly in Section 9.8; this chapter treats them in full.

11.1.1 Nested models and restriction functions

Throughout this chapter, we consider two models. The unrestricted model \mathsf{M}_1 has free parameter vector \boldsymbol{\vartheta} of length T_1; the restricted model \mathsf{M}_0 is obtained from \mathsf{M}_1 by imposing K additional restrictions, which we collect in a vector-valued restriction function:

H_0:\; \mathbf{r}(\boldsymbol{\vartheta}) = \mathbf{0}, \qquad \mathbf{r}: \mathbb{R}^{T_1} \rightarrow \mathbb{R}^{K}. \tag{11.1}

Two models related in this way are called nested: every moment structure that \mathsf{M}_0 can produce can also be produced by \mathsf{M}_1. The restrictions may fix parameters to constants (e.g., \vartheta_j = 0), impose equalities (e.g., \vartheta_j - \vartheta_k = 0), or be genuinely nonlinear functions of several parameters. Note that this is exactly the same device as the equality constraint function \mathbf{c}_{\text{eq}}(\boldsymbol{\vartheta}) of Section 7.7.2; the Jacobian of the restrictions,

\mathbf{R}(\boldsymbol{\vartheta}) = \frac{\partial\, \mathbf{r}(\boldsymbol{\vartheta})}{\partial\, \boldsymbol{\vartheta}^{\prime}}, \tag{11.2}

an K\times T_1 matrix, plays the same role as the constraint Jacobian \mathbf{R}_{\text{eq}} there. We write \hat{\boldsymbol{\vartheta}} for the estimator under \mathsf{M}_1 and \tilde{\boldsymbol{\vartheta}} for the estimator under \mathsf{M}_0, and we assume that the restrictions are functionally independent, so that \mathbf{R}(\boldsymbol{\vartheta}) has full row rank K.

The special case of Section 8.5 fits in this framework as well: the overall chi-square statistic tests the user model (\mathsf{M}_0) against the saturated model (\mathsf{M}_1), and the “restrictions” are then all the constraints that the moment structure \boldsymbol{\sigma}(\boldsymbol{\vartheta}) imposes on the unrestricted moment vector \boldsymbol{\sigma}. In this chapter, both \mathsf{M}_0 and \mathsf{M}_1 are typically proper (over-identified) structural models, but everything below also applies when \mathsf{M}_1 is saturated.

11.1.2 Three asymptotically equivalent tests

The three classical tests can be motivated from the shape of the log-likelihood function, as in the expository note by Buse (1982). Figure 11.1 shows the situation for a single parameter with restriction \vartheta = \vartheta_0:

  • the likelihood ratio (LR) test measures the vertical distance: the drop in the maximized log-likelihood when the restriction is imposed. It needs both the restricted and the unrestricted solution.

  • the Wald test measures the horizontal distance: the distance of the unrestricted estimate \hat{\vartheta} from the hypothesized value \vartheta_0, in units of its standard error. It needs only the unrestricted solution.

  • the score (Lagrange multiplier) test measures the slope of the log-likelihood at the restricted solution: if the restriction is correct, the gradient evaluated at \vartheta_0 should be close to zero; a steep slope indicates that releasing the restriction would improve the fit substantially. It needs only the restricted solution.

Figure 11.1: The three classical tests for a single parameter with restriction \vartheta = \vartheta_0. The likelihood ratio test measures the vertical drop in the log-likelihood, the Wald test the horizontal distance between the estimates, and the score test the slope of the log-likelihood at the restricted value. The dashed horizontal lines mark the maximized log-likelihoods under \mathsf{M}_0 and \mathsf{M}_1.

Under the null hypothesis Equation 11.1, all three statistics converge in distribution to \chi^2(K), and their differences vanish asymptotically. The practical distinction lies in what must be estimated, summarized in Table 11.1.

Table 11.1: The three classical tests and their lavaan implementations.
Test Statistic based on Model(s) to be fitted lavaan function
Likelihood ratio drop in (log-)likelihood both \mathsf{M}_0 and \mathsf{M}_1 lavTestLRT(), anova()
Wald distance \mathbf{r}(\hat{\boldsymbol{\vartheta}}) from zero \mathsf{M}_1 only (unrestricted) lavTestWald()
Score (LM) gradient at \tilde{\boldsymbol{\vartheta}} \mathsf{M}_0 only (restricted) lavTestScore()

Each test has its typical use. The likelihood ratio test is the canonical tool for model comparison, when both models have been (or can easily be) fitted. The Wald test is most useful when only the unrestricted model is available: the z statistics in the summary() output are Wald tests of single parameters, and lavTestWald() generalizes them to arbitrary joint restrictions. The score test is the tool of model modification: starting from a restricted model, it indicates which constraints could be released to improve the fit. This is precisely the logic behind the modification indices of Section 10.11, which are univariate score tests for fixed-to-zero parameters. We do not repeat that material here; this chapter covers the general procedure, of which modindices() is a special case.

11.1.3 A running example

To keep the three tests comparable, we use a single restriction throughout the chapter. In the Holzinger–Swineford three-factor model, we test whether the loadings of x2 and x3 on the visual factor are equal. The unrestricted model \mathsf{M}_1 labels the two loadings:

model_h1 <- '
  visual  =~ x1 + b2*x2 + b3*x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
'
fit1 <- cfa(model_h1, data = HolzingerSwineford1939)

The restricted model \mathsf{M}_0 uses the same label for both loadings, which imposes the equality constraint (see Section 7.7.1):

model_h0 <- '
  visual  =~ x1 + b*x2 + b*x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
'
fit0 <- cfa(model_h0, data = HolzingerSwineford1939)

In the notation of Equation 11.1, \mathbf{r}(\boldsymbol{\vartheta}) = b_2 - b_3 and K= 1. The unrestricted estimates are:

coef(fit1)[c("b2", "b3")]
       b2        b3 
0.5535003 0.7293702 

The two loadings differ somewhat (0.554 versus 0.729), but they also carry substantial sampling variability; whether the difference is statistically distinguishable from zero is the question that the three tests address.

11.2 The likelihood ratio test: lavTestLRT()

11.2.1 The chi-square difference test

For maximum likelihood estimation, the likelihood ratio test statistic for \mathsf{M}_0 against \mathsf{M}_1 is

X^2_D = -2\bigl[\log L(\tilde{\boldsymbol{\vartheta}}) - \log L(\hat{\boldsymbol{\vartheta}})\bigr], \tag{11.3}

which, under H_0 and the usual regularity conditions, converges to a \chi^2(K) distribution, where K equals the difference in degrees of freedom between the two models. Because the overall chi-square statistic of each model is itself a likelihood ratio test against the saturated model (Section 8.5.2), the saturated log-likelihood cancels from the difference, and Equation 11.3 can be computed as the difference between the two chi-square statistics:

X^2_D = X^2_0 - X^2_1, \qquad K= \mathrm{df}_0 - \mathrm{df}_1. \tag{11.4}

This is why the likelihood ratio test is known in the SEM literature as the chi-square difference test. In lavaan, it is carried out by lavTestLRT(), which takes two (or more) fitted lavaan objects:

lavTestLRT(fit0, fit1)
Chi-Squared Difference Test

     Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)
fit1 24 7517.5 7595.3 85.305                                       
fit0 25 7518.2 7592.3 87.971      2.665 0.074374       1     0.1026

The Chisq diff column contains X^2_D = 87.971 - 85.305 = 2.665 with K= 25 - 24 = 1 degrees of freedom and a p-value of about 0.10: at the conventional 5\% level, the equality of the two loadings is not rejected. The equivalence of Equation 11.3 and Equation 11.4 can be verified directly:

c(diff = fitMeasures(fit0, "chisq") - fitMeasures(fit1, "chisq"),
  lrt  = -2 * (logLik(fit0) - logLik(fit1)))
diff.chisq        lrt 
  2.664989   2.664989 

The table also reports, per model, the degrees of freedom, the information criteria AIC and BIC (for ML estimation), and the overall chi-square statistic. An RMSEA column is added (for models fitted to complete data under listwise deletion, and not for PML) containing the RMSEA of the difference test, \text{RMSEA}_D [Savalei et al. (2024); sometimes called the root deviance ratio, RDR], computed by plugging X^2_D and K into the RMSEA formula of Section 10.4; it expresses the size of the misfit implied by the restrictions on the familiar RMSEA scale.

The anova() method for lavaan objects is a thin wrapper: it extracts the model names from the call and forwards everything to lavTestLRT():

anova(fit0, fit1)                     # identical output

Additional arguments (method=, type=, …) supplied to anova() are passed on to lavTestLRT(). The model_names= argument (of either function) overrides the row names of the table.

When more than two models are supplied, they are first ordered by their degrees of freedom (the model with the most parameters, that is, the fewest degrees of freedom, comes first), and each consecutive pair is compared, yielding a sequence of difference tests. For example, adding a third model that also restricts two loadings of the textual factor to be equal:

model_h00 <- '
  visual  =~ x1 + b*x2 + b*x3
  textual =~ x4 + c*x5 + c*x6
  speed   =~ x7 + x8 + x9
'
fit00 <- cfa(model_h00, data = HolzingerSwineford1939)
lavTestLRT(fit00, fit0, fit1)
Chi-Squared Difference Test

      Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)   
fit1  24 7517.5 7595.3 85.305                                          
fit0  25 7518.2 7592.3 87.971     2.6650 0.074374       1   0.102579   
fit00 26 7525.4 7595.9 97.249     9.2789 0.165845       1   0.002318 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Each row (after the first) tests the model on that row against the model on the row above it, not against the first model.

Finally, lavTestLRT() (or anova()) can also be called with a single model. In that case, the model is compared against the saturated model, and the result reproduces the overall chi-square test of Section 8.5.2 in an anova-style table:

anova(fit1)
Chi-Squared Test Statistic (unscaled)

          Df    AIC    BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
Saturated  0                0.000                                  
Model     24 7517.5 7595.3 85.305     85.306      24  8.503e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The returned table carries a few attributes that record what was computed, so that packages building on lavaan need not parse the heading: type (the canonical test type, such as "chisq" or "browne.residual.nt.model"), method (the difference-test method: "satorra.bentler.2001", say; "standard" when no scaling method was involved, "fmg" for the FMG tests), test (the scaled test the difference test is based on, "standard" if unscaled), and scaled (a logical). They are set for the single-model table as well.

When several test statistics were stored at fitting time (as is the current default for estimator = "ML", which includes Browne’s residual-based test alongside the standard chi-square; see Section 8.5.10), the single-model table picks its test by name, not by position: first a genuinely scaled test if one is present; otherwise the fit’s own default test if it is not the standard one (so a continuous ULS or DWLS fit reports its browne.residual.nt statistic under its own label); and otherwise the standard chi-square, which is what a default ML fit shows here.

11.2.2 What is checked, and what is not

The chi-square difference test is only meaningful when the models are nested, fitted on the same data, and estimated with the same estimator. lavTestLRT() performs a number of consistency checks before it computes the test. The function warns when:

  • the models are not all based on the same set of observed variables;
  • the models do not appear to be fitted to the same data: all models must share the same number of groups, the same group labels (in the same order), the same (group-specific) numbers of observations, and the same observed sample statistics; the first mismatch that is found is reported (a check in the spirit of the net() function of the semTools package);
  • some (but not all) models include a mean structure (an error is thrown if the mean structures are inconsistent);
  • some models did not converge;
  • a restricted model fits better than a less restricted one, i.e., some X^2_D < 0 (beyond a small numerical tolerance), a clear indication that either the models are not nested, or that one of the solutions is not a global optimum;
  • two models have the same degrees of freedom (the corresponding p-value is set to NA, unless inequality constraints are present, in which case equal degrees of freedom can occur legitimately).

The same-data check detects a common mistake: comparing a single-group model (fitted to the pooled data) with a multiple-group model. Although both models are fitted to the same data file, they are not fitted to the same sample statistics (one pooled covariance matrix versus one per group), and the difference between their chi-square statistics is meaningless. The warning then points to the help page, which shows the proper way to test across-group equality: fit both models as multiple-group models, and impose the restrictions via the group_equal= argument (see Section 11.2.10). A different number of observations is often the result of listwise deletion operating on different sets of variables; refitting all the models on the same set of cases (or using missing = "ml") resolves the issue.

The checks above concern the data and the fitting process. Whether the models are actually nested, that is, whether every model in the sequence is a restricted version of its predecessor, is a separate question: two models fitted to the same variables, one with a few parameters less than the other, may pass all the checks above and still not be nested, in which case the “difference test” is statistically meaningless. That question is answered by the NET procedure of the next section, which lavTestLRT() runs on every adjacent pair of models by default.1

One class of models bypasses the chi-square statistics altogether. For models with a casewise likelihood (random slopes, Section 16.13; and data-defined parameters estimated by an external backend, Section 2.9), no chi-square statistic exists, and lavTestLRT() compares the models by their log-likelihoods directly: the models are ordered by their number of free parameters, and twice the difference in log-likelihood between consecutive models is referred to a chi-square distribution with the difference in the number of free parameters as degrees of freedom. The table is then headed casewise loglikelihoods and reports Npar, AIC, BIC, and logLik instead of the degrees of freedom and chi-square columns. When any model of the sequence is of this class, all must be (a casewise model cannot be compared with a model fitted to summary statistics), every model needs a log-likelihood, and all must share the number of observations; the method, test and type arguments are ignored. The checks on convergence, on a better-fitting restricted model, and on equal parameter counts apply as before.

11.2.3 Nesting and equivalence testing: NET

lavaan implements the NET (Nesting and Equivalence Testing) procedure of Bentler and Satorra (2010), exposed as the standalone function lavTestNET() and applied automatically by lavTestLRT().

The idea behind NET is simple. Call the more restricted model \mathsf{M}_0 and the less restricted model \mathsf{M}_1. Take the model-implied moments of \mathsf{M}_0, evaluated at its parameter estimates, and treat them as if they were sample statistics; then fit \mathsf{M}_1 to these moments. If \mathsf{M}_0 is nested within \mathsf{M}_1, every set of moments that \mathsf{M}_0 can produce is also attainable by \mathsf{M}_1, so the minimum of the fit function of \mathsf{M}_1 must be exactly zero. If the minimum is positive, \mathsf{M}_1 cannot reproduce the moments of \mathsf{M}_0, and the models are not nested. Because the minimum is found numerically, a criterion is applied (following Asparouhov & Muthén, 2019): fit function values below crit (default 10^{-7}) count as nested, values above 10 * crit as not nested, and values in between are reported as inconclusive. Note that this is nesting in the moment sense (one set of moment structures contained in another), which is precisely the sense that matters for the chi-square difference test; the models need not be parametrically related at all.

The procedure has two refinements. First, when the nesting is parametric, that is, the parameter table of \mathsf{M}_0 is recognizably that of \mathsf{M}_1 with some free parameters fixed and/or constrained to be equal, no refitting is needed, and the (numerically exact) verdict is read off the parameter tables directly. Second, checking only at the parameter estimates can occasionally be misleading: two models may accidentally produce reproducible moments at those particular values without being nested in general. The argument npoints guards against such “data specific” conclusions by repeating the check at randomly perturbed parameter values of \mathsf{M}_0 (respecting any constraints; iseed controls the perturbations), as recommended by Asparouhov and Muthén (2019).

The standalone function lavTestNET() accepts any number of fitted models and runs the check for every pair; for pairs with equal degrees of freedom, it checks nesting in both directions, which is the definition of equivalence: two equivalent models imply the same set of moment structures and cannot be distinguished by any test based on those moments. An example uses four models, namely the three-factor Holzinger–Swineford CFA, the same model with std_lv = TRUE (a mere reparameterization), the orthogonal-factors version (a genuine restriction), and a two-factor model with a different indicator assignment (a different model altogether):

model_3f <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '
fit_3f      <- cfa(model_3f, data = HolzingerSwineford1939)
fit_3f_std  <- cfa(model_3f, data = HolzingerSwineford1939, std_lv = TRUE)
fit_3f_orth <- cfa(model_3f, data = HolzingerSwineford1939,
                   orthogonal = TRUE)
model_2f <- ' f1 =~ x1 + x2 + x3 + x4
              f2 =~ x5 + x6 + x7 + x8 + x9 '
fit_2f <- cfa(model_2f, data = HolzingerSwineford1939)

lavTestNET(fit_3f, fit_3f_std, fit_3f_orth, fit_2f,
           model_names = c("3f", "3f-std.lv", "3f-orth", "2f"))
Nesting and Equivalence Testing (NET)

                            3f  3f-std.lv 2f 3f-orth
3f (df = 24)                 - equivalent           
3f-std.lv (df = 24) equivalent          -           
2f (df = 26)                no         no  -        
3f-orth (df = 27)       nested     nested no       -

Entry [i, j]: is the model in row i nested within the model in column j?
(criterion: fit function value < 1e-07 computed at 1 parameter point(s))

The matrix shows the expected pattern: the orthogonal model is nested within both versions of the full three-factor model, the std_lv variant is flagged as equivalent to the original (same moment structures, different parameterization), and the two-factor model is nested in neither.

Inside lavTestLRT(), the same check runs by default (argument check_nested = TRUE) on every adjacent pair in the sequence. If a pair fails the NET check, a warning states that the difference test may be invalid. And the equal-degrees-of-freedom situation from the list above becomes considerably more informative: instead of the generic “some models have the same degrees of freedom”, the warning now reports a verdict: either the two models are equivalent (so the difference test is meaningless), or they are not equivalent despite their equal degrees of freedom (so the difference test is invalid). Setting check_nested = FALSE skips the check.

One caveat remains, even with NET in place: nesting in the moment sense is a necessary condition for the difference test, not a sufficient one. If the nesting holds only on the boundary of the parameter space (the restricted model fixes a variance to zero, say), the standard regularity conditions fail and X^2_D is no longer asymptotically chi-square distributed (its limiting distribution is then a mixture, a so-called chi-bar-square). NET establishes how the models are related to each other, not that the asymptotics are regular. Also, the check is currently not available for multilevel models, nor for a few special cases (categorical data with conditional_x = TRUE, correlation structures, models with auxiliary variables, marginal maximum likelihood, free group weights, and fits that keep no data or sample statistics); for those, lavTestLRT() silently skips it, while the standalone lavTestNET() prints the reason why a pair of models could not be checked.

A frequent source of apparent non-nesting is a restricted model whose optimizer stopped in a local optimum: the restricted model then fits better than the unrestricted one, and X^2_D is negative. Before concluding that the models are not nested, refit the less restricted model with different starting values (see Section 6.3). The NET check helps with the diagnosis: if lavTestNET() declares the models nested and X^2_D is nevertheless negative, a local optimum (in one of the two fits) is the cause.

11.2.4 Scaled difference tests

When the models have been fitted with a robust (scaled) test statistic (test = "satorra.bentler", "yuan.bentler", "mean.var.adjusted", "scaled.shifted", or one of their variants; see Section 8.5.3), the difference test must be adjusted as well. Importantly, the difference between two scaled statistics is not a valid test statistic: if X^2_{M,0} = X^2_0/c_0 and X^2_{M,1} = X^2_1/c_1 are the scaled statistics of the two models, with scaling factors c_0 and c_1, the difference X^2_{M,0} - X^2_{M,1} does not follow (even asymptotically) a chi-square distribution, and it can easily be negative (Satorra & Bentler, 2001). This is why the output of lavTestLRT() for scaled tests prints a note stressing that the Chisq column contains the standard (unscaled) statistics: a proper robust difference test is a function of the two unscaled statistics, combined with an appropriate scaling correction for the difference.

To illustrate the procedure, we refit the two models of the running example with the Satorra–Bentler scaled test statistic:

fit1m <- cfa(model_h1, data = HolzingerSwineford1939, estimator = "MLM")
fit0m <- cfa(model_h0, data = HolzingerSwineford1939, estimator = "MLM")

The method= argument of lavTestLRT() selects how the scaling correction for the difference test is computed. The available values are "default", "standard", "satorra.bentler.2001", "satorra.bentler.2010", and "satorra.2000" (case, dots, dashes, and underscores in these names are ignored; a sixth value, "mean.var.adjusted.PLRT", applies to PML estimation only). With method = "standard", no robust adjustment is applied and the plain difference test of Section 11.2.1 is computed from the unscaled statistics. The three robust methods are discussed in turn below.

11.2.5 The Satorra–Bentler (2001) approach

Satorra and Bentler (2001) showed that a scaling factor for the difference test can be recovered from quantities that are already available in the two fitted objects. With \mathrm{df}_0 and \mathrm{df}_1 the degrees of freedom of the two models (as in Equation 11.4), and c_0 and c_1 for their scaling factors, the scaled difference test statistic is

X^2_{D,M} = X^2_D / c_D, \qquad c_D = \frac{\mathrm{df}_0\, c_0 - \mathrm{df}_1\, c_1}{K}, \tag{11.5}

referred to a \chi^2(K) distribution. The rationale is that \mathrm{df}\, c = \mathrm{tr}[\mathbf{U}\boldsymbol{\Gamma}] for each model (see Equation 8.44 in Section 8.5.4), and the trace of the residual weight matrix associated with the difference is (asymptotically) the difference of the two traces. This is the default method when the models were fitted with test = "satorra.bentler", "yuan.bentler", or "yuan.bentler.mplus":

lavTestLRT(fit0m, fit1m)
Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")

lavaan->lavTestLRT():  
   lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
   robust test that should be reported per model. A robust difference test is 
   a function of two standard (not robust) statistics.

      Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)  
fit1m 24 7517.5 7595.3 85.305                                         
fit0m 25 7518.2 7592.3 87.971     3.8765 0.081054       1    0.04897 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The scaled difference statistic is 3.877 with scaling factor c_D = 0.687 (stored in the "scale" attribute of the returned table). We can verify Equation 11.5 by hand:

X2_D <- unname(fitMeasures(fit0m, "chisq") - fitMeasures(fit1m, "chisq"))
c0  <- unname(fitMeasures(fit0m, "chisq_scaling_factor"))
c1  <- unname(fitMeasures(fit1m, "chisq_scaling_factor"))
cD  <- (25 * c0 - 24 * c1) / 1
c(c.delta = cD, X2.delta = X2_D / cD)
  c.delta  X2.delta 
0.6874782 3.8764698 

Note that the robust difference test (p = 0.049) leads to a different decision than the standard difference test (p = 0.103) in this example, a useful reminder that scaling corrections matter not only for the overall fit statistic.

Two special cases are intercepted in the computation: when \mathsf{M}_1 is saturated (\mathrm{df}_1 = 0), its undefined scaling factor is set to 1 (it is multiplied by zero in any case), and when \mathsf{M}_1 fits perfectly (X^2_1 \approx 0) its scaling factor is set to 0.

The weakness of Equation 11.5 is that c_D is a difference of two nonnegative quantities, and nothing guarantees that it is positive. In small samples, or when the restrictions are severe, it can happen that \mathrm{df}_0\, c_0 < \mathrm{df}_1\, c_1, in which case the scaled difference statistic would be negative. lavaan then warns ("scaling factor is negative"), sets the scaling factor to NA, and falls back to reporting the unscaled difference test. The remedy is the strictly positive variant discussed next.

11.2.6 The Satorra–Bentler (2010) approach

Satorra and Bentler (2010) proposed a modification that ensures a positive scaling factor. The problematic term in Equation 11.5 is \mathrm{df}_1\, c_1, which is computed at the unrestricted estimate \hat{\boldsymbol{\vartheta}}; the 2010 version replaces it by the same quantity computed at the restricted estimate. To this end, an auxiliary model \mathsf{M}_{1|0} is constructed: the model structure of \mathsf{M}_1, evaluated at the parameter values of \mathsf{M}_0 (with the parameters that \mathsf{M}_0 restricts held at their restricted values). Because \mathsf{M}_{1|0} and \mathsf{M}_0 are evaluated at the same point in the parameter space, the two traces entering the difference are now computed at a common (consistent-under-H_0) estimate, and the resulting scaling factor

c_D = \frac{\mathrm{df}_0\, c_0 - \mathrm{df}_1\, c_{10}}{K} \tag{11.6}

is guaranteed to be positive (asymptotically, and in virtually all finite-sample applications; see also Bryant and Satorra (2012) for a tutorial treatment). Here, c_{10} denotes the scaling factor of the \mathsf{M}_{1|0} model. In lavaan:

lavTestLRT(fit0m, fit1m, method = "satorra.bentler.2010")
Scaled Chi-Squared Difference Test (method = "satorra.bentler.2010")

lavaan->lavTestLRT():  
   lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
   robust test that should be reported per model. A robust difference test is 
   a function of two standard (not robust) statistics.

      Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)  
fit1m 24 7517.5 7595.3 85.305                                         
fit0m 25 7518.2 7592.3 87.971     3.6281 0.080084       1    0.05681 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The result (3.628) is close to, but not identical to, the 2001 version (3.877); the two are asymptotically equivalent under the null.

Internally, the \mathsf{M}_{1|0} model is created from the parameter table of \mathsf{M}_1 by inserting the estimated values of \mathsf{M}_0 as starting values (start = pt_m0_extended), and it is refitted with optim_method = "none" and optim_force_converged = TRUE. No iterations are performed: the model is only evaluated at the inserted values, and its test statistics (including the scaling factor c_{10}) are computed there. If the information matrix of the \mathsf{M}_{1|0} model is not positive definite at that point, a warning is issued, as the scaling factor may then still be unreliable.

11.2.7 The Satorra (2000) approach

The most general method implements the original framework of Satorra (2000), which derives the asymptotic distribution of the difference statistic directly, rather than reconstructing it from per-model scaling factors. Under H_0 and general distributional conditions, X^2_D converges to a weighted sum of K independent \chi^2(1) variables (the exact analog of Equation 8.41 for the overall test), with weights given by the nonzero eigenvalues of \mathbf{U}_D\boldsymbol{\Gamma}, where \mathbf{U}_D is a residual weight matrix associated with the K restrictions. The method needs \boldsymbol{\Gamma}; with incomplete data under missing = "ml", the FIML sandwich estimate Equation 8.21 takes that role. This situation only arises for models fitted with a Yuan–Bentler test, because the Satorra–Bentler, mean-and-variance adjusted, and scaled-and-shifted tests cannot be combined with missing = "ml": requested through test=, they switch to listwise deletion with a warning, and the MLM, MLMV and MLMVS shortcuts stop with an error.

lavaan computes the required traces in the parameter space of \mathsf{M}_1. Let \mathbf{A} denote the (unit) information matrix of \mathsf{M}_1, expected or observed according to the information= option the models were fitted with. For the expected information, \mathbf{A} = \mathbf{A}_E(\boldsymbol{\vartheta}) = \boldsymbol{\Delta}^{\prime}\mathbf{W}\boldsymbol{\Delta} in the triple-product form of Section 8.2.1, where \boldsymbol{\Delta} is the model Jacobian of \mathsf{M}_1 and \mathbf{W}= \mathbf{A}_E(\boldsymbol{\sigma}) is the weight matrix implied by the estimator, that is, the expected information of the unrestricted model evaluated in the \mathsf{H}_1 moment space; the same \mathbf{W} enters \mathbf{B}_g below. Let \mathbf{R}_D be the K\times T_1 Jacobian of the additional restrictions that turn \mathsf{M}_1 into \mathsf{M}_0. Define

\mathbf{M}_D = \mathbf{A}^{-1}\mathbf{R}_D^{\prime} \bigl(\mathbf{R}_D\mathbf{A}^{-1}\mathbf{R}_D^{\prime}\bigr)^{-1} \mathbf{R}_D\mathbf{A}^{-1}, \qquad \mathbf{B}_g = \boldsymbol{\Delta}_g^{\prime}\mathbf{W}_g\boldsymbol{\Gamma}_g\mathbf{W}_g\boldsymbol{\Delta}_g , \tag{11.7}

where \mathbf{B}_g is the group-g contribution to the “meat” of the sandwich covariance matrix of Section 8.4.4 (with \mathbf{A} in the role of the “bread”). Then (Satorra, 2000, eq. 23)

\mathrm{tr}[\mathbf{U}_D\boldsymbol{\Gamma}] = \sum_{g=1}^{G} f_g\, \mathrm{tr}[\mathbf{M}_D\mathbf{B}_g], \qquad \mathrm{tr}\bigl[(\mathbf{U}_D\boldsymbol{\Gamma})^2\bigr] = \mathrm{tr}\bigl[(\mathbf{M}_D\mathbf{B})^2\bigr], \quad \mathbf{B} = \sum_{g=1}^{G} f_g \mathbf{B}_g, \tag{11.8}

with f_g = N_g/N the group proportions.2 From these two traces, lavTestLRT() can construct three final statistics, mirroring the single-model corrections of Section 8.5.3:

  • a mean-corrected (scaled) statistic X^2_{D,M} = X^2_D / c_D with c_D = \mathrm{tr}[\mathbf{U}_D\boldsymbol{\Gamma}]/K, referred to \chi^2(K);

  • a mean-and-variance adjusted statistic X^2_{D,MV} = X^2_D / c^{\star} (Satterthwaite-style, cf. Section 8.5.6) with c^{\star} = \mathrm{tr}[(\mathbf{U}_D\boldsymbol{\Gamma})^2] / \mathrm{tr}[\mathbf{U}_D\boldsymbol{\Gamma}] and fractional degrees of freedom K^{\star} = \bigl(\mathrm{tr}[\mathbf{U}_D\boldsymbol{\Gamma}]\bigr)^2 / \mathrm{tr}[(\mathbf{U}_D\boldsymbol{\Gamma})^2];

  • a scaled-and-shifted statistic (cf. Section 8.5.7) with X^2_{D,SS} = a\,X^2_D + b, where a = \sqrt{K/ \mathrm{tr}[(\mathbf{U}_D\boldsymbol{\Gamma})^2]} and b = K- a\,\mathrm{tr}[\mathbf{U}_D\boldsymbol{\Gamma}], referred to \chi^2(K) with integer degrees of freedom.

The scaled_shifted= argument (default TRUE) selects the scaled-and-shifted version, regardless of the test the models were fitted with. With scaled_shifted = FALSE, the mean-corrected version is used when the models were fitted with a Satorra–Bentler or Yuan–Bentler test, and the mean-and-variance adjusted version otherwise. Requesting the method explicitly:

lavTestLRT(fit0m, fit1m, method = "satorra.2000")
Scaled and Shifted Chi-Squared Difference Test (method = "satorra.2000")

lavaan->lavTestLRT():  
   lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
   robust test that should be reported per model. A robust difference test is 
   a function of two standard (not robust) statistics.

      Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)  
fit1m 24 7517.5 7595.3 85.305                                         
fit0m 25 7518.2 7592.3 87.971     3.5538 0.074374       1    0.05941 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
lavTestLRT(fit0m, fit1m, method = "satorra.2000", scaled_shifted = FALSE)
Scaled Chi-Squared Difference Test (method = "satorra.2000")

lavaan->lavTestLRT():  
   lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
   robust test that should be reported per model. A robust difference test is 
   a function of two standard (not robust) statistics.

      Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)  
fit1m 24 7517.5 7595.3 85.305                                         
fit0m 25 7518.2 7592.3 87.971     3.5538 0.079765       1    0.05941 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

With a single restriction the two variants coincide (there is only one eigenvalue, so \mathrm{tr}[(\mathbf{U}_D\boldsymbol{\Gamma})^2] = \mathrm{tr}[\mathbf{U}_D\boldsymbol{\Gamma}]^2); with K> 1 they generally differ. method = "satorra.2000" is the default when the models were fitted with test = "mean.var.adjusted" or test = "scaled.shifted", for which the 2001/2010 methods do not apply (their per-model scaling factors match a different correction). It can also be requested explicitly for Satorra–Bentler or Yuan–Bentler fitted models, as above.3

The matrix \mathbf{R}_D in Equation 11.7, the Jacobian of the function that maps the parameters of \mathsf{M}_1 onto the restrictions defining \mathsf{M}_0, is the one ingredient that must be constructed from the two fitted objects, because the user never writes down \mathbf{r}(\boldsymbol{\vartheta}) explicitly: \mathsf{M}_0 is specified as a separate model, not as a set of restrictions on \mathsf{M}_1. The a_method= argument selects one of two strategies for this reconstruction:

  • a_method = "delta" (the default) uses only the two model Jacobians. If \boldsymbol{\Delta}_1 and \boldsymbol{\Delta}_0 are the Jacobians of the moment structure with respect to the parameters of \mathsf{M}_1 and \mathsf{M}_0, nestedness implies that the columns of \boldsymbol{\Delta}_0 lie (locally) in the column space of \boldsymbol{\Delta}_1. The matrix \mathbf{H} = \boldsymbol{\Delta}_1^{+}\boldsymbol{\Delta}_0 (with ^{+} the Moore–Penrose inverse) expresses the parameter directions of \mathsf{M}_0 in the parameter space of \mathsf{M}_1, and \mathbf{R}_D is taken as the orthogonal complement of \mathbf{H}: the K directions in the parameter space of \mathsf{M}_1 along which the restricted model cannot move. Equality constraints already present in either model are first absorbed by projecting the Jacobians onto the corresponding constrained bases (cf. Section 7.7.6).

  • a_method = "exact" builds the restriction function \mathbf{r}(\boldsymbol{\vartheta}) symbolically, from a comparison of the two parameter tables: every parameter that is free in \mathsf{M}_1 but fixed in \mathsf{M}_0 contributes a restriction of the form \vartheta_j - c = 0, and every equality constraint of \mathsf{M}_0 that has no equivalent in \mathsf{M}_1 is copied in. The resulting function is then differentiated to give \mathbf{R}_D (in the current implementation via complex-step differentiation, which is exact to machine precision, with a finite-difference fallback). This is exact for nonlinearly related parameterizations, but requires that the parameters of the two models can be matched one-to-one, which the delta method does not need.

For the typical case (\mathsf{M}_0 obtained from \mathsf{M}_1 by fixing or equating parameters), both methods give the same \mathbf{R}_D (up to a change of basis, which leaves the traces invariant), and the default "delta" is both fast and robust.

11.2.8 Which method is used by default?

With method = "default", lavTestLRT() chooses the scaling method based on how the models were fitted. Table 11.2 summarizes the mapping.

Table 11.2: Default method= choice in lavTestLRT(), per test used at fitting time.
Models fitted with Default difference test
test = "standard" standard chi-square difference test
test = "satorra.bentler", "yuan.bentler", "yuan.bentler.mplus" method = "satorra.bentler.2001"
test = "mean.var.adjusted", "scaled.shifted" (and ".corrected" variants) method = "satorra.2000"
estimator = "PML" method = "mean.var.adjusted.PLRT" (pairwise likelihood ratio test; see Section 7.5)

A few consistency rules apply. If none of the models carries a robust test statistic but a robust method= is requested, the request is ignored with a warning and the standard difference test is computed. If some but not all models carry a robust test statistic, an error is thrown. And method = "satorra.bentler.2001" or "...2010" is only allowed when the models were fitted with a Satorra–Bentler or Yuan–Bentler style test (otherwise the stored scaling factors would not match Equation 11.5).

When the fitted objects contain multiple test statistics (e.g., test = c("satorra.bentler", "scaled.shifted"); see Section 8.5), the test= argument of lavTestLRT() selects which one supplies the scaling factors:

lavTestLRT(fit0m, fit1m, test = "satorra.bentler")

The requested test must be present in all models being compared; otherwise an error lists the models in which it is missing.

11.2.9 Difference tests based on other statistics: the type= argument

By default (type = "Chisq"), the difference test is based on the (unscaled) chi-square statistics, possibly with a robust correction as described above. Alternatively, the difference test can be based on Browne’s residual-based statistics (Section 8.5.10), which are asymptotically chi-square distributed under weaker distributional assumptions and therefore need no scaling correction:

  • type = "browne.residual.adf" (alias "browne"): the difference of the two residual-based ADF statistics (Browne, 1984);
  • type = "browne.residual.nt": the difference of the two residual-based normal-theory statistics;
  • type = "browne.residual.adf.model" and type = "browne.residual.nt.model": the model-based counterparts, which remain available when the data are incomplete (missing = "ml").

The per-model statistics are recomputed as needed via lavTest() (Section 8.5.13), so the models need not have been fitted with these tests. The method= argument must be left at its default (or "standard") in this case:

lavTestLRT(fit0m, fit1m, type = "browne.residual.adf")
Chi-Squared Difference Test based on Browne's residual (ADF) Test

      Df    AIC    BIC  Chisq Chisq diff   RMSEA Df diff Pr(>Chisq)   
fit1m 24 7517.5 7595.3 82.408                                         
fit0m 25 7518.2 7592.3 92.266     9.8577 0.17155       1   0.001691 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Note that the residual-based difference test can deviate noticeably from the (scaled) likelihood-based difference tests in finite samples; here it is considerably larger. Finally, type = "cf" compares models via the C_F statistic of Jöreskog and Moustaki (2001) for categorical data (computed by lavTablesFitCf()); this option is rarely used.

The FMG penalized-eigenvalue tests of Section 8.5.11 form a related special case: when the test= argument of lavTestLRT() names an FMG test (or the models were fitted with one), the function computes an FMG version of the difference test directly from the eigenvalues of the difference-restricted \mathbf{U}_D\boldsymbol{\Gamma} matrix; only method = "default", "standard", or "satorra.2000" are then accepted, and (as for the scaled tests) the reported per-model Chisq column contains the standard (or RLS) source statistics, not the FMG statistics themselves.

For completeness: when all models were fitted with sam() using a local sam_method (chapter 18), lavTestLRT() compares the stored structural (step 2) fits, conditional on identical step 1 measurement models, and prints a note to that effect. And when the first object contains a user-supplied alternative \mathsf{H}_1 model, stored under the name h1.model in the object’s external list (a hook used by, e.g., the semTools package), that model is silently added to the comparison list.

11.2.10 An application: measurement invariance across groups

The most common use of a sequence of nested models in applied SEM is multiple-group measurement-invariance testing: before latent variables can be compared across groups (the mean visual ability of the two schools, for example), the measurement model that defines them must be the same in every group. The classical taxonomy (Meredith, 1993) is a sequence of increasingly restricted models, each obtained from the previous one by equating one block of measurement parameters across groups:

  1. Configural invariance: the same factor structure (pattern of free and fixed loadings) in every group, all parameters free;
  2. Metric (or weak) invariance: factor loadings equal across groups, required before latent (co)variances and regressions can be meaningfully compared;
  3. Scalar (or strong) invariance: loadings and intercepts equal, required before latent means can be compared;
  4. Strict invariance: additionally, equal residual variances.

Each step is a restricted version of the one before, so the sequence is exactly the input that lavTestLRT() expects. No special function is needed on the fitting side either: the group_equal= option imposes the equality constraints per block ("loadings", "intercepts", "residuals", "means", "lv.variances", …, see ?lavOptions), and lavaan makes the accompanying identification adjustments automatically. For example, when intercepts are equated, the latent means in the second and later groups are freed, and with std_lv = TRUE, equating the loadings frees the latent variances in the later groups (otherwise the “metric” model would silently constrain the latent scale as well). For the Holzinger–Swineford data, with school as the grouping variable:

HS_model <- '
  visual  =~ x1 + x2 + x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
'
fit_config <- cfa(HS_model, data = HolzingerSwineford1939,
                  group = "school")
fit_metric <- cfa(HS_model, data = HolzingerSwineford1939,
                  group = "school", group_equal = "loadings")
fit_scalar <- cfa(HS_model, data = HolzingerSwineford1939,
                  group = "school",
                  group_equal = c("loadings", "intercepts"))
lavTestLRT(fit_config, fit_metric, fit_scalar)
Chi-Squared Difference Test

           Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)    
fit_config 48 7484.4 7706.8 115.85                                           
fit_metric 54 7480.6 7680.8 124.04      8.192 0.049272       6     0.2244    
fit_scalar 60 7508.6 7686.6 164.10     40.059 0.194211       6  4.435e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Metric invariance is retained (\Delta\chi^2 = 8.19, \Delta df = 6, p = 0.22), but scalar invariance is clearly rejected. The next question is then which intercepts are responsible. This can be answered with the score test of Section 11.4: fitting the scalar model and inspecting the univariate score tests for its equality constraints (Section 11.4.2) singles out the intercepts of x3 and x7 as the noninvariant ones (each with X^2 > 15; all others are below 7). Releasing only those two constraints with group_partial= yields a partial scalar invariance model (Byrne et al., 1989):

fit_scalar2 <- cfa(HS_model, data = HolzingerSwineford1939,
                   group = "school",
                   group_equal = c("loadings", "intercepts"),
                   group_partial = c("x3 ~ 1", "x7 ~ 1"))
lavTestLRT(fit_metric, fit_scalar2)
Chi-Squared Difference Test

            Df    AIC    BIC  Chisq Chisq diff   RMSEA Df diff Pr(>Chisq)
fit_metric  54 7480.6 7680.8 124.04                                      
fit_scalar2 58 7478.0 7663.3 129.42     5.3789 0.04786       4     0.2506

which is no longer rejected (p = 0.25), so that latent means can be compared, with the caveat that the comparison now relies on the seven intercepts that are invariant.

Three remarks conclude this section. First, the invariance sequence can be combined with the other methods of this chapter: if the models are fitted with a robust estimator (MLR, MLM), lavTestLRT() automatically applies the scaled difference tests of Section 11.2.4 to every step of the sequence. Second, in large samples the chi-square difference test detects even trivially small violations, so the size of a violation needs a measure of its own. The RMSEA column of the lavTestLRT() table, the \text{RMSEA}_D of Section 11.2.1, serves this purpose: it puts the misfit introduced by each step on the familiar RMSEA scale, and Savalei et al. (2024) argue that it should replace the older practice of comparing fit measures across models (the difference in RMSEA, or \Delta\text{CFI} (Cheung & Rensvold, 2002)), which often masks misfit when the models have many degrees of freedom. Like those older measures, \text{RMSEA}_D is a descriptive tool, not a test. Third, this sequence is for continuous indicators. For ordered categorical indicators the situation is different: the thresholds, intercepts, and latent-response scales cannot be separated, an “equal loadings” step on its own imposes no testable restriction, and the appropriate sequence is the Wu–Estabrook scheme discussed in Section 14.6.2.4

11.3 The Wald test: lavTestWald()

11.3.1 The test statistic

The Wald test asks whether the restrictions hold at the unrestricted estimates: if H_0: \mathbf{r}(\boldsymbol{\vartheta}) = \mathbf{0} is true, then \mathbf{r}(\hat{\boldsymbol{\vartheta}}) should be close to zero. Since \sqrt{N}(\hat{\boldsymbol{\vartheta}}- \boldsymbol{\vartheta}_0) is asymptotically normal with covariance matrix \boldsymbol{\Omega} (Section 8.4.1), the delta method gives

\sqrt{N}\, \mathbf{r}(\hat{\boldsymbol{\vartheta}}) \;\xrightarrow{d}\; \mathcal{N}\bigl(\mathbf{0},\; \mathbf{R}(\boldsymbol{\vartheta}_0)\,\boldsymbol{\Omega}\,\mathbf{R}(\boldsymbol{\vartheta}_0)^{\prime}\bigr), \tag{11.9}

so that the quadratic form

W = \mathbf{r}(\hat{\boldsymbol{\vartheta}})^{\prime} \bigl[\hat{\mathbf{R}}\, \widehat{\mathrm{Var}}(\hat{\boldsymbol{\vartheta}})\, \hat{\mathbf{R}}^{\prime}\bigr]^{-1} \mathbf{r}(\hat{\boldsymbol{\vartheta}}) \;\xrightarrow{d}\; \chi^2(K), \tag{11.10}

where \hat{\mathbf{R}} = \mathbf{R}(\hat{\boldsymbol{\vartheta}}) and \widehat{\mathrm{Var}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Omega}}/N is the estimated covariance matrix of the estimates, as returned by vcov() (Section 9.5). Note that only the unrestricted model appears in Equation 11.10: the restricted model is never fitted. Whatever se= option was used when fitting the model determines \widehat{\mathrm{Var}}(\hat{\boldsymbol{\vartheta}}), and hence the type of the Wald test; with a sandwich-type se= (Section 8.4.4), Equation 11.10 is already the generalized (robust) Wald test of Satorra (2000).

11.3.2 The constraints= argument

In lavTestWald(), the restrictions are specified in lavaan model syntax, using the parameter labels (user-defined or automatic) of the fitted model. For the running example:

lavTestWald(fit1, constraints = "b2 == b3")
$stat
[1] 2.376327

$df
[1] 1

$p.value
[1] 0.1231869

$se
[1] "standard"

The Wald statistic is 2.376 on one degree of freedom (p = 0.123): the same substantive conclusion as the likelihood ratio test, but a slightly smaller statistic; we return to this in Section 11.5.

Multiple restrictions can be supplied in a single string, separated by semicolons or newlines, and they may be nonlinear functions of the parameters:

lavTestWald(fit1, constraints = 'b2 == b3
                                 b2^2 == 0.5')

The resulting test is a joint (multivariate) test of all restrictions simultaneously, with K equal to the number of (non-redundant) restrictions. The verbose = TRUE argument prints the restriction Jacobian \hat{\mathbf{R}} and the values \mathbf{r}(\hat{\boldsymbol{\vartheta}}) before the statistic is computed.

As a multivariate illustration with structural parameters, consider the classic Political Democracy model (without the residual covariances, for brevity), and test jointly whether industrialization has no direct effect on democracy in 1965, and whether democracy is perfectly stable between 1960 and 1965 (a unit autoregressive effect):

model_pd <- '
  ind60 =~ x1 + x2 + x3
  dem60 =~ y1 + y2 + y3 + y4
  dem65 =~ y5 + y6 + y7 + y8
  dem60 ~ a*ind60
  dem65 ~ b*ind60 + c*dem60
'
fit_pd <- sem(model_pd, data = PoliticalDemocracy)
lavTestWald(fit_pd, constraints = 'b == 0; c == 1')
$stat
[1] 4.872545

$df
[1] 2

$p.value
[1] 0.08748637

$se
[1] "standard"

The joint hypothesis is not rejected at the 5\% level (W = 4.873, \mathrm{df} = 2, p = 0.087). This result was obtained without fitting the restricted model.

Internally, the constraints string is parsed by lavParseModelString(), and a restriction function is built by the same code that builds the equality constraint function \mathbf{c}_{\text{eq}} of Section 7.7.2, with the parameter labels resolved against the parameter table of the fitted object. The Jacobian is obtained by differentiating that restriction function (in the current implementation via complex-step differentiation, which is exact to machine precision, with a finite-difference fallback), and reduced row-echelon form is used to detect linearly redundant restrictions: if the Jacobian is rank deficient, the redundant rows are dropped with a warning and the degrees of freedom are reduced accordingly. The statistic Equation 11.10 is then assembled from the object’s vcov() matrix (when simple equality constraints were absorbed into a reduced parameter vector, the matrix is first mapped to the same space as the Jacobian).

11.3.3 Relation to the z statistics

For a single restriction that fixes one free parameter to a constant, the Wald statistic reduces to the square of the familiar z statistic in the summary() and parameterEstimates() output:

pe <- parameterEstimates(fit1)
z_b2 <- pe$z[pe$label == "b2"]
c(z2 = z_b2^2, W = lavTestWald(fit1, constraints = "b2 == 0")$stat)
      z2        W 
30.84248 30.84248 

Every z column in the parameter table is thus a set of univariate Wald tests, and lavTestWald() is their multivariate generalization. The same holds for user-defined (:=) parameters: their z statistics are delta-method-based Wald tests of the defined quantity against zero (Section 8.4.14).

One caveat deserves emphasis: unlike the likelihood ratio test, the Wald test is not invariant to reparameterization of the restrictions. Algebraically equivalent null hypotheses (say, b_2 - b_3 = 0 versus b_2/b_3 = 1) yield different Wald statistics in finite samples, because the Jacobian in Equation 11.10 linearizes different functions. The likelihood ratio test, which only compares fitted models, does not have this problem. When the restriction can be written in several equally natural ways and the sample is not large, the LR test is the safer choice.

11.3.4 Robust Wald tests

As noted above, when the model was fitted with sandwich-type standard errors, the main statistic returned by lavTestWald() is automatically the generalized (robust) Wald test, because it inherits the robust vcov(). In addition, lavTestWald() reports the family of Satorra (2000) variants whenever the fitted object provides the ingredients for a sandwich covariance matrix (that is, when robust standard errors or a scaled test statistic were requested):

fit1m <- cfa(model_h1, data = HolzingerSwineford1939, estimator = "MLM")
lavTestWald(fit1m, constraints = "b2 == b3")
$stat
[1] 3.180758

$df
[1] 1

$p.value
[1] 0.07451016

$se
[1] "robust.sem"

$stat.standard
[1] 2.376327

$stat.scaled
[1] 3.180758

$p.value.scaled
[1] 0.07451016

$scaling.factor
[1] 0.7470946

$stat.adjusted
[1] 3.180758

$df.adjusted
[1] 1

$p.value.adjusted
[1] 0.07451016

$stat.robust
[1] 3.180758

$p.value.robust
[1] 0.07451016

The output now contains, next to the main (robust) statistic: stat.standard, the normal-theory Wald statistic computed from the non-robust vcov(); stat.scaled and scaling.factor, a mean-scaled version of the normal-theory statistic; stat.adjusted and df.adjusted, a mean-and-variance adjusted version with fractional degrees of freedom; and stat.robust, the generalized statistic. The computations are shared with the score test (Section 11.6); the formulas are given in Section 11.4.5 below. For a single restriction (K= 1), the scaled, adjusted, and robust versions all coincide, as in this example. These variants are not available for rotated (EFA/ESEM) solutions, whose stored vcov() is post-processed by the rotation procedure.

11.4 The score test: lavTestScore()

11.4.1 The test statistic

The score test approaches the problem from the restricted side. Let \bar{\mathbf{g}}(\boldsymbol{\vartheta}) = N^{-1} \sum_{i} \partial l_i(\boldsymbol{\vartheta})/\partial \boldsymbol{\vartheta} denote the average casewise score vector (the gradient of the average log-likelihood). At the unrestricted optimum, \bar{\mathbf{g}}(\hat{\boldsymbol{\vartheta}}) = \mathbf{0} by construction; at the restricted estimate \tilde{\boldsymbol{\vartheta}}, the gradient is zero only in the directions the restricted model was allowed to move; the components of \bar{\mathbf{g}}(\tilde{\boldsymbol{\vartheta}}) along the forbidden directions measure how much the restrictions bind. If H_0 holds, these components are small; the score (Lagrange multiplier) test statistic

S = N\; \bar{\mathbf{g}}(\tilde{\boldsymbol{\vartheta}})^{\prime}\, \mathbf{A}(\tilde{\boldsymbol{\vartheta}})^{-}\, \bar{\mathbf{g}}(\tilde{\boldsymbol{\vartheta}}) \;\xrightarrow{d}\; \chi^2(K) \tag{11.11}

quantifies this, where \mathbf{A}(\tilde{\boldsymbol{\vartheta}})^{-} is a constrained inverse of the (unit) information matrix \mathbf{A}(\tilde{\boldsymbol{\vartheta}}), in the sense of Section 8.2.5 (see below). Equivalently, the statistic can be motivated via the Lagrange multipliers of the constrained optimization problem, whence its alternative name (Buse, 1982; Sörbom, 1989). Only the restricted model is needed; the unrestricted model is never fitted.

Two computational details are described here, because they determine what the implementation computes:

  • The constrained inverse: the covariance matrix of the estimates, vcov(object), cannot be used in Equation 11.11: it already reflects the constraints under test, and would assign zero variance to the forbidden directions. Instead, the information matrix is inverted subject to only those constraints that are kept (not released): the constrained inverse of Section 8.2.5, with the kept constraints in the role of the active set. With \mathbf{R}_1 the Jacobian of the kept constraints, the constrained inverse is computed via the null-space identity

    \mathbf{A}^{-} = \mathbf{Z} \bigl(\mathbf{Z}^{\prime}\mathbf{A}\,\mathbf{Z}\bigr)^{-1} \mathbf{Z}^{\prime}, \tag{11.12}

    where \mathbf{Z} is an orthonormal basis for the null space of \mathbf{R}_1. This equals the upper-left block of the Moore–Penrose inverse of the bordered information matrix \bigl(\begin{smallmatrix}\mathbf{A} & \mathbf{R}_1^{\prime}\\ \mathbf{R}_1 & \mathbf{0}\end{smallmatrix}\bigr), but requires only a solve of order T- \mathrm{rank}(\mathbf{R}_1); the bordered Moore–Penrose route is kept as a fallback for under-identified special cases. When all constraints are released, \mathbf{A}^{-} is the (pseudo) inverse of the information matrix.

  • Parameter space and scale: the score \bar{\mathbf{g}}(\tilde{\boldsymbol{\vartheta}}) is obtained as lavTech(object, "gradient_logl") and the information matrix as lavTech(object, "information_expected") (by default); both are defined in the “unconstrained” parameter space in which equality-constrained parameters are still counted separately, and both are on the unit (per-observation) scale, so that the factor N in Equation 11.11 restores the proper order. (With mimic = "EQS", N- 1 is used.) For multilevel models, the effective n is the total number of clusters and the score is halved to match the -2\log L convention; for PML, the summed pairwise gradient is first rescaled to the unit scale and the expected information is replaced by the observed one.

The information= argument (default "expected") can be set to "observed" or "first.order" to use the other information matrix estimates of Section 8.2.

We can reproduce the statistic by hand for the running example, where the restricted model fit0 contains the single equality constraint:

g <- lavTech(fit0, "gradient_logl")            # unit-scale gradient
A <- lavTech(fit0, "information_expected")     # unit information
as.numeric(nobs(fit0) * t(g) %*% MASS::ginv(A) %*% g)
[1] 2.862175

which matches the output of lavTestScore() below.

11.4.2 Releasing equality constraints: the release= argument

In its default mode, lavTestScore() tests the equality constraints that are present in the fitted (restricted) model. Called with no further arguments, it computes the joint (multivariate) score test for releasing all equality constraints:

lavTestScore(fit0)
$test

total score test:

   test    X2 df p.value
1 score 2.862  1   0.091

$uni

univariate score tests:

   lhs op  rhs    X2 df p.value
1 .p2. == .p3. 2.862  1   0.091

The total score test (2.862, p = 0.091) again agrees qualitatively with the LR and Wald tests. Because the model contains only one constraint, the univariate test (printed below the total test) is identical here.

The release= argument takes a vector of integers indexing the constraints to be released, in the order in which the == rows appear in the parameter table (parTable(object)); the remaining constraints are kept, and enter the constrained inverse Equation 11.12. A more informative illustration uses a multiple-group model with metric invariance constraints (cf. Section 11.2.10), the setting for which Satorra (2000) developed the multi-sample theory. We fit the (unlabeled) Holzinger–Swineford model in the two schools, with all loadings constrained equal across groups:

HS_model <- '
  visual  =~ x1 + x2 + x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
'
fit_metric <- cfa(HS_model, data = HolzingerSwineford1939,
                  group = "school", group_equal = "loadings")

The group_equal = "loadings" option equates the six free loadings across the two groups (the three marker loadings are fixed to one in both groups in any case), producing six equality constraints. The joint test for releasing all six, plus the per-constraint univariate tests:

out <- lavTestScore(fit_metric, cumulative = TRUE)
out$test
total score test:

   test    X2 df p.value
1 score 7.256  6   0.298
out$uni
univariate score tests:

   lhs op   rhs    X2 df p.value
1 .p2. == .p38. 0.668  1   0.414
2 .p3. == .p39. 0.516  1   0.473
3 .p5. == .p41. 4.649  1   0.031
4 .p6. == .p42. 2.712  1   0.100
5 .p8. == .p44. 0.016  1   0.898
6 .p9. == .p45. 0.059  1   0.808

The lhs and rhs columns show the plabels (.p2., .p38., …) of the two parameters involved in each constraint; these can be looked up in parTable(fit_metric). The univariate tests play the role of modification indices for equality constraints (cf. Section 10.11.4): each is a 1-df score test for releasing that single constraint while keeping all others. To release only, say, the third and fourth constraints jointly:

lavTestScore(fit_metric, release = 3:4, univariate = FALSE)$test
total score test:

   test    X2 df p.value
1 score 5.106  2   0.078

With cumulative = TRUE, an additional table is returned in which the constraints are released one by one, in decreasing order of their univariate statistics, each row testing the joint release of all constraints so far:

out$cumulative
cumulative score tests:

   lhs op   rhs    X2 df p.value
3 .p5. == .p41. 4.649  1   0.031
4 .p6. == .p42. 5.106  2   0.078
1 .p2. == .p38. 5.774  3   0.123
2 .p3. == .p39. 7.107  4   0.130
6 .p9. == .p45. 7.166  5   0.209
5 .p8. == .p44. 7.256  6   0.298

This forward-selection view is convenient when searching for partial invariance: the cumulative statistics show how much of the total misfit is absorbed by releasing the first, the first two, … constraints.

When the equality constraints of the model are simple equality constraints that have been absorbed into a reduced parameter vector (the ceq_simple mechanism of Section 7.7.7), the model object carries no explicit constraint Jacobian. In that case, lavTestScore() reconstructs one when needed: one +1/-1 row per absorbed equality, in the unconstrained parameter space, so that absorbed constraints can be released individually, in the same way as explicit == constraints. Inequality constraints are not supported: if the model contains < or > constraints, lavTestScore() stops with an error. (A simple bound such as b > 0 is stored as a bound on the parameter rather than as a constraint row, and does not trigger this.)

11.4.3 Testing fixed parameters: the add= argument

The second mode of lavTestScore() tests parameters that are not in the model at all, that is, parameters fixed to zero (or another constant). The add= argument takes lavaan model syntax describing the parameters to be tested:

fit <- cfa(HS_model, data = HolzingerSwineford1939)  # no constraints
lavTestScore(fit, add = "visual =~ x9")
$test

total score test:

   test     X2 df p.value
1 score 36.411  1       0

$uni

univariate score tests:

         lhs op rhs     X2 df p.value
1 visual=~x9 ==   0 36.411  1       0

Internally, the model is extended (the same device used by modindices(); see Section 10.11.3): the added parameters are freed but held at their fixed values, the gradient and information matrix of the extended model are computed at the current solution, and the restriction matrix \mathbf{R} is an identity block selecting the added parameters. Any equality constraints already in the model are kept and enter the constrained inverse. No re-estimation takes place. The univariate statistic for a single added parameter is identical to its modification index:

mi <- modindices(fit)
mi[mi$lhs == "visual" & mi$rhs == "x9", c("lhs", "op", "rhs", "mi", "epc")]
      lhs op rhs     mi   epc
30 visual =~  x9 36.411 0.577

The added value of lavTestScore() over modindices() is (a) the joint test when several parameters are added at once, and (b) the release= mode for equality constraints, which modindices() cannot handle. The add= and release= arguments cannot be combined in one call.

11.4.4 Expected parameter changes: the epc= argument

With epc = TRUE, lavTestScore() also reports how the parameter estimates would change if the tested constraints were released. The expected changes are one-step Newton updates from the restricted solution,

\widehat{\Delta\boldsymbol{\vartheta}} = \mathbf{A}(\tilde{\boldsymbol{\vartheta}})^{-}\,\bar{\mathbf{g}}(\tilde{\boldsymbol{\vartheta}}), \tag{11.13}

with \mathbf{A}^{-} the constrained inverse in which only the kept constraints remain. This is the multivariate analog of the EPC formula Equation 10.51 used by modindices(), with the same sign convention (“new minus old”). Unlike modindices(), which reports the change for the single freed parameter only, lavTestScore() returns the expected change for every free parameter in the model, since releasing a constraint generally moves all estimates:

out <- lavTestScore(fit0, epc = TRUE)
out$epc[1:6, ]
expected parameter changes (epc) and expected parameter values (epv):

      lhs op rhs free label plabel   est    epc   epv sepc.lv sepc.all sepc.nox
1  visual =~  x1    0         .p1. 1.000     NA    NA      NA       NA       NA
2  visual =~  x2    1     b   .p2. 0.649 -0.103 0.545  -0.093   -0.077   -0.077
3  visual =~  x3    2     b   .p3. 0.649  0.086 0.735   0.078    0.070    0.070
4 textual =~  x4    0         .p4. 1.000     NA    NA      NA       NA       NA
5 textual =~  x5    3         .p5. 1.113  0.000 1.113   0.000    0.000    0.000
6 textual =~  x6    4         .p6. 0.926  0.000 0.926   0.000    0.000    0.000

The epc column contains the expected changes; the epv column adds them to the current estimates, giving the expected parameter values after release. For the constrained loading, the two rows show how the common value 0.649 would split: down to about 0.545 for x2 and up to 0.735 for x3, close to the actually estimated values in fit1 (0.554 and 0.729). When standardized = TRUE (the default whenever epc = TRUE), standardized counterparts sepc.lv, sepc.all, and sepc.nox are appended, computed with the same standardization procedure as for estimated parameters (Section 12.1); the cov_std= argument has the same meaning as in modindices() (Section 10.11.3). In add= mode, the univariate table also gains an epc column for the added parameters, matching the epc column of modindices().

11.4.5 Robust score tests

The statistic Equation 11.11 is derived under the assumption that the information matrix equality holds (for ML, under multivariate normality). When the data are nonnormal (or the estimator’s implicit weight matrix is otherwise misspecified), the same problem arises as for the overall chi-square statistic in Section 8.5.3, and Satorra (2000) provides the remedy. lavTestScore() computes these robust versions automatically whenever the fitted object provides the ingredients for a sandwich covariance matrix, that is, whenever robust standard errors or a scaled test statistic were requested at fitting time.

Let \mathbf{R} collect the Jacobian rows of the released constraints, \mathbf{A}^{-} the constrained inverse Equation 11.12, and \mathbf{B} the “meat” of the sandwich (Section 8.4.4), all in the same parameter space. Define the K\times K matrices

\mathbf{M}_1 = \mathbf{R}\,\mathbf{A}^{-}\,\mathbf{R}^{\prime}, \qquad \mathbf{M}_2 = \mathbf{R}\,\mathbf{A}^{-}\,\mathbf{B}\, \mathbf{A}^{-}\,\mathbf{R}^{\prime}. \tag{11.14}

The traces of \mathbf{U}\boldsymbol{\Gamma} needed for the corrections follow from \mathrm{tr}[\mathbf{U}\boldsymbol{\Gamma}] = \mathrm{tr}[\mathbf{M}_2\mathbf{M}_1^{-1}] (and analogously for the squared product), and three robust statistics are reported next to the standard one (Satorra, 2000, sec. 17.3):

  • score.scaled: the mean-scaled statistic S / c with c = \mathrm{tr}[\mathbf{M}_2 \mathbf{M}_1^{-1}]/K, referred to \chi^2(K);
  • score.adjusted: the mean-and-variance adjusted statistic with fractional degrees of freedom K^{\star} = \mathrm{tr}[\mathbf{M}_2\mathbf{M}_1^{-1}]^2 / \mathrm{tr}[(\mathbf{M}_2\mathbf{M}_1^{-1})^2];
  • score.robust: the generalized (asymptotically distribution-free) statistic N\,\mathbf{q}^{\prime}\mathbf{M}_2^{-1}\mathbf{q} with \mathbf{q} = \mathbf{R}\mathbf{A}^{-}\bar{\mathbf{g}}(\tilde{\boldsymbol{\vartheta}}), which is asymptotically exactly \chi^2(K) without any scaling.

For the running example fitted with MLM:

fit0m <- cfa(model_h0, data = HolzingerSwineford1939, estimator = "MLM")
lavTestScore(fit0m)
$test

total score test:

            test    X2 df p.value
1          score 2.862  1   0.091
2   score.scaled 3.896  1   0.048
3 score.adjusted 3.896  1   0.048
4   score.robust 3.896  1   0.048

$uni

univariate score tests:

   lhs op  rhs    X2 df p.value X2.scaled p.value.scaled
1 .p2. == .p3. 2.862  1   0.091     3.896          0.048

For a single released restriction, the three robust versions coincide, as they do here; with K> 1 they differ, exactly as the corresponding overall test statistics do. The univariate (and cumulative) tables gain X2.scaled and p.value.scaled columns. For an added parameter (add=), the univariate X2.scaled value is what modindices() reports in its mi.scaled column (Section 10.11.3).

lavaan first determines which type of sandwich estimator is available: if the object’s se= is already sandwich-based, that type is reused; otherwise, if a scaled test was requested, the \hat{\boldsymbol{\Gamma}}-based meat ("robust.sem") is used when the \boldsymbol{\Gamma} matrix is stored, or the casewise-score meat ("robust.huber.white") when raw data are available for an ML or PML fit. For the casewise meat, the information_meat= and h1_information_meat= overrides of Section 8.4.4 are honored; the \hat{\boldsymbol{\Gamma}}-based meat uses the stored \boldsymbol{\Gamma} as is. The selection of the type is shared with the robust Wald tests of Section 11.3.4. There, the sandwich and the normal-theory covariance matrices are obtained from the regular vcov() machinery with se= set to the selected type, \mathbf{M}_1 and \mathbf{M}_2 are built from these two matrices, and the generalized statistic uses \mathbf{q} = \mathbf{r}(\hat{\boldsymbol{\vartheta}}).

11.5 The three tests side by side

We now collect the results of the three tests for the running restriction b_2 = b_3 in the Holzinger–Swineford model. First under plain ML:

lrt   <- lavTestLRT(fit0, fit1)
wald  <- lavTestWald(fit1, constraints = "b2 == b3")
score <- lavTestScore(fit0)
tab <- data.frame(
  test = c("likelihood ratio", "Wald", "score"),
  X2   = c(lrt[2, "Chisq diff"], wald$stat, score$test$X2),
  df   = 1,
  p    = c(lrt[2, "Pr(>Chisq)"], wald$p.value, score$test$p.value)
)
tab$X2 <- round(tab$X2, 3); tab$p <- round(tab$p, 3)
tab
              test    X2 df     p
1 likelihood ratio 2.665  1 0.103
2             Wald 2.376  1 0.123
3            score 2.862  1 0.091

Next, the robust versions under MLM (the Satorra–Bentler 2001 scaled difference test, the robust Wald test, and the scaled score test):

lrt_m   <- lavTestLRT(fit0m, fit1m)
wald_m  <- lavTestWald(fit1m, constraints = "b2 == b3")
score_m <- lavTestScore(fit0m)
tab_m <- data.frame(
  test = c("scaled difference (SB2001)", "robust Wald", "scaled score"),
  X2   = c(lrt_m[2, "Chisq diff"], wald_m$stat, score_m$test$X2[2]),
  df   = 1,
  p    = c(lrt_m[2, "Pr(>Chisq)"], wald_m$p.value,
           score_m$test$p.value[2])
)
tab_m$X2 <- round(tab_m$X2, 3); tab_m$p <- round(tab_m$p, 3)
tab_m
                        test    X2 df     p
1 scaled difference (SB2001) 3.876  1 0.049
2                robust Wald 3.181  1 0.075
3               scaled score 3.896  1 0.048

All six statistics test the same hypothesis against the same \chi^2(1) reference distribution, and all six would coincide in an infinitely large sample from a population where H_0 holds. In this sample of N = 301, however, they range from 2.38 to 3.90, and the corresponding p-values fall on both sides of the conventional 5\% threshold: the plain tests do not reject, while the scaled difference and scaled score tests do, by a small margin. The example is a reminder that the choice among asymptotically equivalent tests is not innocuous in finite samples, and that p-values close to a threshold should not be over-interpreted.

In the classical normal linear regression model, the three statistics obey the finite-sample inequality W \geq X^2_D \geq S (Berndt & Savin, 1977). The ordering observed here is exactly the reverse (Wald < LR < score), which shows that no such systematic inequality holds for general moment structures, where the relative magnitudes depend on the model, the restriction, and the data. Whatever the ordering, the differences vanish at rate 1/N.

We end with some practical guidance:

  • When both models can be fitted without difficulty, the likelihood ratio test is the default choice: it is invariant to reparameterization, tends to have the most reliable finite-sample behavior of the three, and its scaled versions (Section 11.2.4) are well studied. Its only cost is the second model fit.

  • The Wald test is the convenient choice when the unrestricted model is already fitted: it underlies the z statistics, tests of defined parameters, and quick joint tests of several restrictions via lavTestWald(). Be aware of its lack of invariance (Section 11.3.3) and its reliance on the quality of \widehat{\mathrm{Var}}(\hat{\boldsymbol{\vartheta}}), especially near boundaries of the parameter space.

  • The score test is the natural instrument of model modification: it evaluates candidate extensions of a fitted model without refitting, as modification indices for fixed parameters (Section 10.11) and via lavTestScore() for equality constraints and joint extensions. It is also attractive when the unrestricted model is hard to estimate (e.g., poorly identified once the constraints are dropped). Its EPCs (Section 11.4.4) indicate whether a statistically significant constraint violation is also substantively meaningful, and the power-based decision framework of Section 10.11.5 extends to this setting as well (Saris et al., 1987; Satorra & Saris, 1985).

One caution applies to all three: when tests are used sequentially (releasing one constraint, refitting, testing the next), the nominal Type I error control applies to each step in isolation, not to the final model. The remarks on data-driven respecification at the end of Section 10.11 apply with equal force here.

11.6 Implementation notes

This section collects details that are tied to the current implementation of lavaan (the R package, version 0.7-4) rather than to the concepts of the main text. Internal file and function names may change or move at any release, while everything reachable through the user interface stays put. Table 11.3 maps the three test functions to their source files.

Table 11.3: Source files behind the model comparison tests.
Topic File(s)
lavTestLRT(); single-model case (lav_test_lrt_single_model()); FMG difference tests (lav_test_lrt_fmg()) lav_test_LRT.R
scaled difference tests: lav_test_diff_sb2001(), lav_test_diff_sb2010() with the \mathsf{M}_{1|0} model built by lav_test_diff_m10() lav_test_diff.R
Satorra (2000) approach: reconstruction of the restriction matrix in lav_test_diff_a() (a_method = "delta", using lav_con_eq_basis() for existing equality constraints) and lav_test_diff_af_h1() (a_method = "exact") lav_constraints.R
lav_test_diff.R
lavTestWald(): the restriction function is built by lav_pt_con_ceq() lav_partable_constraints.R
lav_test_Wald.R
lavTestScore(): constrained inverse (lav_test_score_iinv()), reconstructed Jacobian under ceq_simple (lav_test_score_ceq_simple()), extended model for add= (lav_object_extended()) lav_object_generate.R
lav_test_score.R
robust score and Wald tests: selection of the sandwich type (lav_test_robust_se_flavor()), the score-test meat matrix (lav_test_meat()), and the scaled, adjusted and generalized statistics (lav_test_satorra2000()) lav_test_satorra2000.R

  1. For models that are not nested, information criteria (AIC, BIC) or dedicated non-nested model comparison tests should be used instead; the nonnest2 package implements Vuong-type tests for lavaan objects.↩︎

  2. In versions before 0.6-13, the second trace was also computed group by group, which is incorrect when parameters are constrained across groups; the bug was reported by Grønneberg, Foldnes and Moss and fixed in 0.6-13 by pooling \mathbf{B} over groups first.↩︎

  3. When the models were fitted with the Hayakawa-corrected variants ("mean.var.adjusted.corrected" or "scaled.shifted.corrected", Section 8.5.8), the difference test still uses the standard trace estimates, and a warning says so.↩︎

  4. For complex settings (many groups, mixed continuous/ordered indicators, longitudinal invariance), the measEq.syntax() function in the semTools package generates the lavaan syntax for any level of the sequence automatically.↩︎