8  Standard errors and test statistics

8.1 From point estimates to inference

After discussing point estimation in the previous chapter, we now turn to statistical inference for structural equation models. In practice, parameter estimates are only one part of the analysis: researchers also need measures of precision and tools for evaluating overall model fit. These tasks are closely connected: standard errors, confidence intervals, Wald tests, likelihood ratio tests, score tests, and many robust corrections all rely on a common set of ingredients, including first- and second-order derivatives of the fitting function, information matrices, and the asymptotic covariance matrix of the sample statistics (\boldsymbol{\Gamma}). For this reason, it is natural to treat standard errors and test statistics together.

This chapter is not intended as a comprehensive review of the literature on statistical inference in structural equation modeling. Instead, its goal is to provide an overview of the standard errors and test statistics implemented in lavaan, with particular emphasis on the role of the various information matrices, sandwich-type estimators, the distinction between standard and robust inference procedures, and the many computational choices involved. For a more extensive treatment, the reader is referred to Savalei and Rosseel (2022), which offers a systematic discussion of these choices for maximum likelihood estimation under normal and nonnormal data conditions, with both complete and incomplete data.

The running example throughout is the Holzinger–Swineford three-factor model:

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

8.1.1 Notation

The derivations in this chapter are compact, and they rely on notation that was introduced gradually in chapters 4, 5 and 7. Table 8.1 collects the symbols that recur from Section 8.2 onwards; appendix A has the complete list.

Table 8.1: Recurring symbols in this chapter.
Symbol Meaning
N the sample size; in a multiple-group analysis N_g is the size of group g and N= \sum_g N_g
P the number of observed variables
T the number of free parameters
\boldsymbol{\vartheta}, \hat{\boldsymbol{\vartheta}}, \boldsymbol{\vartheta}_0 the T\times 1 vector of free parameters, its estimate, and its true (population) value
\mathbf{s} the P^{\star} \times 1 vector of sample statistics: \mathrm{vech}(\mathbf{S}) for a covariance structure, (\bar{\mathbf{y}}, \mathrm{vech}(\mathbf{S})) with a mean structure, thresholds and polychoric correlations for ordered data (Section 5.6.2, Section 7.4.1)
\boldsymbol{\sigma}(\boldsymbol{\vartheta}) the model-implied counterpart of \mathbf{s}, a function of \boldsymbol{\vartheta} through \boldsymbol{\mu}(\boldsymbol{\vartheta}) and \boldsymbol{\Sigma}(\boldsymbol{\vartheta}) (Section 4.1); \hat{\boldsymbol{\sigma}}= \boldsymbol{\sigma}(\boldsymbol{\hat{\vartheta}}) denotes its value at the solution
\boldsymbol{\Delta}(\boldsymbol{\vartheta}) the P^{\star} \times T model Jacobian \partial \boldsymbol{\sigma}(\boldsymbol{\vartheta})/ \partial \boldsymbol{\vartheta}^{\prime}
F(\boldsymbol{\vartheta}) a discrepancy function, the quantity an estimator minimizes (see below)
\boldsymbol{\Gamma} the P^{\star} \times P^{\star} asymptotic covariance matrix of \mathbf{s}, scaled by N (Section 5.6.2); \hat{\boldsymbol{\Gamma}}, \boldsymbol{\Gamma}^{\mathrm{NT}} and \boldsymbol{\Gamma}^{\mathrm{MOD}} are its distribution-free, normal-theory and model-based estimates (Section 8.3)
\mathbf{W} the P^{\star} \times P^{\star} weight matrix of the least squares family (Section 7.4.1)
\mathbf{A}_E, \mathbf{A}_O, \mathbf{B} the expected, observed and first-order information matrices (Section 8.2)
\boldsymbol{\Omega} the asymptotic covariance matrix of \hat{\boldsymbol{\vartheta}}, from which the standard errors are taken (Section 8.4)

The length P^{\star} of \mathbf{s} depends on what the model describes: P(P+ 1)/2 for a covariance structure, P+ P(P+ 1)/2 with a mean structure, more with thresholds; in a multiple-group analysis the group-specific vectors are stacked. Everything with P^{\star} rows (\boldsymbol{\Gamma}, \mathbf{W}, \boldsymbol{\Delta}, and the information matrices evaluated at a moment vector) is defined at the level of the moments; everything with T rows (the information matrices evaluated at a parameter vector, and \boldsymbol{\Omega}) is defined at the level of the parameters; and \boldsymbol{\Delta} connects the two.

The discrepancy function F(\boldsymbol{\vartheta}) is the quantity that the criterion-based estimators of the previous chapter minimize (Section 7.1). Three examples suffice. The normal-theory ML discrepancy function F_{\mathrm{ML}} (Equation 7.4; with a mean structure, Equation 7.3) equals the likelihood ratio against the saturated model divided by N (Section 7.3.3). The weighted least squares function F_{\mathrm{WLS}} = (\mathbf{s}- \boldsymbol{\sigma}(\boldsymbol{\vartheta}))^{\prime} \mathbf{W}(\mathbf{s}- \boldsymbol{\sigma}(\boldsymbol{\vartheta})) (Equation 7.9) covers the WLS, DWLS, GLS and ULS estimators through its choice of \mathbf{W}. And in a multiple-group analysis, F is a weighted sum of per-group discrepancy functions (Equation 7.7). Two conventions matter below. First, F is defined per observation: N\, F(\hat{\boldsymbol{\vartheta}}) is on the chi-square scale (the standard test statistic of Section 8.5.2 is exactly this product), and the information matrices derived from F are per-observation matrices, which is why explicit factors of N appear in the standard-error formulas. Second, at the solution the gradient of F is zero, and it is the curvature of F around \hat{\boldsymbol{\vartheta}} (its Hessian, or an approximation to it) that the information matrices capture.

8.1.2 Background from the appendices

From Section 8.2 onwards, the chapter uses results that are derived in the appendices rather than in the main text. Readers who want to follow the derivations will need:

  • the vec and vech operators and the duplication matrix \mathbf{D} of appendix B (B.1 and B.2), which turn expressions in \boldsymbol{\Sigma} into expressions in \boldsymbol{\sigma}; the normal-theory \boldsymbol{\Gamma}^{\mathrm{NT}} and the expected information at the saturated model are written with them;
  • the derivatives, the Hessian and the three information matrices of the multivariate normal loglikelihood in appendix D (appendix D.4, D.5 and D.6), including their evaluation at the saturated model (appendix D.6.4), which is what the \mathsf{H}_1 versions \mathbf{A}_E(\boldsymbol{\sigma}), \mathbf{A}_O(\boldsymbol{\sigma}) and \mathbf{B}(\boldsymbol{\sigma}) of Section 8.2 refer to;
  • the asymptotic covariance matrix of the sample moments in its normal-theory, distribution-free and model-based forms, and the sandwich identity that links them (appendix D.7);
  • for models with exogenous covariates under conditional_x = TRUE, the conditional versions of all of the above (appendix D.8);
  • for incomplete data under missing = "ml", the FIML loglikelihood with its scores and information matrices (appendix D.9), and the sandwich covariance of the saturated estimates that the two-stage standard errors use (appendix D.9.6);
  • for two-level models, the observed information by Louis’s identity in appendix E.5.

Within the main text, the chapter builds on the sample statistics and the \boldsymbol{\Gamma} matrix of chapter 5 (Section 5.6.2 and Section 5.7), the model-implied moments of chapter 4 (Section 4.1), and the estimators and the constraint machinery of chapter 7 (Section 7.2 and Section 7.7). The notation of the appendices differs from this chapter’s in one respect: the appendices write the per-observation expected, observed and first-order information matrices as \mathcal{I}, I and \mathbb{I}, where this chapter writes \mathbf{A}_E, \mathbf{A}_O and \mathbf{B}.

8.2 Information matrices

Intuitively, an information matrix quantifies how much the data tell us about the model parameters. It measures the curvature of the objective function around its optimum: a sharply curved objective means that even small departures from \hat{\boldsymbol{\vartheta}} would noticeably worsen the fit, so the data determine the parameters precisely; a flat objective means many parameter values fit nearly equally well, so the parameters are estimated imprecisely. The inverse of the information matrix is therefore one possible estimator of the sampling covariance of \hat{\boldsymbol{\vartheta}}, up to a factor of N that we make explicit below.

Three information matrices play a central role in both standard errors and test statistics: the expected information matrix, the observed information matrix, and the first-order information matrix. For the ML estimator under multivariate normality, explicit expressions are derived in appendix D.6.

Throughout this chapter, the expected information matrix is denoted by \mathbf{A}_E, the observed information matrix by \mathbf{A}_O, and the first-order information matrix by \mathbf{B}. Each matrix is available in two versions: one for the unrestricted (\mathsf{H}_1) model, which describes the saturated moment vector, and one for the user-specified (\mathsf{H}_0) model, which describes the structural parameters. The two are distinguished by their argument: when evaluated at a moment vector (e.g., \mathbf{A}_E(\boldsymbol{\sigma}), \mathbf{A}_E(\hat{\boldsymbol{\sigma}}), \mathbf{A}_E(\mathbf{s})), the matrix refers to the \mathsf{H}_1 level; when evaluated at a parameter vector (e.g., \mathbf{A}_E(\boldsymbol{\vartheta}), \mathbf{A}_E(\hat{\boldsymbol{\vartheta}})), it refers to the \mathsf{H}_0 level. For \mathbf{A}_E, \mathbf{B}, and the \mathsf{H}_1 approximation of \mathbf{A}_O, the \mathsf{H}_0 version is obtained from the \mathsf{H}_1 version through the model Jacobian \boldsymbol{\Delta}(\boldsymbol{\vartheta}) = \partial\boldsymbol{\sigma}(\boldsymbol{\vartheta})/\partial\boldsymbol{\vartheta}^{\prime}, as shown in the next subsections. The full observed information matrix is the exception: it is the Hessian of the objective function and does not generally admit such a triple-product representation.

8.2.1 The expected information matrix

The expected information matrix at the user-specified (\mathsf{H}_0) model, \mathbf{A}_E(\boldsymbol{\vartheta}), takes the triple-product form

\mathbf{A}_E(\boldsymbol{\vartheta}) = \boldsymbol{\Delta}(\boldsymbol{\vartheta})^{\prime}\mathbf{A}_E(\boldsymbol{\sigma})\boldsymbol{\Delta}(\boldsymbol{\vartheta}), \tag{8.1}

where \boldsymbol{\Delta}(\boldsymbol{\vartheta}) = \partial\boldsymbol{\sigma}(\boldsymbol{\vartheta})/\partial\boldsymbol{\vartheta}^{\prime} is the P^{\star} \times T model Jacobian and \mathbf{A}_E(\boldsymbol{\sigma}) is the expected information matrix of the unrestricted (\mathsf{H}_1) model, viewed as a function of the moments \boldsymbol{\sigma}. For the ML estimator, \mathbf{A}_E(\boldsymbol{\sigma}) is the unit expected information of the multivariate normal: \mathbf{A}_E(\boldsymbol{\sigma}) = \mathcal{I}_1; for WLS-type estimators it is the WLS weight matrix: \mathbf{A}_E(\boldsymbol{\sigma}) = \mathbf{W}.

For ML and DLS, \mathbf{A}_E(\boldsymbol{\sigma}) depends on the moments at which it is evaluated, so two variants of \mathbf{A}_E(\hat{\boldsymbol{\vartheta}}) are available. The structured version evaluates \mathbf{A}_E(\boldsymbol{\sigma}) at the model-implied moments \hat{\boldsymbol{\sigma}}:

\mathbf{A}_{E,\mathrm{str}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_E(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}, \tag{8.2}

while the unstructured version evaluates \mathbf{A}_E(\boldsymbol{\sigma}) at the sample-based summary statistics \mathbf{s}:

\mathbf{A}_{E,\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_E(\mathbf{s})\hat{\boldsymbol{\Delta}}, \tag{8.3}

where \hat{\boldsymbol{\Delta}}= \partial\hat{\boldsymbol{\sigma}}/\partial\hat{\boldsymbol{\vartheta}}^{\prime} is the model Jacobian evaluated at the estimates. The choice between the two is controlled by the h1_information argument (see Section 8.4.2).

For ULS, WLS, and DWLS estimators, \mathbf{A}_E(\boldsymbol{\sigma}) is fixed and the distinction does not apply. For ML under multivariate normality, \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) corresponds to Equation D.14 in appendix D.6.1 with \boldsymbol{\Sigma} replaced by the model-implied \boldsymbol{\Sigma}(\boldsymbol{\hat{\vartheta})}, while \mathbf{A}_E(\mathbf{s}) is obtained by replacing \boldsymbol{\Sigma} in Equation D.14 by the sample covariance matrix \mathbf{S}.

The expected information is the default for the GLS estimator and the ML estimator with complete data, and also for the ULS, WLS, and DWLS estimators, where it reduces to \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{W}\hat{\boldsymbol{\Delta}} and involves no distributional assumption. The Hessian-based observed information of the next subsection remains available for the latter estimators, and it is in fact the default bread of the sandwich standard errors for categorical data (Section 8.4.9).

8.2.2 The observed information matrix

The observed information matrix \mathbf{A}_O(\hat{\boldsymbol{\vartheta}}) is the Hessian of the objective function F(\boldsymbol{\vartheta}) evaluated at \hat{\boldsymbol{\vartheta}}:

\mathbf{A}_O(\hat{\boldsymbol{\vartheta}}) = \left.\frac{\partial^2 F(\boldsymbol{\vartheta})}{\partial\boldsymbol{\vartheta}\,\partial\boldsymbol{\vartheta}^{\prime}} \right|_{\boldsymbol{\vartheta}= \hat{\boldsymbol{\vartheta}}}. \tag{8.4}

For estimators based on a discrepancy function (ML, GLS, WLS, DWLS, ULS, and DLS), no division by N is needed because the discrepancy function is already sample-size independent. The exception is PML, which minimizes the negative log-likelihood; here the Hessian grows with N, so a 1/N factor is applied. Because lavaan minimizes F(\boldsymbol{\vartheta}), the Hessian at the solution is positive (semi)definite and no sign change is needed. What matters statistically is the Hessian itself; how it is computed is an implementation choice. In the current implementation, lavaan obtains \mathbf{A}_O(\hat{\boldsymbol{\vartheta}}) by numerically differentiating the analytic gradient of F(\boldsymbol{\vartheta}) at \hat{\boldsymbol{\vartheta}} (using Richardson extrapolation), rather than by computing finite differences of F(\boldsymbol{\vartheta}) itself. One derivative level is thus exact, the other approximate. Future versions may compute both levels exactly.

A simplified alternative is the \mathsf{H}_1 approximation, which projects an unrestricted (\mathsf{H}_1) observed information matrix through the model Jacobian. Two variants are available. The structured version evaluates the unrestricted information at the model-implied moments \hat{\boldsymbol{\sigma}}:

\mathbf{A}_{h1,\mathrm{str}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_O(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}, \tag{8.5}

while the unstructured version evaluates it at the sample-based summary statistics \mathbf{s}:

\mathbf{A}_{h1,\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_O(\mathbf{s})\hat{\boldsymbol{\Delta}}. \tag{8.6}

The choice between the two is controlled by the h1_information argument (see Section 8.4.2). Both variants take the triple-product form and avoid the cost of numerically differentiating the gradient, but they are rarely used in practice. For ML under multivariate normality, \mathbf{A}_O(\boldsymbol{\sigma}) is the unit observed information of the multivariate normal: \mathbf{A}_O(\boldsymbol{\sigma}) = I_1 as defined in appendix D.6.2. The structured variant evaluates Equation D.16 at the model-implied \boldsymbol{\mu}(\boldsymbol{\hat{\vartheta})} and \boldsymbol{\Sigma}(\boldsymbol{\hat{\vartheta})}, where the matrix differs from the expected information through terms in \mathbf{S}- \boldsymbol{\Sigma}(\boldsymbol{\hat{\vartheta})}. The unstructured variant evaluates it at \bar{\mathbf{y}} and \mathbf{S}, where these terms vanish and I_1 = \mathcal{I}_1 (appendix D.6.4), so that \mathbf{A}_{h1,\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}}) coincides with \mathbf{A}_{E,\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}}) of Equation 8.3.

8.2.3 The first-order information matrix

The first-order information matrix \mathbf{B}(\boldsymbol{\vartheta}) measures the average variability of the gradient of the objective function across observations. For likelihood-based estimators with individual-level data (ML and FIML), it is estimated as the sample average of the outer product of the casewise score vectors \mathbf{g}_i(\boldsymbol{\vartheta}) = \partial l_i(\boldsymbol{\vartheta})/\partial\boldsymbol{\vartheta}:

\mathbf{B}(\hat{\boldsymbol{\vartheta}}) = \frac{1}{N}\sum_{i=1}^N \mathbf{g}_i(\hat{\boldsymbol{\vartheta}})\,\mathbf{g}_i(\hat{\boldsymbol{\vartheta}})^{\prime}. \tag{8.7}

Because the casewise log-likelihood depends on \boldsymbol{\vartheta} only through the moment structure \boldsymbol{\sigma}(\boldsymbol{\vartheta}), the chain rule gives \mathbf{g}_i(\boldsymbol{\vartheta}) = \boldsymbol{\Delta}(\boldsymbol{\vartheta})^{\prime}\mathbf{g}_i(\boldsymbol{\sigma}), where \mathbf{g}_i(\boldsymbol{\sigma}) = \partial l_i/\partial\boldsymbol{\sigma} is the casewise score with respect to the moments (see appendix D.4.3 for the explicit form of \mathbf{g}_i(\boldsymbol{\sigma}) under multivariate normality). Therefore, Equation 8.7 can be rewritten as follows:

\begin{aligned} \mathbf{B}(\hat{\boldsymbol{\vartheta}}) &= \frac{1}{N}\sum_{i=1}^N \mathbf{g}_i(\hat{\boldsymbol{\vartheta}})\,\mathbf{g}_i(\hat{\boldsymbol{\vartheta}})^{\prime}\\ &= \frac{1}{N}\sum_{i=1}^N \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{g}_i(\hat{\boldsymbol{\sigma}})\, \mathbf{g}_i(\hat{\boldsymbol{\sigma}})^{\prime}\hat{\boldsymbol{\Delta}}\\ &= \hat{\boldsymbol{\Delta}}^{\prime}\, \left(\frac{1}{N}\sum_{i=1}^N \mathbf{g}_i(\hat{\boldsymbol{\sigma}})\mathbf{g}_i(\hat{\boldsymbol{\sigma}})^{\prime}\right) \hat{\boldsymbol{\Delta}}\\ &= \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{B}(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}, \end{aligned} \tag{8.8}

illustrating that \mathbf{B}(\hat{\boldsymbol{\vartheta}}) admits the same triple-product representation as \mathbf{A}_E. Under normality, \mathbf{B}(\boldsymbol{\sigma}) = \mathbb{I}_1 as defined in appendix D.6.3.

As with \mathbf{A}_E (and \mathbf{A}_{h1}), two variants of \mathbf{B}(\hat{\boldsymbol{\vartheta}}) are available, depending on the moments at which \mathbf{B}(\boldsymbol{\sigma}) is evaluated. The structured version evaluates it at the model-implied moments \hat{\boldsymbol{\sigma}}:

\mathbf{B}_{\mathrm{str}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{B}(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}, \tag{8.9}

while the unstructured version evaluates it at the sample-based summary statistics \mathbf{s}:

\mathbf{B}_{\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{B}(\mathbf{s})\hat{\boldsymbol{\Delta}}. \tag{8.10}

The choice between the two is controlled by the h1_information argument (see Section 8.4.2).

In practice, many estimators (ML with complete data, WLS-type estimators) work with aggregated sample statistics rather than individual observations. For these estimators, \mathbf{B}(\boldsymbol{\sigma}) admits a more convenient form. Viewing the casewise score as a function of the moments, its covariance matrix is the asymptotic covariance matrix \boldsymbol{\Gamma} of the sample statistics; pre- and post-multiplying by the moment-level expected information \mathbf{A}_E(\boldsymbol{\sigma}) then yields

\mathbf{B}(\hat{\boldsymbol{\sigma}}) = \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \, \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}}\, \mathbf{A}_E(\hat{\boldsymbol{\sigma}}),

and analogously

\mathbf{B}(\mathbf{s}) = \mathbf{A}_E(\mathbf{s}) \, \hat{\boldsymbol{\Gamma}} \, \mathbf{A}_E(\mathbf{s}).

Here \hat{\boldsymbol{\Gamma}} is a sample-based estimate of \boldsymbol{\Gamma} obtained directly from the data, while \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}} is a model-based estimate computed from the model-implied moments \hat{\boldsymbol{\sigma}}. The various estimators of \boldsymbol{\Gamma} that appear throughout this chapter are cataloged in Section 8.3. The ML estimator (with complete data) can use both versions, but WLS-type estimators with a fixed weight matrix (ULS, WLS, and DWLS) can only use the sample-based version. For those estimators, the first-order information matrix typically has the following form:

\mathbf{B}_{\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\mathbf{s}) \, \hat{\boldsymbol{\Gamma}} \, \mathbf{A}_E(\mathbf{s}) \hat{\boldsymbol{\Delta}}.

Two other mixed versions replace the unstructured expected information matrix \mathbf{A}_E(\mathbf{s}). A first version uses the structured expected information matrix instead:

\mathbf{B}_{\mathrm{mix,E}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \, \hat{\boldsymbol{\Gamma}} \, \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}}.

A second version uses the structured observed information matrix:

\mathbf{B}_{\mathrm{mix,O}}(\hat{\boldsymbol{\vartheta}}) = \hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_O(\hat{\boldsymbol{\sigma}}) \, \hat{\boldsymbol{\Gamma}} \, \mathbf{A}_O(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}}.

When the model is correctly specified and the distributional assumptions of the estimator are satisfied, the information matrix equality holds: \mathbf{A}(\boldsymbol{\vartheta}) = \mathbf{B}(\boldsymbol{\vartheta}) at the true parameter values, so \mathbf{B}(\hat{\boldsymbol{\vartheta}}) is also a consistent estimator of \mathbf{A}(\boldsymbol{\vartheta}). When those assumptions are violated, \mathbf{A}(\boldsymbol{\vartheta}) \neq \mathbf{B}(\boldsymbol{\vartheta}) in general, and this discrepancy is the source of non-robustness in the standard chi-square statistic and in conventional standard errors.

In lavaan, the three information matrices can be requested from a fitted object via lavInspect():

lavInspect(fit_ml, "information_expected")
lavInspect(fit_ml, "information_observed")
lavInspect(fit_ml, "information_first_order")

For complete normally distributed data, the three matrices are typically very close. The information argument (discussed in Section 8.4.2) controls which one is used.

8.2.4 Multiple groups, clustered data, and multilevel models

The constructions in Section 8.2.1, Section 8.2.2, and Section 8.2.3 extend to richer sampling designs in three ways.

When a grouping variable is specified, each group g has its own moment vector \boldsymbol{\sigma}(\boldsymbol{\vartheta})_g(\boldsymbol{\vartheta}) of length P^{\star}_g, and the parameter vector \boldsymbol{\vartheta} collects the union of free parameters across groups. The group-level Jacobian \boldsymbol{\Delta}_g(\boldsymbol{\vartheta}) = \partial\boldsymbol{\sigma}(\boldsymbol{\vartheta})_g/\partial\boldsymbol{\vartheta}^{\prime} therefore has P^{\star}_g rows but the full T columns: columns corresponding to parameters that do not appear in group g are zero, and a parameter that is constrained equal across two or more groups contributes a non-zero column in each of the corresponding \boldsymbol{\Delta}_g blocks. lavaan computes a separate information matrix per group at the unit level and pools them as a sample-size-weighted sum. With N_g the size of group g and N = \sum_g N_g,

\mathbf{A}_E(\hat{\boldsymbol{\vartheta}}) = \sum_{g=1}^{G} f_g\, \hat{\boldsymbol{\Delta}}_g^{\prime}\mathbf{A}_E(\hat{\boldsymbol{\sigma}}_g)\hat{\boldsymbol{\Delta}}_g, \qquad f_g = \frac{N_g}{N}, \tag{8.11}

and the same weighting f_g is applied to \mathbf{A}_O and \mathbf{B}. Equivalently, defining the stacked Jacobian and block-diagonal \mathsf{H}_1 information \hat{\boldsymbol{\Delta}}= \begin{pmatrix}\sqrt{f_1}\,\hat{\boldsymbol{\Delta}}_1\\ \vdots\\ \sqrt{f_G}\,\hat{\boldsymbol{\Delta}}_G\end{pmatrix}, \qquad \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) = \mathrm{blockdiag}\bigl(\mathbf{A}_E(\hat{\boldsymbol{\sigma}}_1), \ldots, \mathbf{A}_E(\hat{\boldsymbol{\sigma}}_G)\bigr), Equation 8.11 is a single triple product \hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_E(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}} acting on the stacked moment vector. Cross-group constraints on \hat{\boldsymbol{\vartheta}} are encoded by shared columns across the \hat{\boldsymbol{\Delta}}_g blocks.

When observations are sampled in clusters and the cluster identifier is passed via the cluster= argument (without a multilevel level: specification), observations within a cluster cannot be assumed independent. Only the first-order information matrix is affected: the casewise scores are first summed within each cluster, and the outer products of the centered cluster-sums are then accumulated. With N_J clusters and \mathbf{g}_{j+} = \sum_{i \in j}\mathbf{g}_i(\hat{\boldsymbol{\sigma}}) the score sum for cluster j,

\mathbf{B}_{\mathrm{clust}}(\hat{\boldsymbol{\sigma}}) = \frac{N_J}{N_J - 1}\,\frac{1}{N}\sum_{j=1}^{N_J} \left(\mathbf{g}_{j+} - \bar{\mathbf{g}}_{+}\right) \left(\mathbf{g}_{j+} - \bar{\mathbf{g}}_{+}\right)^{\prime}, \tag{8.12}

where \bar{\mathbf{g}}_{+} = N_J^{-1}\sum_j \mathbf{g}_{j+} and the factor N_J/(N_J - 1) is a small-sample correction. The expected and Hessian-based observed information matrices are unchanged. This adjustment is what allows the Huber–White sandwich variance to be corrected for clustering (see se = "robust.cluster" in Section 8.4.4).

When the model itself has a multilevel structure (specified via level: blocks), the formulas below are for the two-level random-intercept model of chapter 16 (Section 16.3) only; random slopes, requested through the rv() modifier, follow a different route (Section 16.3.3). The moment vector is split into a within-cluster part and a between-cluster part, with separate model-implied mean and covariance structures at each level: \boldsymbol{\mu}_W(\boldsymbol{\vartheta}) and \boldsymbol{\Sigma}_W(\boldsymbol{\vartheta}) for the within level, \boldsymbol{\mu}_B(\boldsymbol{\vartheta}) and \boldsymbol{\Sigma}_B(\boldsymbol{\vartheta}) for the between level. Under multivariate normality, the marginal distribution of the n_j stacked observations from cluster j is \mathcal{N}(\boldsymbol{1}_{n_j}\otimes\boldsymbol{\mu}_B,\, \boldsymbol{\Omega}_{n_j}) with cluster-specific covariance \boldsymbol{\Omega}_{n_j} = \boldsymbol{1}_{n_j}\boldsymbol{1}_{n_j}^{\prime}\otimes\boldsymbol{\Sigma}_B + \mathbf{I}_{n_j}\otimes\boldsymbol{\Sigma}_W. \tag{8.13}

Because \boldsymbol{\Omega}_{n_j} depends on n_j, each cluster contributes its own expected Hessian to the \mathsf{H}_1 information. The total \mathsf{H}_1 expected information is the sum of these per-cluster contributions over all clusters; equivalently, clusters of the same size pool into a single block, and the \mathsf{H}_1 information is a sum over distinct cluster sizes weighted by the number of clusters of that size. Within each cluster, the within-level moments enter scaled by 1/n_j relative to the between-level moments, so the two levels cannot be projected through a single global Jacobian. lavaan performs this assembly in a dedicated routine, which combines (\boldsymbol{\mu}_W, \boldsymbol{\Sigma}_W, \boldsymbol{\mu}_B, \boldsymbol{\Sigma}_B) with the cluster description and the model Jacobian to return \mathbf{A}_E(\hat{\boldsymbol{\vartheta}}) directly. For the observed information based on the Hessian, lavaan rescales by the number of clusters: instead of dividing by N, the Hessian is multiplied by N/N_J, reflecting that the effective sample size for between-level parameters is the number of clusters, not the number of observations. The first-order information at the \mathsf{H}_1 level uses the multilevel score function (with a missing-data counterpart when missing = "ml"), which evaluates the score per cluster and forms its outer product across clusters. The two-level log-likelihood behind these matrices, and the information matrices themselves, are discussed in more detail in Section 16.5 and Section 16.8.1.

8.2.5 Constrained models: the augmented information matrix

The previous chapter described how equality and inequality constraints are enforced during estimation (Section 7.7). Constraints also change the inference: when \hat{\boldsymbol{\vartheta}} is forced to satisfy a set of constraints, it can no longer vary freely in all T directions of the parameter space, and its asymptotic covariance matrix is no longer the plain inverse of the information matrix. This subsection introduces the constrained inverse that replaces \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1} throughout the remainder of this chapter whenever the model contains constraints.

8.2.6 The active constraint set

The starting point is the set of constraints that actually restrict the solution. Equality constraints always belong to this set. An inequality constraint (including lower/upper bounds on individual parameters, Section 7.7.4) belongs to it only when it is active (binding) at the solution. As mentioned in Section 7.7.5, lavaan classifies each inequality constraint after convergence using strict complementarity: a constraint is treated as binding only when its slack value is (near) zero and its Lagrange multiplier is not negligible (for simple bounds handled by the optimizer itself, the multipliers are recovered post hoc from the gradient). The two-part test matters: an estimate that merely touches a bound, with a vanishing multiplier, is an interior solution. Treating its constraint as binding would (wrongly) collapse the standard error of that parameter to zero, with a discontinuous jump to the ordinary standard error just across the boundary. Inactive constraints play no role in what follows: the standard errors are then identical to those of a model without the constraint.

Let \mathbf{R}_{\text{act}} denote the K_{\text{act}}\times T Jacobian of the active constraints, evaluated at the solution: its rows are the gradients of the equality constraint functions and of the binding inequality constraint functions (Section 7.7.2). For linear constraints, \mathbf{R}_{\text{act}} contains the corresponding rows of \mathbf{R}_{\text{eq}} (and \mathbf{R}_{\text{in}}); for nonlinear constraints, \mathbf{R}_{\text{act}} is a local linearization at \hat{\boldsymbol{\vartheta}}, which is asymptotically justified because \hat{\boldsymbol{\vartheta}} is consistent. The fitted object keeps \mathbf{R}_{\text{act}} together with the Lagrange multipliers (see the implementation notes, Section 8.7.1).

8.2.7 The constrained inverse

Because every admissible parameter vector satisfies the active constraints, the estimator can only vary along the tangent space of the constraint surface: asymptotically, \sqrt{N}(\hat{\boldsymbol{\vartheta}}- \boldsymbol{\vartheta}_0) lies in the null space \{\mathbf{x} : \mathbf{R}_{\text{act}}\mathbf{x} = \mathbf{0}\}. Let \mathbf{Z} be a T \times (T - K_{\text{act}}) matrix whose columns form an orthonormal basis of this null space (compare with \mathbf{Z}_{\text{eq}}= \mathbf{Q}_2 in Section 7.7.6, which is exactly such a basis for the linear-equality case). The constrained inverse of the information matrix is then

\mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-} = \mathbf{Z} \bigl(\mathbf{Z}^{\prime}\mathbf{A}(\hat{\boldsymbol{\vartheta}})\,\mathbf{Z}\bigr)^{-1} \mathbf{Z}^{\prime}. \tag{8.14}

The construction is intuitive: project the information onto the tangent space, invert it there (where it is nonsingular for an identified model), and map the result back to the full parameter space. The resulting matrix acts as \mathbf{A}^{-1} within the tangent space, and is exactly zero across it: \mathbf{R}_{\text{act}}\,\mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-}\,\mathbf{R}_{\text{act}}^{\prime} = \mathbf{0}, expressing that there is no sampling variability in the directions forbidden by the constraints. Equation 8.14 holds for any information matrix in this chapter (expected, observed, or first-order), and also replaces the “bread” on both sides of the sandwich in Section 8.4.4.

An equivalent, older formulation borders the information matrix with the constraint Jacobian, in the style of the Karush–Kuhn–Tucker conditions:

\mathbf{A}^{\mathrm{aug}} = \begin{bmatrix} \mathbf{A}(\hat{\boldsymbol{\vartheta}}) & \mathbf{R}_{\text{act}}^{\prime} \\ \mathbf{R}_{\text{act}}& \mathbf{0} \end{bmatrix}. \tag{8.15}

The upper-left T \times T block of the Moore–Penrose inverse of \mathbf{A}^{\mathrm{aug}} equals Equation 8.14. This augmented information matrix gave the procedure its historical name in the lavaan source code, and it can be inspected directly via lavInspect(fit, "augmented_information"). The null-space expression Equation 8.14 is the default computational route (it is faster and numerically more stable, since the bordered matrix is indefinite by construction); the bordered Moore–Penrose inverse is kept as a fallback. Two implementation details are relevant here. First, the rows of \mathbf{R}_{\text{act}} are rescaled to unit length before use: the null space is invariant to row scaling, but a badly scaled constraint (say, 1000*a == 1000*b) would otherwise dominate the spectrum of the bordered matrix and exceed the relative tolerance of the generalized inverse. Second, for a constrained model the identification check (is the information positive definite?) is applied to the tangent-space block \mathbf{Z}^{\prime}\mathbf{A}\mathbf{Z}, not to \mathbf{A} itself: the full information may well be singular in directions that the constraints remove.

8.2.8 The three equality regimes

How \mathbf{R}_{\text{act}} is obtained depends on the equality-constraint category of Section 7.7.3, corresponding to the three estimation routes of the previous chapter:

  • Simple equality constraints with ceq_simple = TRUE (Section 7.7.7): the information matrix is computed in the duplicated parameter space (one row/column per parameter, including duplicates), and the constraint matrix is taken to be the orthogonal complement of the T\times T^{\star} indicator matrix \mathbf{L} of Section 7.7.7 (with T^{\star} < T the number of unique free parameters): the tangent space is the column span of \mathbf{L}. The constrained inverse then has identical rows and columns for parameters that share a label, so tied parameters automatically receive one common standard error.

  • Linear equality constraints (the default route, also used for simple constraints when ceq_simple = FALSE): here \mathbf{R}_{\text{act}}= \mathbf{R}_{\text{eq}}, the constant Jacobian of Section 7.7.6, and \mathbf{Z} can be taken equal to the null-space basis \mathbf{Z}_{\text{eq}} that the optimizer already used to eliminate the constraints. Although the two routes organize the computations differently, they produce identical standard errors (and identical degrees of freedom); the choice of ceq_simple is a matter of internal organization, not of statistical results.

  • Nonlinear equality constraints and/or (active) inequality constraints: the augmented-Lagrangian optimizer returns the Jacobian of all constraints evaluated at the solution, together with the Lagrange multipliers; after the strict-complementarity classification described above, the active rows form \mathbf{R}_{\text{act}}.

The following code verifies Equation 8.14 numerically for a model with two (simple, linear) equality constraints:

model_eq <- '
  visual  =~ x1 + a*x2 + a*x3
  textual =~ x4 + b*x5 + b*x6
'
fit_eq <- cfa(model_eq, data = HolzingerSwineford1939)
A <- lavInspect(fit_eq, "information")     # information (unit scale)
H <- lavTech(fit_eq, "con_jac")            # active constraint Jacobian
Z <- qr.Q(qr(t(H)), complete = TRUE)[, -seq_len(nrow(H))]  # null space
V <- Z %*% solve(t(Z) %*% A %*% Z, t(Z)) / nobs(fit_eq)
max(abs(V - vcov(fit_eq)))                 # zero: identical
[1] 8.673617e-18

8.3 Estimators of \boldsymbol{\Gamma}

Throughout this chapter, \boldsymbol{\Gamma} denotes the asymptotic covariance matrix of the sample summary statistics, multiplied by the number of observations; that is, \boldsymbol{\Gamma}= N \cdot \mathrm{ACOV}(\mathbf{s}). Several distinct estimators of \boldsymbol{\Gamma} appear in the formulas for robust standard errors (Section 8.4.4) and for robust test statistics (Section 8.5.3, Section 8.5.10, Section 8.5.11). They differ along three axes:

  • sample-based (computed directly from the sample) versus model-based (computed at the model-implied moments \hat{\boldsymbol{\sigma}});

  • ADF (asymptotic-distribution-free, requiring no distributional assumption) versus normal-theory (NT, requiring multivariate normality);

  • complete-data versus incomplete-data (FIML) and clustered (taking the sampling design into account).

8.3.1 Sample-based estimators

The sample-based estimators are introduced in detail in Section 5.6.2. Briefly:

  • For continuous data, the ADF estimator \hat{\boldsymbol{\Gamma}} is the empirical fourth-order moment matrix of the centered observations:

    \hat{\boldsymbol{\Gamma}} = \frac{1}{N}\sum_{i=1}^{N} (\mathbf{v}_i - \bar{\mathbf{v}}) (\mathbf{v}_i - \bar{\mathbf{v}})^{\prime}, \tag{8.16}

    where \mathbf{v}_i stacks \mathbf{y}_i with the \mathrm{vech} of (\mathbf{y}_i - \bar{\mathbf{y}})(\mathbf{y}_i - \bar{\mathbf{y}})^{\prime}.

  • For categorical data, the ADF estimator \hat{\boldsymbol{\Gamma}} estimates (N times) the asymptotic covariance matrix of the (estimated) sample statistics (\mathbf{s}) that are used in the categorical setting (for example: thresholds, polychoric or tetrachoric correlations, regression slopes, …). The estimator has the following form:

    \hat{\boldsymbol{\Gamma}} = \mathbf{A}(\mathbf{s})^{-1}\, \mathbf{B}(\mathbf{s})\, \mathbf{A}(\mathbf{s})^{-1}. \tag{8.17}

  • For continuous data, the normal-theory estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} replaces the empirical fourth-order moments by their multivariate-normal expressions:

    \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} = \begin{pmatrix} \mathbf{S}& \mathbf{0}\\ \mathbf{0} & 2\,\mathbf{D}^{+}(\mathbf{S}\otimes \mathbf{S})\, \mathbf{D}^{+\,\prime} \end{pmatrix}, \tag{8.18}

    where \mathbf{D}^{+} is the Moore-Penrose inverse of the duplication matrix. Under multivariate normality, \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} is consistent for \boldsymbol{\Gamma} and is much more stable in finite samples than \hat{\boldsymbol{\Gamma}}.

8.3.2 Model-based estimators

The model-based estimators replace the sample moments by the model-implied moments \hat{\boldsymbol{\sigma}} and can be expressed by the triple-product representation

\boldsymbol{\Gamma}^{\mathrm{MOD}}(\boldsymbol{\sigma}) = \mathbf{A}(\boldsymbol{\sigma})^{-1}\, \mathbf{B}(\boldsymbol{\sigma})\, \mathbf{A}(\boldsymbol{\sigma})^{-1}, \tag{8.19}

where \mathbf{A}(\boldsymbol{\sigma}) is the \mathsf{H}_1 expected or observed information matrix (Section 8.2.1, Section 8.2.2) and \mathbf{B}(\boldsymbol{\sigma}) is the \mathsf{H}_1 first-order information matrix (Section 8.2.3). The estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}} = \boldsymbol{\Gamma}^{\mathrm{MOD}}(\hat{\boldsymbol{\sigma}}) is obtained by evaluating Equation 8.19 at the model-implied moments \hat{\boldsymbol{\sigma}}.

When the data are normally distributed and the model is correctly specified, the information-matrix equality \mathbf{A}(\boldsymbol{\sigma}) = \mathbf{B}(\boldsymbol{\sigma}) holds, and Equation 8.19 reduces to

\boldsymbol{\Gamma}^{\mathrm{MOD,NT}}(\boldsymbol{\sigma}) = \mathbf{A}(\boldsymbol{\sigma})^{-1}. \tag{8.20}

The estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD,NT}} = \mathbf{A}(\hat{\boldsymbol{\sigma}})^{-1} is the model-based counterpart of the sample-based normal-theory estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} in Equation 8.18, and the two coincide at the saturated solution \hat{\boldsymbol{\sigma}}= \mathbf{s}.

8.3.3 FIML (incomplete-data) variants

When missing = "ml" is used, the \mathsf{H}_1 information matrices in Equation 8.19 and Equation 8.20 become the FIML information matrices of appendix D.9.5: \mathbf{A}(\hat{\boldsymbol{\sigma}}) = \hat{I}_1^{\mathrm{FIML}} (the FIML observed information, Equation D.49) and \mathbf{B}(\hat{\boldsymbol{\sigma}}) = \hat{\mathbb{I}}_1^{\mathrm{FIML}} (the FIML first-order information, Equation D.50). With these substitutions, Equation 8.19 becomes

\hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}} = \bigl(\hat{I}_1^{\mathrm{FIML}}\bigr)^{-1}\, \hat{\mathbb{I}}_1^{\mathrm{FIML}}\, \bigl(\hat{I}_1^{\mathrm{FIML}}\bigr)^{-1}, \tag{8.21}

which is the matrix denoted \boldsymbol{\Omega}_{SW} in appendix D.9.6. Likewise, Equation 8.20 becomes

\hat{\boldsymbol{\Gamma}}^{\mathrm{MOD,NT}} = \bigl(\hat{I}_1^{\mathrm{FIML}}\bigr)^{-1}, \tag{8.22}

the FIML analog of \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}}.

The sample-based estimators have incomplete-data versions too. The same two expressions are then evaluated at the saturated (EM) estimates of the means and the covariance matrix instead of at the model-implied moments: the inverse of the observed information of the saturated model takes the place of \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}}, and the sandwich takes the place of \hat{\boldsymbol{\Gamma}}. These are the covariance matrices of the EM estimates that the two-stage approach of Section 8.4.11 uses. Because they do not depend on the fitted model, they do not absorb any of its misfit. The sandwich version is robust against nonnormality, and it reflects the sampling weights if they are used.

8.3.4 Cluster-corrected estimator

When the data are sampled in clusters and the cluster identifier is passed via the cluster= argument (without a multilevel level: specification), the sample-based estimator \hat{\boldsymbol{\Gamma}} in Equation 8.16 is no longer consistent: observations within a cluster cannot be assumed independent. The cluster-corrected estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{clus}} generalizes Equation 8.16 following the same logic as the cluster-adjusted first-order information matrix in Equation 8.12. With N_J clusters, let \mathbf{v}_{j+} = \sum_{i \in j} \mathbf{v}_i be the cluster-sum of the moment-level contributions \mathbf{v}_i from Equation 8.16, and \bar{\mathbf{v}}_{+} = N_J^{-1}\sum_j \mathbf{v}_{j+}. Then

\hat{\boldsymbol{\Gamma}}^{\mathrm{clus}} = \frac{N_J}{N_J - 1}\,\frac{1}{N}\sum_{j=1}^{N_J} (\mathbf{v}_{j+} - \bar{\mathbf{v}}_{+}) (\mathbf{v}_{j+} - \bar{\mathbf{v}}_{+})^{\prime}, \tag{8.23}

where N_J/(N_J - 1) is a small-cluster correction. For categorical (and mixed categorical/continuous) data, a cluster-corrected version of Equation 8.17 is obtained along the same lines: the casewise score contributions in the meat matrix \mathbf{B}(\mathbf{s}) are first summed within each cluster before the outer product is taken, while the bread \mathbf{A}(\mathbf{s})^{-1} is left unchanged. This categorical variant matches the behavior of TYPE = COMPLEX in Mplus.

8.3.5 Summary

Table 8.2 summarizes the variants and where each is used in the rest of the chapter.

Table 8.2: Estimators of \boldsymbol{\Gamma} used in this chapter, with cross-references to the formulas and to the options that invoke each.
Variant Notation Definition Used by
Sample-based ADF \hat{\boldsymbol{\Gamma}} Equation 8.16 se = "robust.sem"; test = "satorra.bentler", "mean.var.adjusted", "scaled.shifted" (and their ".corrected" variants), "browne.residual.adf"; FMG family
Sample-based NT \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} Equation 8.18 se = "robust.sem.nt"; test = "browne.residual.nt"
Model-based ADF \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}} Equation 8.19 (complete data); Equation 8.21 (FIML) test = "yuan.bentler", "yuan.bentler.mplus", "browne.residual.adf.model"; se = "robust.two.stage" (FIML)
Model-based NT \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD,NT}} Equation 8.20 (complete data); Equation 8.22 (FIML) test = "browne.residual.nt.model" (RLS); se = "two.stage" (FIML)
Cluster-corrected \hat{\boldsymbol{\Gamma}}^{\mathrm{clus}} Equation 8.23 se = "robust.cluster.sem"

8.4 Standard errors

Several options are available for computing standard errors in lavaan, controlled by the se argument. The appropriate choice depends on a number of factors: which estimator is being used, whether the data can be assumed to be normally distributed, whether the data are complete or contain missing values, and whether the sampling design involves clustering. Table 8.3 gives an overview of all available options. (The “default for …” entries in this table, and in Table 8.5 later in this chapter, describe the current defaults; the mapping from estimators to default se=/test= values may be revisited in a future major version.)

Table 8.3: Overview of the se= argument options in lavaan.
se= Description When to use
"standard" Based on the information matrix \mathbf{A}(\boldsymbol{\vartheta}) or \mathbf{B}(\boldsymbol{\vartheta}) Default for ML, GLS, and WLS; normality assumed for ML and GLS only; ML supports incomplete data
"robust.sem" Sandwich estimator; \mathbf{B}(\hat{\boldsymbol{\vartheta}}) involves \hat{\boldsymbol{\Gamma}} Default for MLM, MLMV, MLMVS, and DLS with nonnormal continuous data; ULSM, ULSMV, ULSMVS, WLSM, WLSMV, WLSMVS with nonnormal continuous or categorical data; ULS and DWLS with categorical data; complete data (or the two-stage EM moments of Section 8.4.11)
"robust.sem.nt" Sandwich estimator; \mathbf{B}(\hat{\boldsymbol{\vartheta}}) involves \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} Default for ULS and DWLS; normal continuous data; complete data only
"robust.cluster.sem" Sandwich estimator; \mathbf{B}(\hat{\boldsymbol{\vartheta}}) involves \hat{\boldsymbol{\Gamma}}^{\mathrm{clus}} Same setting as "robust.sem" but for clustered data
"robust.huber.white" or its alias "sandwich" Sandwich estimator; \mathbf{B}(\hat{\boldsymbol{\vartheta}}) via casewise scores Default for MLR with nonnormal complete or incomplete continuous data; default for PML with categorical data
"robust.cluster" Sandwich estimator; \mathbf{B}(\hat{\boldsymbol{\vartheta}}) via casewise scores, corrected for clustering Same setting as "robust.huber.white" but for clustered (but non-multilevel) data
"two.stage" Two-stage approach for incomplete data ML with missing = "two.stage"; normal incomplete data
"robust.two.stage" Robust two-stage for incomplete data ML with missing = "robust.two.stage"; nonnormal incomplete data
"bootstrap" Nonparametric bootstrap Any estimator; no distributional assumption needed
"none" No standard errors computed When only point estimates are of interest

The sections below explain the most important options in detail.

8.4.1 The asymptotic distribution of \hat{\boldsymbol{\vartheta}}

For single-stage estimators that rely on a global fitting function, and under standard regularity conditions, \sqrt{N}(\hat{\boldsymbol{\vartheta}}- \boldsymbol{\vartheta}_0) is asymptotically multivariate normal with mean zero and covariance matrix \boldsymbol{\Omega}. When the model is correctly specified and the distributional assumptions of the estimator are satisfied, \boldsymbol{\Omega}= \mathbf{A}(\boldsymbol{\vartheta})^{-1}. Otherwise, \boldsymbol{\Omega} takes the sandwich form

\boldsymbol{\Omega}= \mathbf{A}(\boldsymbol{\vartheta})^{-1}\,\mathbf{B}(\boldsymbol{\vartheta})\,\mathbf{A}(\boldsymbol{\vartheta})^{-1}, \tag{8.24}

where \mathbf{A}(\boldsymbol{\vartheta}) is the information matrix (the “bread”) and \mathbf{B}(\boldsymbol{\vartheta}) is the first-order information matrix (the “meat”). When the model is correctly specified and distributional assumptions hold, \mathbf{A}(\boldsymbol{\vartheta}) = \mathbf{B}(\boldsymbol{\vartheta}), so Equation 8.24 reduces to \mathbf{A}(\boldsymbol{\vartheta})^{-1}.

The standard error of a single parameter \hat{\vartheta}_j is:

\mathrm{SE}(\hat{\vartheta}_j) = \sqrt{\hat{\Omega}_{jj} / N}, \tag{8.25}

where \hat{\Omega}_{jj} is the j-th diagonal element of a consistent sample estimate \hat{\boldsymbol{\Omega}} of \boldsymbol{\Omega}.

In lavaan, the estimated covariance matrix of the parameter estimates (i.e., \hat{\boldsymbol{\Omega}}/N) is returned by vcov(), and the standard errors are shown in the se column of the output produced by summary() and parameterEstimates().

8.4.2 Conventional standard errors

The se = "standard" option estimates \boldsymbol{\Omega} as \mathbf{A}(\boldsymbol{\vartheta})^{-1}, so that standard errors are obtained from \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1}/N. This is the default for the ML, GLS, and WLS estimators. The underlying assumption is that the weight matrix used by the estimator (explicit in GLS and WLS, implicit in ML) is correctly specified, in which case the information matrix equality \mathbf{A}(\boldsymbol{\vartheta}) = \mathbf{B}(\boldsymbol{\vartheta}) holds and the sandwich form collapses to \mathbf{A}(\boldsymbol{\vartheta})^{-1}. For ML and GLS, this requires multivariate normality. For WLS, normality is not required but the weight matrix should be the inverse of \hat{\boldsymbol{\Gamma}}, a consistent estimate of the asymptotic covariance matrix of the sample-based summary statistics (Browne, 1984). Therefore, se = "standard" is asymptotically valid for WLS even under nonnormality.

The choice of which estimate of \mathbf{A}(\boldsymbol{\vartheta}) to use is controlled by the information argument:

  • information = "expected" uses \mathbf{A}_E(\hat{\boldsymbol{\vartheta}}), computed analytically from the model-implied moments at \hat{\boldsymbol{\vartheta}}.

  • information = "observed" uses the observed information. The sub-option observed_information further specifies whether to use:

    • "hessian": the full Hessian \mathbf{A}_O(\hat{\boldsymbol{\vartheta}}) (default when information = "observed");
    • "h1": the \mathsf{H}_1 approximation \mathbf{A}_{h1}(\hat{\boldsymbol{\vartheta}}).
  • information = "first.order" uses \mathbf{B}(\hat{\boldsymbol{\vartheta}})^{-1} as an estimate of \mathbf{A}(\boldsymbol{\vartheta})^{-1}. This is rarely used for conventional (non-robust) standard errors but is sometimes requested in the context of score-based diagnostics or for compatibility with software that reports outer-product-of-gradients standard errors.

For \mathbf{A}_E(\hat{\boldsymbol{\vartheta}}), \mathbf{A}_{h1}(\hat{\boldsymbol{\vartheta}}) and \mathbf{B}(\hat{\boldsymbol{\vartheta}}), the h1_information argument further controls whether the structured version (the default) or the unstructured version is used.

Table 8.4 summarizes the available options for conventional standard errors in lavaan.

Table 8.4: Options for conventional standard errors in lavaan (se = "standard").
information observed_information h1_information Estimate of \boldsymbol{\Omega}
"expected" "structured" \mathbf{A}_{E,\mathrm{str}}(\hat{\boldsymbol{\vartheta}})^{-1} (default for most settings, except when missing = "ml")
"expected" "unstructured" \mathbf{A}_{E,\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}})^{-1}
"observed" "hessian" \mathbf{A}_O(\hat{\boldsymbol{\vartheta}})^{-1} (default with ML + missing = "ml")
"observed" "h1" "structured" \mathbf{A}_{h1,\mathrm{str}}(\hat{\boldsymbol{\vartheta}})^{-1}
"observed" "h1" "unstructured" \mathbf{A}_{h1,\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}})^{-1}
"first.order" "structured" \mathbf{B}_{\mathrm{str}}(\hat{\boldsymbol{\vartheta}})^{-1}
"first.order" "unstructured" \mathbf{B}_{\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}})^{-1}

Note that with complete data, \mathbf{A}_{E,\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}})^{-1} is the same as \mathbf{A}_{h1,\mathrm{unstr}}(\hat{\boldsymbol{\vartheta}})^{-1}. For complete, normally distributed data, the differences between the resulting standard errors are usually negligible. Larger differences can appear with small samples, nonnormal data, or incomplete data.

To obtain observed-information standard errors instead of the default:

fit_obs <- cfa(model, data = HolzingerSwineford1939,
               information = "observed")

To switch to the \mathsf{H}_1 approximation:

fit_obs <- cfa(model, data = HolzingerSwineford1939,
               information = "observed", observed_information = "h1")

The information, h1_information, and observed_information arguments also accept a vector of two values, which do not need to be the same:

fit_obs <- cfa(model, data = HolzingerSwineford1939,
               information = c("expected", "observed"),
               observed_information = c("hessian", "hessian"))

The first value applies to the standard errors, while the second value applies to the test statistics. If only a single value is provided, it is used for both standard errors and test statistics.

8.4.3 Standard errors under constraints

When the model contains equality constraints, or inequality constraints that are active at the solution, every occurrence of \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1} in this chapter is replaced by the constrained inverse \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-} of Equation 8.14. For se = "standard", the estimate of \boldsymbol{\Omega} becomes \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-}; for the sandwich-type standard errors of the next subsection, the constrained inverse forms the “bread” on both sides:

\hat{\boldsymbol{\Omega}} = \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-}\,\mathbf{B}(\hat{\boldsymbol{\vartheta}})\, \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-}. \tag{8.26}

No further changes are needed: the information, observed_information and h1_information options of Table 8.4 keep their meaning, and bootstrap standard errors need no special treatment (each bootstrap replication refits the model under the same constraints).

The practical consequences are as follows.

  • Equality-constrained parameters share one standard error. Parameters tied by a simple equality constraint are, statistically, a single parameter; the corresponding rows and columns of \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-} are identical, and summary() reports the same (typically smaller) standard error for each member of the set. More generally, the sampling variability of any function that is constant on the constraint surface is zero: \mathbf{R}_{\text{act}}\,\hat{\boldsymbol{\Omega}}\,\mathbf{R}_{\text{act}}^{\prime} = \mathbf{0}.

  • A parameter at an active bound has a zero standard error. A simple bound involves a single parameter, so its row of \mathbf{R}_{\text{act}} removes that parameter’s direction from the tangent space entirely: the reported standard error is exactly zero. This is a description of the constrained estimator (the estimate cannot move off the bound), not a statement of infinite precision; inference for a parameter on the boundary of its parameter space is nonstandard, and the usual normal approximation only applies in the interior. The standard errors of the other (interior) parameters, however, are corrected for the presence of the active bound, which is the main purpose of the constrained inverse.

  • A singular latent covariance matrix under pd_lv = TRUE is treated in the same way. When the option that keeps the covariance matrix of the latent variables positive definite ends on the boundary (see Section 7.11.4), for example with a latent correlation of one or a latent variance of zero, the boundary is an active inequality constraint: the standard errors are those of the model restricted to this boundary, and some of them may be zero. The degrees of freedom are not adjusted.

  • Inactive constraints have no effect. Because of the strict-complementarity classification of Section 8.2.5, an inequality constraint that is satisfied with positive slack, or merely touched with a vanishing multiplier, leaves all standard errors identical to those of the unconstrained fit.

Finally, a technical note: because \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-} has rank T - K_{\text{act}} by construction, the estimated covariance matrix of the parameter estimates is rank-deficient whenever constraints are active. The positive-definiteness check on vcov() (option check_vcov) therefore discards the K_{\text{act}} smallest eigenvalues before testing whether the remainder is positive. Here K_{\text{act}} is computed as the rank of the stacked active constraint rows, so that redundant constraints are not over-counted.

8.4.4 Robust sandwich-type standard errors

When the (explicit or implicit) weight matrix associated with the estimator is misspecified, the conventional standard errors are generally inconsistent, and the full sandwich estimator Equation 8.24 must be used instead. In lavaan, several variants for robust standard errors are available, controlled by the se argument.

8.4.5 se = “robust.sem”

The option se = "robust.sem" implements the first generation of robust standard errors developed specifically for structural equation modeling. By default, the bread of the sandwich is based on the expected information matrix \mathbf{A}_E(\hat{\boldsymbol{\vartheta}}), whereas the meat uses \mathbf{B}_{\mathrm{mix,E}}(\hat{\boldsymbol{\vartheta}}) with the sample-based ADF estimator \hat{\boldsymbol{\Gamma}} (Equation 8.16), yielding the classical formulation:

\hat{\boldsymbol{\Omega}} = (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}})^{-1} \bigl(\hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_E(\hat{\boldsymbol{\sigma}})\, \hat{\boldsymbol{\Gamma}}\,\mathbf{A}_E(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}\bigr) (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}})^{-1}. \tag{8.27}

The bread need not be the expected information. For categorical data estimated with DWLS or ULS (the WLSMV and ULSMV aliases of Section 14.5.6), the current default keeps the meat of Equation 8.27 but replaces the bread by the Hessian-based observed information \mathbf{A}_O(\hat{\boldsymbol{\vartheta}})^{-1}, following Lai and Simoes (2023): with \mathbf{A}_E(\boldsymbol{\sigma}) = \mathbf{W} fixed, the expected bread drops the second-order term of the Hessian and is consistent only when the model fits perfectly. This bread-only override is governed by the information_bread option described in Section 8.4.9, and summary() reports it on an Information bread line. Earlier releases used the expected bread in this setting, so the standard errors differ from older output; the point estimates and the test statistics do not.

Two further variants change the bread and the meat together. The first replaces the expected information matrix \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) by the \mathsf{H}_1 observed information \mathbf{A}_O(\hat{\boldsymbol{\sigma}}) of Section 8.2.2, so that the bread becomes \mathbf{A}_{h1,\mathrm{str}}(\hat{\boldsymbol{\vartheta}})^{-1} and the meat \mathbf{B}_{\mathrm{mix,O}}(\hat{\boldsymbol{\vartheta}}):

\hat{\boldsymbol{\Omega}}_{h1,h1} = (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_O(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}})^{-1} \bigl(\hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_O(\hat{\boldsymbol{\sigma}})\, \hat{\boldsymbol{\Gamma}}\,\mathbf{A}_O(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}\bigr) (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_O(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}})^{-1}.

An attractive feature of this approach is that the same h1-based information matrix appears in both the bread and the meat of the sandwich estimator. In lavaan, this variant can be requested as follows:

fit <- cfa(model, data = HolzingerSwineford1939, se = "robust.sem",
           information = "observed", observed_information = "h1")

The second variant uses the Hessian-based observed information matrix \mathbf{A}_O(\hat{\boldsymbol{\vartheta}}) for the bread, while retaining \mathbf{A}_O(\hat{\boldsymbol{\sigma}}) in the meat:

\hat{\boldsymbol{\Omega}}_{\mathrm{Hess},h1} = \mathbf{A}_O(\hat{\boldsymbol{\vartheta}})^{-1} \bigl(\hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_O(\hat{\boldsymbol{\sigma}})\, \hat{\boldsymbol{\Gamma}}\,\mathbf{A}_O(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}\bigr) \mathbf{A}_O(\hat{\boldsymbol{\vartheta}})^{-1}.

This version can be obtained in lavaan by setting:

fit <- cfa(model, data = HolzingerSwineford1939, se = "robust.sem",
           information = "observed", observed_information = "hessian")

8.4.6 se = “robust.sem.nt”

The option se = "robust.sem.nt" is primarily intended for use with the ULS and DWLS estimators when analyzing continuous data under the assumption of multivariate normality. Because the weight matrices associated with these estimators are intentionally misspecified, the conventional standard errors are generally invalid. A consistent alternative is obtained by using the same sandwich formula as in Equation 8.27, but replacing \hat{\boldsymbol{\Gamma}} by its sample-based normal-theory counterpart \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} (Equation 8.18):

\hat{\boldsymbol{\Omega}} = (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}})^{-1} \bigl(\hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_E(\hat{\boldsymbol{\sigma}})\, \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}}\mathbf{A}_E(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}\bigr) (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}})^{-1}.

For example:

fit <- cfa(model, data = HolzingerSwineford1939, estimator = "ULS",
           se = "robust.sem.nt")

Note that requesting se = "robust.sem.nt" with the WLS or DLS estimators, or with categorical data, results in an error: for WLS and DLS the (full) weight matrix is derived from the same \hat{\boldsymbol{\Gamma}} slot, which cannot simultaneously hold the normal-theory version needed for the sandwich (in earlier versions, the ADF weight matrix was silently replaced, effectively turning WLS into GLS), while for categorical data no normal-theory \hat{\boldsymbol{\Gamma}} exists. In these settings, se = "robust.sem" should be used instead.

8.4.7 se = “robust.cluster.sem”

When the data are clustered, a common strategy is to account for the dependency structure by introducing random effects in a multilevel model. An alternative approach is to ignore the clustering during point estimation, while adjusting the standard errors afterward to account for the clustered sampling structure.

These so-called cluster-robust standard errors can be obtained using the same sandwich formula as in Equation 8.27, but replacing the usual \hat{\boldsymbol{\Gamma}} by the cluster-corrected version \hat{\boldsymbol{\Gamma}}^{\mathrm{clus}} (Equation 8.23):

\hat{\boldsymbol{\Omega}} = (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}})^{-1} \bigl(\hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_E(\hat{\boldsymbol{\sigma}})\, \hat{\boldsymbol{\Gamma}}^{\mathrm{clus}}\mathbf{A}_E(\hat{\boldsymbol{\sigma}})\hat{\boldsymbol{\Delta}}\bigr) (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\hat{\boldsymbol{\sigma}}) \hat{\boldsymbol{\Delta}})^{-1}.

The option se = "robust.cluster.sem" is available for continuous data and for categorical (and mixed) data, where it relies on the categorical cluster-corrected \hat{\boldsymbol{\Gamma}}^{\mathrm{clus}} described in Section 8.3. In fact, when clustered categorical data are analyzed with the DWLS or ULS estimators (e.g., WLSMV or ULSMV), this is the default, mirroring TYPE = COMPLEX in Mplus.

The Demo.twolevel dataset contains clustered observations. In the example below, a one-factor CFA model is fitted using a conventional single-level analysis. Although the point estimates ignore the clustering structure, valid standard errors are obtained by specifying se = "robust.cluster.sem":

model_clus <- ' f =~ y1 + y2 + y3 + y4 '
fit_clus <- cfa(model_clus, data = Demo.twolevel, cluster = "cluster",
                se = "robust.cluster.sem")

8.4.8 se = “robust.huber.white”

The option se = "robust.huber.white" (or its alias se = "sandwich") implements the Huber–White sandwich estimator (Huber, 1967; White, 1980). In this approach, the meat of the sandwich is estimated directly from the casewise score vectors:

\hat{\boldsymbol{\Omega}} = \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1}\,\mathbf{B}(\hat{\boldsymbol{\vartheta}})\,\mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1}, \tag{8.28}

where \mathbf{B}(\hat{\boldsymbol{\vartheta}}) denotes the first-order information matrix defined in Equation 8.7. The same construction appears under other names in other literatures: in the theory of estimating equations and composite likelihoods, the inverse of Equation 8.28, \mathbf{A}\,\mathbf{B}^{-1}\mathbf{A}, is called the Godambe information (Godambe, 1960; Varin et al., 2011), and the sandwich itself the inverse Godambe information. We use the Huber–White name throughout, also for the pairwise maximum likelihood estimator of chapter 14, for which the sandwich is the only valid choice. Compared to se = "robust.sem", this approach is more flexible and can naturally accommodate incomplete data. However, it is only available for a limited set of estimators:

  • estimator = "ML" for continuous but nonnormal data;

  • estimator = "ML" for continuous incomplete data when missing = "ml" is used;

  • estimator = "PML" for categorical data.

The method can also be used when the data are both nonnormal and incomplete under maximum likelihood estimation. In contrast, se = "robust.huber.white" is not available for WLS-type estimators, including ULS, WLS, GLS, DWLS, and DLS. By default, the bread is based on the observed information matrix computed from the full Hessian, whereas the meat uses the structured first-order information matrix:

\hat{\boldsymbol{\Omega}} = \mathbf{A}_O(\hat{\boldsymbol{\vartheta}})^{-1}\,\mathbf{B}_{\mathrm{str}}(\hat{\boldsymbol{\vartheta}})\,\mathbf{A}_O(\hat{\boldsymbol{\vartheta}})^{-1}. \tag{8.29}

All options listed in Table 8.4 for the choice of \mathbf{A}(\hat{\boldsymbol{\vartheta}}) are also available here. In addition, the h1_information_meat argument can be used to control the form of the meat independently of the bread. This argument accepts either "structured" (the default) or "unstructured". Two further options, the choice of the bread independently of the meat (information_bread) and the small-sample corrections of the meat (information_meat_hc), apply to both sandwich estimators and are described in Section 8.4.9.

To request Huber–White standard errors explicitly:

fit_hw <- cfa(model, data = HolzingerSwineford1939,
              se = "robust.huber.white")

To request Huber–White standard errors with an unstructured meat while retaining a structured bread:

fit_hw <- cfa(model, data = HolzingerSwineford1939,
              se = "robust.huber.white",
              h1_information_meat = "unstructured")

When the data are complete, the options se = "robust.sem" and se = "robust.huber.white" yield identical standard errors if both are combined with information = "expected" and h1_information = "unstructured". Furthermore, when the mean structure is saturated (that is, \hat{\boldsymbol{\mu}}= \bar{\mathbf{y}}), the two approaches also coincide when information = "expected" and h1_information = "structured" (Savalei & Rosseel, 2022).

8.4.9 The bread, the meat, and small-sample corrections

Two options apply to both sandwich estimators, se = "robust.sem" and se = "robust.huber.white", and are described here once.

The information_bread option selects the information matrix of the bread independently of the meat. Setting information_bread = "expected" or "observed" bases the outer matrices \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1} on that information type, while the ingredients of the meat stay based on the (first element of the) information option. The default ("default") reuses that same information type, with one exception: for categorical data (single-level or two-level) estimated with DWLS or ULS and se = "robust.sem" (e.g., WLSMV or ULSMV), "default" resolves to "observed", following Lai and Simoes (2023) (see Section 14.5.6); earlier versions used the expected information here. Whenever the bread deviates from the information option, summary() reports it on a separate Information bread line. Many combinations of bread and meat are thus possible, although only a subset has been studied in the SEM literature.

The information_meat_hc option provides small-sample corrections of the meat. Both sandwich estimators share the same structure. Writing \mathbf{a}_i for the contribution of case i to the estimating function, the meat is the average outer product N^{-1}\sum_i \mathbf{a}_i\mathbf{a}_i^{\prime}: for se = "robust.huber.white", \mathbf{a}_i is the casewise score vector that builds the first-order information of Equation 8.7; for se = "robust.sem", \mathbf{a}_i = \hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_E(\hat{\boldsymbol{\sigma}})\,\mathbf{z}_i, where \mathbf{z}_i is the centered casewise moment contribution whose average outer product is the ADF estimator \hat{\boldsymbol{\Gamma}} of Equation 8.16. With the casewise influence vectors \mathbf{u}_i = \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1}\mathbf{a}_i, the sandwich becomes

\hat{\boldsymbol{\Omega}} = \frac{1}{N}\sum_{i=1}^{N} \mathbf{u}_i\mathbf{u}_i^{\prime}. \tag{8.30}

This is the SEM analogue of the HC0 estimator of a regression model (White, 1980), and it inherits its downward bias in small samples (Long & Ervin, 2000; MacKinnon & White, 1985). The corrections mirror the regression ones. "HC0", the default, applies no correction. "HC1" applies a global degrees-of-freedom factor,

\hat{\boldsymbol{\Omega}}_{\mathrm{HC1}} = \frac{N}{N - T}\,\hat{\boldsymbol{\Omega}}, \tag{8.31}

with T the number of free parameters (minus the number of explicit equality constraints); this is the only correction that also reaches parameters that are not regression coefficients. "HC2" and "HC3" apply a leverage adjustment per regression equation. For every endogenous variable of the model (every variable with ~ rows), let \mathbf{Z}_j be the N \times (q_j + 1) design matrix of equation j, with a column of ones and the casewise values of its q_j predictors, and let

h_{ij} = \bigl[\mathbf{Z}_j(\mathbf{Z}_j^{\prime}\mathbf{Z}_j)^{-1}\mathbf{Z}_j^{\prime}\bigr]_{ii} \tag{8.32}

be the leverage of case i in that equation. The elements of \mathbf{u}_i that belong to the regression coefficients of equation j (its slopes and its intercept) are multiplied by w_{ij} = (1 - h_{ij})^{-1/2} for "HC2" and by w_{ij} = (1 - h_{ij})^{-1} for "HC3"; all other elements (loadings, variances, covariances) are left unchanged. Writing \mathbf{u}_i^{\ast} for the rescaled vector,

\hat{\boldsymbol{\Omega}}_{\mathrm{HC}} = \frac{1}{N}\sum_{i=1}^{N} \mathbf{u}_i^{\ast}\mathbf{u}_i^{\ast\prime}. \tag{8.33}

Observed predictors are taken from the data; latent predictors are replaced by their Bartlett factor scores (Section 13.2.3). For an observed-variable regression with fixed_x = TRUE, "HC2" and "HC3" reproduce the classic regression estimators exactly, while "HC1" differs slightly because T also counts the residual variance of the equation. The following chunk verifies "HC3" against the textbook formula built from the hat values of lm():

fit_reg <- sem('x1 ~ x2 + x3', data = HolzingerSwineford1939,
               fixed_x = TRUE, meanstructure = TRUE,
               se = "robust.huber.white", information_meat_hc = "HC3")
lm_fit <- lm(x1 ~ x2 + x3, data = HolzingerSwineford1939)
X <- model.matrix(lm_fit); e <- resid(lm_fit); h <- hatvalues(lm_fit)
XtX_inv <- solve(crossprod(X))
V_hc3 <- XtX_inv %*% crossprod(X * (e / (1 - h))) %*% XtX_inv
cbind(lavaan = sqrt(diag(vcov(fit_reg)))[c("x1~1", "x1~x2", "x1~x3")],
      manual = sqrt(diag(V_hc3)))
          lavaan     manual
x1~1  0.33511143 0.33511143
x1~x2 0.05491227 0.05491227
x1~x3 0.05506557 0.05506557

The corrections are available for single-level data only (not with cluster= or level: blocks); with se = "robust.sem", they further require continuous, complete, unweighted raw data, since the casewise moment contributions must be recomputed (se = "robust.huber.white" covers incomplete data). Whenever a correction other than "HC0" is in force, summary() reports it on a line Information meat small-sample correction. The same option applies to the local and two-step Huber–White standard errors of sam() (Section 18.7), where the count T of "HC1" is the number of free structural parameters, with one exception: when a lambda truncation engaged in a measurement block (Section 18.9.1), the local sandwich already overcovers, and a further correction would make it worse; "HC0" is then used, the requested value stays in the options, and the summary header marks the correction as not applied.

8.4.10 se = “robust.cluster”

This option provides an alternative to se = "robust.cluster.sem" (see Section 8.4.7) and is intended for the same setting: clustered data analyzed without fitting an explicit multilevel model.

The computations for se = "robust.cluster" are analogous to those used by se = "robust.huber.white", except that a cluster-adjusted version of the meat matrix \mathbf{B}(\hat{\boldsymbol{\vartheta}}) is employed to account for the dependency structure induced by clustering:

\hat{\boldsymbol{\Omega}} = \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1}\,\mathbf{B}^{\mathrm{clus}}(\hat{\boldsymbol{\vartheta}})\,\mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1}. \tag{8.34}

The option se = "robust.cluster" is available for ML estimation, either with complete data or in combination with missing = "ml". It is also available for PML estimation with categorical data, where it is the default whenever a cluster= argument is provided:

model_clus <- ' f =~ y1 + y2 + y3 + y4 '
fit_clus <- cfa(model_clus, data = Demo.twolevel, cluster = "cluster",
                se = "robust.cluster", missing = "ml")

8.4.11 se = “two.stage” and se = “robust.two.stage”

In the two-stage approach for handling missing data, the EM algorithm is first used to obtain unrestricted ML estimates of the mean vector and covariance matrix from the incomplete data (see appendix D.9.7). In the second stage, these estimated sample statistics are treated as input for a conventional complete-data ML analysis. Because the sample statistics themselves are estimated from incomplete data, the standard errors of the model parameters must account for this two-stage procedure.

lavaan provides two dedicated standard error options for this setting: se = "two.stage" and se = "robust.two.stage". The former is automatically used when missing = "two.stage", whereas the latter corresponds to missing = "robust.two.stage". Both approaches rely on a sandwich-type estimator, but the meat matrix explicitly incorporates the structure of the missing data patterns (Savalei & Bentler, 2009; Savalei & Falk, 2014).

The option se = "two.stage" is intended for normally distributed incomplete data. It is closely related to se = "robust.sem.nt", except that \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} is replaced by the incomplete-data model-based normal-theory estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD,NT}} (see Equation 8.22). By default, the observed information matrix is used in the bread:

\hat{\boldsymbol{\Omega}} = (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_O(\mathbf{s}) \hat{\boldsymbol{\Delta}})^{-1} \bigl(\hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_O(\mathbf{s})\, \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD,NT}}\mathbf{A}_O(\mathbf{s})\hat{\boldsymbol{\Delta}}\bigr) (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_O(\mathbf{s}) \hat{\boldsymbol{\Delta}})^{-1}.

The sample statistics appearing in \mathbf{A}_O(\mathbf{s}) correspond to the unrestricted ML estimates of the mean vector and covariance matrix obtained from the EM algorithm.

The second option, se = "robust.two.stage", additionally accounts for nonnormality. It is analogous to se = "robust.sem", but replaces \hat{\boldsymbol{\Gamma}} by its incomplete-data model-based counterpart \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}} (see Equation 8.21):

\hat{\boldsymbol{\Omega}} = (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_O(\mathbf{s}) \hat{\boldsymbol{\Delta}})^{-1} \bigl(\hat{\boldsymbol{\Delta}}^{\prime}\mathbf{A}_O(\mathbf{s})\, \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}}\mathbf{A}_O(\mathbf{s})\hat{\boldsymbol{\Delta}}\bigr) (\hat{\boldsymbol{\Delta}}^{\prime} \mathbf{A}_O(\mathbf{s}) \hat{\boldsymbol{\Delta}})^{-1}.

In lavaan, these two-stage standard errors are selected automatically when using the missing = "two.stage" or missing = "robust.two.stage" options:

fit_ts  <- sem(model, data = dat_missing, missing = "two.stage")
fit_rts <- sem(model, data = dat_missing, missing = "robust.two.stage")

Both options work with sampling weights: the EM moments, the pattern statistics, and the stage-1 covariance matrix are then weighted. Because the plain stage-1 matrix I_1^{-1} ignores the variability of the weights, missing = "two.stage" is silently treated as "robust.two.stage" whenever sampling weights are present, so that the sandwich form is used; the point estimates are the same either way.

The continuous-data least squares estimators (WLS, DWLS, ULS, GLS, and DLS) have no dedicated two-stage machinery. With missing = "two.stage" or "robust.two.stage", the asymptotic covariance matrix of the EM moments provides both the weight matrix of the estimator (for DWLS, its diagonal) and the \hat{\boldsymbol{\Gamma}} of the ordinary robust.sem sandwich of Section 8.4.4, and the test statistic is the Satorra–Bentler scaled test. With sampling weights, "robust.two.stage" is again the better choice, for the same reason.

8.4.12 Bootstrap based standard errors

Bootstrap standard errors mimic the idea that the model could be refit on many independent datasets drawn from the same population, and use the empirical variability of the parameter estimates across those refits as the standard error (Efron, 1979; Efron & Tibshirani, 1993). Since collecting new samples is rarely feasible, the bootstrap generates pseudo-samples from the data itself: a single bootstrap sample is obtained by randomly drawing N rows from the original dataset with replacement. Refitting the model on this bootstrap sample yields one set of bootstrap parameter estimates; repeating the procedure R times (typically R = 1000 or more) gives an R \times T matrix of bootstrap estimates. The bootstrap standard error of a free parameter is the standard deviation of the corresponding column; the asymptotic covariance matrix of the parameters is estimated by the columnwise sample covariance matrix of the bootstrap estimates. A worked-out implementation in plain R is given in section 4.1 of Rosseel and Vidal (2025).

The advantage of the bootstrap is that it requires no distributional or asymptotic assumptions and applies to any estimator: it can be used regardless of whether the data are normal, and it readily delivers standard errors for user-defined parameters (see below). The trade-off is computational: every bootstrap sample requires a full re-estimation of the model (approximations that avoid most of these refits are discussed in Section 8.4.13).

Bootstrap standard errors can be obtained as follows:

fit_boot <- cfa(model, data = HolzingerSwineford1939,
                se = "bootstrap", bootstrap = 1000L)

In addition to a single integer specifying the number of bootstrap replications, the bootstrap= argument also accepts a named list with several options that control the resampling procedure:

  • R: the number of bootstrap replications (default 1000L);
  • method: "refit" (the default) refits the model for every bootstrap sample; "ij" and "hoij2" approximate the bootstrap estimates without refitting, with guard and guard_tol as further settings of "hoij2" (see Section 8.4.13);
  • iseed: an integer seed used to make the bootstrap reproducible: with the same iseed, and the same settings for parallel and ncpus, the same replications are drawn. A serial run and a parallel run with the same iseed do not give the same replications, and neither do two parallel runs with a different number of cores (the seeding mechanism itself is implementation detail; see the reproducibility discussion in the simulation chapter, Section 19.10);
  • parallel: one of "no" (the default), "multicore" (forking, not available on Windows), or "snow" (cluster-based);
  • ncpus: the number of CPU cores to use when parallel != "no". The default is two (or fewer, when fewer cores are available);
  • cl: an optional cluster object created by parallel::makeCluster(). When supplied, lavaan uses this cluster directly instead of creating one internally; this allows the user to reuse a cluster across multiple bootstrap calls.

For example, to run 5000 bootstrap replications in parallel on 8 cores with a fixed seed:

fit_boot <- cfa(model, data = HolzingerSwineford1939, se = "bootstrap",
                bootstrap = list(R = 5000L, iseed = 1234,
                                 parallel = "snow", ncpus = 8L))

In the fitted object, the bootstrap option is always stored as a single number, the number of replications, so that lavInspect(fit, "options")$bootstrap can be used as a number whatever form the argument had. The settings method, guard and guard_tol are stored in a separate option, bootstrap_args, and they can also be given through that option directly (bootstrap = 1000L, bootstrap_args = list(method = "ij")).

Replications that fail to converge yield rows of NA in the R \times T bootstrap matrix and are dropped before standard errors are computed; the matrix itself is accessible via lavInspect(fit, "coef_boot"). Replications that converge to inadmissible solutions are not dropped, but their count is reported in a warning.

lavaan also warns when the standard deviation of the bootstrap distribution of a (free or defined) parameter exceeds 5 times its median absolute deviation, since this typically signals heavy-tailed behavior for which a Wald-type SE is unreliable; in such cases the percentile or BCa bootstrap confidence interval is preferred:

parameterEstimates(fit_boot, boot_ci_type = "perc")
parameterEstimates(fit_boot, boot_ci_type = "bca")

For test statistics, the related Bollen–Stine bootstrap (Bollen & Stine, 1992) adjusts the bootstrap so that it samples from a population in which the hypothesized model holds; see Section 8.5. If the Bollen-Stine bootstrap is requested, it is also used to obtain the bootstrap-based standard errors.

8.4.13 Approximate bootstrap methods

Refitting the model for every bootstrap sample can take a long time for large models or large samples. Two approximations avoid most of the refits. Both rest on the same observation: a bootstrap sample is equivalent to giving every case a weight (the number of times the case was drawn; the weights follow a multinomial distribution and sum to N), and the estimates are a smooth function of these weights. The original estimates \hat{\boldsymbol{\vartheta}} correspond to unit weights, and the bootstrap estimates can be approximated by a Taylor expansion of this function around the unit weights (Giordano, Stephenson, et al., 2019). The approximations are requested with the method element of the bootstrap list:

  • method = "ij" is the infinitesimal jackknife (IJ), the first-order expansion. It only needs the casewise scores and the observed information matrix of the original fit, and its cost is negligible. The covariance matrix of the IJ draws equals, up to Monte Carlo error, the Huber–White sandwich covariance matrix of Section 8.4.8 (the cluster-robust version when whole clusters are resampled), so the standard errors provide no new information. The draws are useful for percentile-type confidence intervals of nonlinear functions of the parameters, such as indirect effects or standardized parameters. Because the approximation is linear in the weights, it cannot capture skewness that is due to the estimator itself (for example, for variance parameters in small samples).

  • method = "hoij2" adds the second-order term of the expansion, the second-order infinitesimal jackknife (Giordano, Jordan, et al., 2019). This term accounts for the change in the curvature of the objective function, due to the reweighting of the cases and to the change in the parameter values, so that the draws can also reflect the skewness of the estimator. It needs four evaluations of the gradient per bootstrap sample, which is still far cheaper than a refit. The approximation is local (quadratic): it is usually closer to the refitted estimates than IJ for typical bootstrap samples, but it can be less accurate for the most extreme ones, and those determine the limits of percentile-type confidence intervals.

For this reason, "hoij2" comes with a guard (guard = TRUE, the default). For every bootstrap sample, the gradient of the objective function is evaluated at the approximate draw, using the sample statistics of that bootstrap sample; for an exact draw, this gradient is zero. The size of the gradient is converted to an estimate of the distance between the draw and the exact solution, in standard error units (the root mean square over the parameters). If the distance exceeds guard_tol (default 0.25), the model is refitted for that bootstrap sample, and the refitted estimates replace the approximate draw. In large samples and for well-behaved models, hardly any bootstrap sample needs a refit; in small samples, or when the model is weakly identified, many do, and the gain in speed shrinks (a note is given when more than half of the samples are refitted). The guard is not perfect: the distance is itself an estimate, and a few inaccurate draws may go undetected.

The draws are stored in the same way as refitted draws, so everything that is based on them works unchanged: the standard errors, the bootstrap confidence intervals of parameterEstimates() and standardizedSolution() (including those of defined parameters), and lavInspect(fit, "coef_boot"). With the same iseed (and no parallelization), the three methods use the same bootstrap samples, which makes a direct comparison possible. As an illustration, consider the indirect effect in a small mediation model for the Holzinger–Swineford data:

model_ind <- ' visual  =~ x1 + x2 + x3
               textual =~ x4 + x5 + x6
               speed   =~ x7 + x8 + x9
               speed  ~ a*textual
               visual ~ b*speed + c*textual
               ab := a*b '
ci_ab <- sapply(c("refit", "ij", "hoij2"), function(method) {
  fit_b <- sem(model_ind, data = HolzingerSwineford1939, se = "bootstrap",
               bootstrap = list(R = 1000L, method = method), iseed = 1234)
  pe <- parameterEstimates(fit_b, boot_ci_type = "perc")
  unlist(pe[pe$label == "ab", c("est", "se", "ci.lower", "ci.upper")])
})
round(t(ci_ab), 3)
        est    se ci.lower ci.upper
refit 0.095 0.046    0.025    0.205
ij    0.095 0.050    0.019    0.213
hoij2 0.095 0.046    0.024    0.203

The second-order draws reproduce the refit bootstrap closely, while the first-order draws give the (somewhat larger) sandwich standard error and a somewhat wider interval. With only 301 cases, the guard is often triggered in this example: about a third of the bootstrap samples are refitted. The summary() output reports the approximation that was used and the number of refitted draws in the header of the parameter estimates, and the details are attached to the matrix of draws: the "guard" attribute holds the indices of the refitted draws (refit.idx), and the "dist" attribute the estimated distances.

The approximations are more limited in scope than the refit bootstrap. In version 0.7-4, they are available for the ordinary (nonparametric) bootstrap of the parameter estimates only, in single-level models, and for two families of estimators:

  • ML with continuous data, complete or incomplete (missing = "ml"), possibly with multiple groups, sampling weights, (linear or nonlinear) equality constraints, and clustered data (whole clusters are resampled, as for method = "refit").

  • DWLS and ULS (including "WLSMV" and "ULSMV") with complete continuous or categorical data, but without exogenous covariates or sampling weights. For these estimators, the estimates are a function of the sample statistics (means and covariances, or thresholds and polychoric correlations) and of a weight matrix, and the approximation works in two stages. The sample statistics of a bootstrap sample are approximated to first order, from the casewise influence values of the statistics (the polychoric correlations are not recomputed), with the weight matrix kept fixed (which is exact for ULS); the change in the parameters then follows from the change in the statistics by a first- or second-order expansion. Here "hoij2" is not a complete second-order expansion: it captures the nonlinearity of the model (the largest source of error), but not that of the sample statistics, and the guard only checks the second stage. It cannot detect that the approximate statistics themselves are inaccurate for a bootstrap sample, for example when a response category is almost empty.

Models with rotated EFA blocks, models with conditional_x = TRUE, and the Bollen–Stine bootstrap are not covered; in all such cases, an error message points to method = "refit".

Bounds and linear inequality constraints are allowed for "hoij2". Those that are active in the original solution are treated as equality constraints, so the approximate draws stay on the boundary. This is not what happens in every bootstrap sample (in some, the solution leaves the boundary; in others, an inactive bound becomes active), and no Taylor expansion can describe these transitions. The guard therefore also refits every bootstrap sample in which the approximate draw violates a bound or an inequality constraint, or in which the Lagrange multiplier of an active one changes sign (their indices are in the bound.idx element of the "guard" attribute). With an active bound, a substantial fraction of the samples is typically refitted, and without the guard, bounds and inequality constraints should not be combined with "hoij2". Nonlinear inequality constraints are not supported.

The choice of method depends on the setting. The refit bootstrap is the reference: use it whenever the computing time is acceptable, and always in small samples or for weakly identified models. The infinitesimal jackknife has a negligible cost, and its main use is a percentile-type interval for a nonlinear function of the parameters in larger samples. The guarded second-order version is meant to replace the refit bootstrap when the latter is too slow: in larger samples almost no refits are needed, and in smaller samples the guard falls back on refitting where needed.

BCa intervals (boot_ci_type = "bca") need an acceleration constant for every parameter. For refitted draws, it is estimated from a regression of the bootstrap estimates on the bootstrap frequencies of the cases, which needs more successful draws than cases, no sampling weights, and no clustered data. When these conditions are not met, or when the draws were approximated, the acceleration constants are computed from the infinitesimal jackknife influence values instead (the casewise scores, premultiplied by the inverse of the observed information matrix; the influence values of the clusters for clustered data), within the scope listed above.

8.4.14 Standard errors for defined parameters

When the model syntax includes user-defined parameters (using the := operator), each defined parameter is a (possibly nonlinear) function of the free model parameters \boldsymbol{\vartheta}. Collect the D defined parameters into a vector \boldsymbol{\phi} = \mathbf{f}(\boldsymbol{\vartheta}), where \mathbf{f}: \mathbb{R}^{T} \to \mathbb{R}^{D} is built up at parsing time from the right-hand sides of the := lines, and stored as a function inside the fitted object. The point estimate of \boldsymbol{\phi} is obtained by plugging in: \hat{\boldsymbol{\phi}} = \mathbf{f}(\hat{\boldsymbol{\vartheta}}).

For analytic standard errors, the default approach is the (first-order) delta method (Boos & Stefanski, 2013), which approximates the asymptotic covariance matrix of \hat{\boldsymbol{\phi}} by

\widehat{\mathrm{Var}}(\hat{\boldsymbol{\phi}}) = \mathbf{J}(\hat{\boldsymbol{\vartheta}})\, \widehat{\mathrm{Var}}(\hat{\boldsymbol{\vartheta}})\, \mathbf{J}(\hat{\boldsymbol{\vartheta}})^{\prime}, \tag{8.35}

where \mathbf{J}(\boldsymbol{\vartheta}) = \partial \mathbf{f}(\boldsymbol{\vartheta})/\partial \boldsymbol{\vartheta}^{\prime} is the D \times T Jacobian of \mathbf{f}(\boldsymbol{\vartheta}).

If simple equality constraints have been absorbed into a reduced (“compact”) parameter vector, the Jacobian is computed directly in that reduced space, and \widehat{\mathrm{Var}}(\hat{\boldsymbol{\vartheta}}) is reduced to the same space before Equation 8.35 is applied.

The first-order delta method is exact when \mathbf{f} is a linear function of \boldsymbol{\vartheta} (e.g., sums or differences of free parameters). For nonlinear definitions (e.g., the product a*b of two coefficients in an indirect effect), Equation 8.35 is only a linear approximation, and the implied symmetric (Wald-type) confidence intervals can be inaccurate; the sampling distribution of a product, for instance, is typically skewed. For this reason, the summary() output prints a note whenever the standard errors of nonlinear defined parameters are based on the first-order delta method, suggesting the alternatives discussed below.

Setting the option se_delta_second_order = TRUE (default: FALSE) replaces the first-order delta method by its second-order refinement. Writing \mathbf{H}_i for the Hessian of the i-th defined parameter and \mathbf{V} = \widehat{\mathrm{Var}}(\hat{\boldsymbol{\vartheta}}), the covariance approximation becomes

\widehat{\mathrm{Cov}}(\hat{\phi}_i, \hat{\phi}_j) = \mathbf{J}_i\,\mathbf{V}\,\mathbf{J}_j^{\prime} + \tfrac{1}{2}\, \mathrm{tr}\bigl[\mathbf{H}_i\,\mathbf{V}\,\mathbf{H}_j\,\mathbf{V}\bigr], \tag{8.36}

where \mathbf{J}_i is the i-th row of \mathbf{J}(\hat{\boldsymbol{\vartheta}}). The extra term captures the curvature of \mathbf{f} and may improve the accuracy of the standard errors when the definition is strongly nonlinear. The resulting confidence intervals are still symmetric, however. The same option also affects the standard errors of standardized parameters (see Section 12.2). It has no effect when the standard errors are obtained by bootstrapping or by the Monte Carlo method.

Setting the option se_def = "mc" (or "monte.carlo"; default: "default", i.e., the delta method) activates the Monte Carlo method, a parametric bootstrap of the parameter estimates that was introduced for indirect effects by MacKinnon et al. (2004) and advocated by Preacher and Selig (2012). Here, R draws \hat{\boldsymbol{\vartheta}}^{(r)} are taken from \mathcal{N}(\hat{\boldsymbol{\vartheta}}, \widehat{\mathrm{Var}}(\hat{\boldsymbol{\vartheta}})), and the defined parameters are evaluated for each draw: \hat{\boldsymbol{\phi}}^{(r)} = \mathbf{f}(\hat{\boldsymbol{\vartheta}}^{(r)}). The standard error of \hat{\phi}_d is the standard deviation of the R realizations, while the confidence intervals reported by parameterEstimates() are based on percentile bounds of the Monte Carlo distribution and can therefore be asymmetric, like bootstrap percentile intervals, but without refitting the model R times. The Monte Carlo settings are controlled by the monte_carlo= argument, a named list with elements R (the number of draws; default 20000L) and seed (an optional integer seed for reproducibility):

model_ind <- ' visual =~ x1 + a*x2 + b*x3
               ab := a*b '
fit_mc <- cfa(model_ind, data = HolzingerSwineford1939,
              se_def = "mc", monte_carlo = list(R = 20000L, seed = 1234))

The option se_def only affects the defined (:=) parameters; the standard errors of the free parameters are unaffected. It is ignored when se = "bootstrap".

When se = "bootstrap", no analytic Jacobian is needed: the function \mathbf{f} is applied to every bootstrap draw \hat{\boldsymbol{\vartheta}}^{(b)}, yielding \hat{\boldsymbol{\phi}}^{(b)} = \mathbf{f}(\hat{\boldsymbol{\vartheta}}^{(b)}) for b = 1, \ldots, R. The standard error of \hat{\phi}_d is then the sample standard deviation of the column \{\hat{\phi}_d^{(b)}\}_{b=1}^{R}, and \widehat{\mathrm{Var}}(\hat{\boldsymbol{\phi}}) is the R-replication sample covariance matrix of \hat{\boldsymbol{\phi}}^{(b)}.

8.4.15 Effect decompositions with lavEffects()

The canonical application of defined parameters is mediation analysis (see Section 2.4.1): the indirect effect of x on y through a mediator m is the product a*b of two regression coefficients, and the total effect adds the direct path. For a single mediator this takes two := lines. But in a realistic structural model, with several mediators, chains of mediators, and multiple outcomes, the number of total and indirect effects grows quickly, each one is a hand-written product or sum of products, and the whole set must be rewritten whenever a path is added or removed. The function lavEffects() computes the complete decomposition automatically from a fitted object, with no := lines in the syntax.

The computation is the classic (LISREL-style) effect decomposition. Collect the structural regressions among the (latent and/or observed) variables in the matrix \mathbf{B} of Section 4.1. Then

\underbrace{\mathbf{B}}_{\text{direct}}, \qquad \underbrace{(\mathbf{I} - \mathbf{B})^{-1}- \mathbf{I}}_{\text{total}}, \qquad \underbrace{(\mathbf{I} - \mathbf{B})^{-1}- \mathbf{I} - \mathbf{B}}_{\text{indirect}}, \tag{8.37}

which is easiest to read through the series expansion (\mathbf{I} - \mathbf{B})^{-1}= \mathbf{I} + \mathbf{B}+ \mathbf{B}^2 + \mathbf{B}^3 + \cdots: the term \mathbf{B}^k collects the products of coefficients along all directed paths of length k, so the total effect sums the contributions of paths of every length, and the indirect effect is what remains after removing the direct path (length one). Only structurally connected pairs are reported: a total effect requires at least one directed path from the predictor to the outcome, an indirect effect a path of length two or more. (When conditional_x = TRUE, the same decomposition is applied to the system augmented with the \boldsymbol{\Gamma} columns of the exogenous covariates.)

As an illustration, consider the classic Political Democracy model, where the effect of industrialization in 1960 on democracy in 1965 is partly mediated by democracy in 1960. We manually compute the indirect effect with := once, for reference:

model_med <- '
  ind60 =~ x1 + x2 + x3
  dem60 =~ y1 + y2 + y3 + y4
  dem65 =~ y5 + y6 + y7 + y8
  dem60 ~ a*ind60
  dem65 ~ b*dem60 + c*ind60
  ab := a*b
'
fit_med <- sem(model_med, data = PoliticalDemocracy,
               monte_carlo = list(R = 20000L, seed = 1234))
pe <- parameterEstimates(fit_med)
pe[pe$op == ":=", ]
   lhs op rhs label   est    se     z pvalue ci.lower ci.upper
29  ab := a*b    ab 1.274 0.359 3.551      0    0.571    1.977

and then let lavEffects() derive all the effects at once:

lavEffects(fit_med)
Effects:

  Standard errors                      Monte Carlo
  Monte Carlo draws                          20000
  Confidence level                            0.95

Total Effects:
                  Estimate  Std.Err  z-value  P(>|z|) ci_lower ci_upper
    dem60 ~ ind60    1.474    0.394    3.739    0.000    0.687    2.241
    dem65 ~ ind60    1.727    0.374    4.615    0.000    1.006    2.483
    dem65 ~ dem60    0.864    0.112    7.715    0.000    0.646    1.084

Indirect Effects:
                  Estimate  Std.Err  z-value  P(>|z|) ci_lower ci_upper
    dem65 ~ ind60    1.274    0.364    3.503    0.000    0.584    2.021

The indirect effect dem65 ~ ind60 reproduces the hand-defined ab (the two routes are algebraically identical), but the labels, the := line, and the risk of typing a*c instead of a*b are avoided. By default the total and indirect effects are reported; adding effects = "direct" (or effects = c("total", "indirect", "direct")) completes the decomposition.

For the standard errors and confidence intervals, lavEffects() reuses exactly the methods of Section 8.4.14, selected by its se_def argument: "delta" for the first-order delta method (Equation 8.35), "monte.carlo" for the Monte Carlo method, and "bootstrap" to re-evaluate the effects on the bootstrap draws stored in the fitted object (available when the model was fitted with se = "bootstrap"; the boot_ci_type argument then selects the type of bootstrap interval, as in Section 8.4.12). When se_def is not specified, the default is not the delta method: bootstrap draws are used if they are available, and otherwise the Monte Carlo method is applied with R = 20{,}000 draws. This deliberately differs from the delta-method default for := parameters (which is kept for backward compatibility): effects are products of coefficients, exactly the case where the symmetric delta-method intervals are least trustworthy, so the asymmetric percentile-type intervals make the better default. The comparison for the example above:

eff_delta <- lavEffects(fit_med, se_def = "delta")
eff_delta[eff_delta$effect == "indirect", ]
Effects:

  Standard errors                            Delta
  Confidence level                            0.95

Indirect Effects:
                  Estimate  Std.Err  z-value  P(>|z|) ci_lower ci_upper
    dem65 ~ ind60    1.274    0.359    3.551    0.000    0.571    1.977

The delta-method interval is symmetric around the estimate; the Monte Carlo interval in the previous output is shifted to the right, tracking the skewness of the sampling distribution of the product. The Monte Carlo settings follow the same rules as for defined parameters: the monte_carlo argument takes a list with elements R and seed, and when it is omitted, the settings are inherited from the monte_carlo option of the fitted object, so a seed provided at fitting time (as above) makes the lavEffects() output reproducible as well.

Finally, standardized = TRUE appends standardized point estimates of the effects (std.lv, std.all, …), following the same conventions as parameterEstimates() (and, as there, without separate standard errors), and output = "list" returns the raw per-block matrices of Equation 8.37 instead of a formatted data frame, which is the convenient form for further programming.

8.5 Test statistics

In structural equation modeling, the chi-square test statistic occupies a central role. It provides the primary inferential framework for evaluating overall model fit by assessing the discrepancy between the observed sample statistics and those implied by the model. Because of its importance, a substantial body of methodological research has focused on improving the behavior and applicability of the chi-square test under conditions where the standard assumptions are violated. This has led to the development of a wide range of alternative test statistics and corrections, including robust versions for nonnormal and categorical data, and methods tailored to specific estimation procedures. In this section, we review the various test statistics available in lavaan and discuss the situations in which they are most appropriate.

8.5.1 Overview of test statistics

The test statistics implemented in lavaan can be grouped into the following broad families:

  1. The standard chi-square statistic (Section 8.5.2);

  2. The robust (scaled or adjusted) test statistics (Section 8.5.3);

  3. The residual-based test statistics (Section 8.5.10);

  4. The FMG family of test statistics (Section 8.5.11);

  5. The bootstrap-based test statistics (Section 8.5.12).

The test= argument controls which overall goodness-of-fit test statistic is computed. For example:

fit_ml <- cfa(model, data = HolzingerSwineford1939, test = "satorra.bentler")

Multiple test values can be requested simultaneously as a vector:

fit_ml <- cfa(model, data = HolzingerSwineford1939,
              test = c("satorra.bentler", "browne.residual.adf"))

Table 8.5 lists all valid values.

Table 8.5: Overview of the test= argument options in lavaan.
test= Description When to use
"standard" Standard chi-square test Default for ML (together with a Browne residual-based test; see below), GLS, and WLS; normality assumed for ML and GLS only
"satorra.bentler" Satorra-Bentler mean-corrected chi-square Default for MLM and DLS with nonnormal continuous data; ULSM and WLSM with nonnormal continuous or categorical data; complete data only; clustered data
"yuan.bentler" Yuan-Bentler mean-corrected chi-square Nonnormal continuous data; complete or incomplete; clustered or multilevel data
"yuan.bentler.mplus" Yuan-Bentler as implemented in Mplus Default for MLR with nonnormal complete or incomplete continuous data; clustered or multilevel data
"mean.var.adjusted" Mean-and-variance adjusted chi-square (Satterthwaite’s correction with non-integer degrees of freedom) Default for MLMVS, ULSMVS, WLSMVS, and PML; corrects both mean and variance; complete data only
"scaled.shifted" Scaled-and-shifted chi-square; user-friendly version of Satterthwaite’s correction with integer-valued degrees of freedom Default for MLMV with nonnormal continuous data; ULSMV, WLSMV with nonnormal continuous or categorical data; complete data only
"mean.var.adjusted.corrected" Mean-and-variance adjusted chi-square with Hayakawa’s bias-corrected trace estimator Nonnormal continuous data with many variables relative to N; ML only; single-group, single-level, complete data; also for the structural test of local SAM (Section 18.8.1)
"scaled.shifted.corrected" Scaled-and-shifted chi-square with Hayakawa’s bias-corrected trace estimator As in the previous row, but with integer-valued degrees of freedom
"browne.residual.adf" Browne’s residual-based ADF test Nonnormal continuous data; complete or incomplete data; also for two-level ML models
"browne.residual.nt" Browne’s residual-based normal-theory (NT) test Default for IV, MGM, JS, ULS, and DWLS with normal continuous data; complete or incomplete data; computed by default alongside the standard test for estimator = "ML" with missing = "ml", single-level and two-level
"browne.residual.adf.model" Browne’s model-based residual ADF test Nonnormal continuous data; complete or incomplete data; also for two-level ML models
"browne.residual.nt.model" Browne’s model-based residual normal-theory (NT) test (also known as RLS) Normal continuous data; complete or incomplete data; computed by default alongside the standard test for estimator = "ML" with complete data, single-level and two-level
"fmg", "peba4", "pols2", … FMG family of penalized eigenvalue tests Nonnormal continuous data; ML estimation and complete data only; often superior to classic robust tests
"bollen.stine" Bollen-Stine bootstrap test Nonnormal continuous data; computationally demanding
"none" No test statistic computed When only parameter estimates are of interest

The values listed in the first column of Table 8.5 are the canonical names. To accommodate common variations, lavaan accepts a number of aliases for each of these canonical names. Internally, the user-supplied string is first converted to lower case (so capitalization never matters), and then mapped to the canonical name. For example, the four calls below all request the Satorra–Bentler scaled chi-square test:

fit <- cfa(model, data = HolzingerSwineford1939, test = "satorra.bentler")
fit <- cfa(model, data = HolzingerSwineford1939, test = "Satorra-Bentler")
fit <- cfa(model, data = HolzingerSwineford1939, test = "satorra")
fit <- cfa(model, data = HolzingerSwineford1939, test = "sb")

Table 8.6 lists all aliases that are currently recognized.

Table 8.6: Aliases for the test= argument recognized by lavaan. The comparison is case-insensitive, so e.g. "Satorra-Bentler" and "SB" are both mapped to "satorra.bentler".
Canonical name Aliases
"standard" "chisq", "chi", "chi-square", "chi.square"
"satorra.bentler" "satorra", "sb", "satorra-bentler", "m", "m.adjusted", "mean.adjusted", "mean-adjusted"
"yuan.bentler" "yuan", "yb", "yuan-bentler"
"yuan.bentler.mplus" "yuan-bentler.mplus", "yuan-bentler-mplus"
"mean.var.adjusted" "mean-var-adjusted", "mv", "mv.adjusted", "second.order", "satterthwaite"
"mean.var.adjusted.corrected" "mean-var-adjusted-corrected", "mv.adjusted.corrected", "mvc", "hayakawa"
"scaled.shifted" "scaled-shifted", "scale.shift", "mplus6"
"scaled.shifted.corrected" "scaled-shifted-corrected", "ssc"
"browne.residual.adf" "browne", "residual", "residuals", "residual-based", "residual.based", "browne.residual", "browne.residuals", "browne.residuals.adf"
"browne.residual.nt" "browne.residuals.nt", "browne.nt.residuals", "browne.nt.residual"
"browne.residual.adf.model" "browne.residuals.adf.model", "browne.residual.model.adf", "browne.residuals.model.adf"
"browne.residual.nt.model" "browne.residuals.nt.model", "rls", "browne.rls", "nt.rls", "nt-rls", "ntrls"
"bollen.stine" "bootstrap", "boot", "bollen-stine"

A note on notation: in what follows, X^2 denotes the value of a goodness-of-fit test statistic. We avoid the symbol T, as it is already used to denote the number of free parameters. The reference distribution is typically a central chi-square distribution, written as \chi^2(\mathrm{df}) for a chi-square distribution with \mathrm{df} degrees of freedom. Throughout this chapter, \mathrm{df} = P^{\star} - T, where P^{\star} denotes the number of free parameters in the unrestricted (\mathsf{H}_1) model (equivalently, the number of nonredundant elements in the moment vector \boldsymbol{\sigma}), and T denotes the number of free parameters in the target model (i.e., the length of \boldsymbol{\vartheta}), possibly adjusted for equality constraints. We also use the symbol d to denote the number of nonzero eigenvalues of the residual weight matrix \mathbf{U}\boldsymbol{\Gamma}. Although d = \mathrm{df} for regular models, it is useful to distinguish between the two quantities.

In addition to the test= argument, lavaan provides two related arguments:

  • standard_test: specifies the test statistic used when computing fit measures such as CFI or RMSEA. The default is "standard", but alternative choices are possible, including "browne.residual.nt" or an FMG test name such as "peba4".

  • scaled_test: specifies the test statistic to be scaled when a scaled test statistic is requested. The default is again "standard", although other choices are possible, such as "browne.residual.nt".

These options are particularly useful when a single fitted object should contain both unscaled and scaled versions of a test statistic, together with additional test variants. Alternatively, the lavTest() function (Section 8.5.13) can be used to compute additional test statistics from the fitted object without re-estimating the model.

8.5.2 The standard chi-square test

For the three discrepancy-function-based estimators ML, GLS, and WLS, the standard test statistic is obtained by multiplying the value of the discrepancy function, evaluated at the parameter estimates, by a constant (Satorra, 1989, eq. 2.1):

\begin{aligned} X^2_{\mathrm{ML}} &= N\, F_{\mathrm{ML}}(\hat{\boldsymbol{\vartheta}}),\\ X^2_{\mathrm{GLS}} &= (N- 1)\, F_{\mathrm{GLS}}(\hat{\boldsymbol{\vartheta}}),\\ X^2_{\mathrm{WLS}} &= (N- 1)\, F_{\mathrm{WLS}}(\hat{\boldsymbol{\vartheta}}). \end{aligned} \tag{8.38}

For ML estimation, the discrepancy function is equal to twice the log-likelihood difference between the structural model (\mathsf{H}_0) and the saturated model (\mathsf{H}_1), divided by N. As a result, X^2_{\mathrm{ML}} coincides with the usual likelihood ratio test statistic. The multiplier (N- 1) in X^2_{\mathrm{GLS}} and X^2_{\mathrm{WLS}} reflects the standard SEM convention of using the unbiased sample covariance matrix (\mathbf{S}_{N- 1}) in the discrepancy function for GLS and WLS estimation. The same multiplier is also used for ML when likelihood = "wishart" is specified. Under the usual regularity conditions, and assuming both the model and the distribution are correctly specified,

X^2 \;\xrightarrow{d}\; \chi^2(\mathrm{df}), \qquad \mathrm{df} = P^{\star} - T. \tag{8.39}

Equality constraints reduce the effective number of free parameters, and the degrees of freedom increase accordingly:

\mathrm{df} = P^{\star} - T+ q_{\text{eq}}, \tag{8.40}

where q_{\text{eq}} is the rank of the Jacobian of the equality constraints (computed via a QR factorization), so that redundant constraints (say, a == b, b == c and a == c) are counted only once. Nonlinear equality constraints contribute through the rank of their Jacobian at the solution. When ceq_simple = TRUE, no explicit constraint rows exist and lavaan counts the unique free parameters, which gives the same value. Inequality constraints, by contrast, never enter the degrees of freedom, not even when they are active at the solution. This is a deliberate convention: whether a bound is binding at the solution is a random event, and the reference distribution of the test statistic under boundary conditions is not a chi-square but a mixture of chi-squares (a so-called chi-bar-square distribution); lavaan reports the conventional df of the interior case and leaves boundary-corrected inference to the user.

The ML and GLS estimators rely on the assumption of multivariate normality, whereas the WLS estimator does not. The chi-square statistic and corresponding p-value are always included in the output of summary() and can also be extracted directly:

fitMeasures(fit_ml, c("chisq", "df", "pvalue"))
 chisq     df pvalue 
85.306 24.000  0.000 

The relationship between the chi-square statistic and the discrepancy function can be verified as follows:

N    <- nobs(fit_ml)
fmin <- fitMeasures(fit_ml, "fmin")
round(2 * N * fmin, 3)  # equals chisq for ML with likelihood = "normal"
  fmin 
85.306 

Recall that fmin equals one half of the discrepancy function value. Therefore, for ML estimation, the chi-square statistic is given by 2 N\cdot \mathrm{fmin}, whereas for GLS, WLS, or ML with likelihood = "wishart", the multiplier becomes 2(N- 1) \cdot \mathrm{fmin}. For ML estimation, the likelihood-ratio interpretation can also be verified directly from the log-likelihood values of the fitted and saturated models:

logl_h0 <- fitMeasures(fit_ml, "logl")
logl_h1 <- fitMeasures(fit_ml, "unrestricted_logl")
round(-2 * (logl_h0 - logl_h1), 3)
  logl 
85.306 

8.5.3 Robust test statistics

Under nonnormality, or more generally whenever the implicit or explicit weight matrix used in the discrepancy function is not a consistent estimator of \boldsymbol{\Gamma}^{-1}, the statistic X^2 no longer follows an asymptotic chi-square distribution, even if the model is correctly specified. Instead, its asymptotic distribution becomes a weighted sum of independent \chi^2(1) random variables (Satorra, 1989, eq. 4.4):

X^2 \;\xrightarrow{d}\; \sum_{k=1}^{d}\lambda_k\,\chi^2_k(1), \tag{8.41}

where the weights \lambda_k are the d nonzero eigenvalues of the P^{\star} \times P^{\star} matrix product \mathbf{U}\boldsymbol{\Gamma}, evaluated at the population parameter values. The matrix \mathbf{U} is a residual weight matrix of rank d, whose form depends on both the information matrix and the model Jacobian:

\mathbf{U} = \mathbf{A}(\boldsymbol{\sigma}) - \mathbf{A}(\boldsymbol{\sigma})\boldsymbol{\Delta} \bigl(\boldsymbol{\Delta}^{\prime}\mathbf{A}(\boldsymbol{\sigma})\boldsymbol{\Delta}\bigr)^{-1} \boldsymbol{\Delta}^{\prime}\mathbf{A}(\boldsymbol{\sigma}). \tag{8.42}

An alternative expression is

\mathbf{U} = \mathbf{A}(\boldsymbol{\sigma}) - \mathbf{A}(\boldsymbol{\sigma})\boldsymbol{\Delta} \mathbf{A}(\boldsymbol{\vartheta})^{-1} \boldsymbol{\Delta}^{\prime}\mathbf{A}(\boldsymbol{\sigma}). \tag{8.43}

This corresponds to Equation 8.42 if \mathbf{A}(\boldsymbol{\vartheta}) = \boldsymbol{\Delta}^{\prime}\mathbf{A}(\boldsymbol{\sigma})\boldsymbol{\Delta}.

For models with equality constraints (or active inequality constraints), Equation 8.43 is the form that remains valid, provided \mathbf{A}(\boldsymbol{\vartheta})^{-1} is replaced by the constrained inverse \mathbf{A}(\boldsymbol{\vartheta})^{-} of Equation 8.14: the projection \mathbf{A}(\boldsymbol{\sigma})\boldsymbol{\Delta}\,\mathbf{A}(\boldsymbol{\vartheta})^{-}\boldsymbol{\Delta}^{\prime} \mathbf{A}(\boldsymbol{\sigma}) must only remove the directions in which the constrained estimator can actually move. This is what lavaan does: the \mathbf{U} matrix underlying every scaled test statistic in this section is built from the same constrained inverse as the standard errors (Section 8.4.3). The effect is not minor: using the plain inverse would remove too much, understating \mathrm{tr}[\mathbf{U}\boldsymbol{\Gamma}], and hence the scaling factor c, and thereby overstating the scaled test statistic. Consistently, the rank d of \mathbf{U}\boldsymbol{\Gamma}, and thus the degrees of freedom of the scaled reference distribution, is the constrained df of Equation 8.40.

When the model is correctly specified and the weight matrix is consistent for \boldsymbol{\Gamma}^{-1} (as in ML estimation under multivariate normality), \mathbf{U}\boldsymbol{\Gamma} becomes an idempotent projection matrix of rank d. Consequently, all eigenvalues \lambda_k are equal to one, and Equation 8.41 reduces to a standard \chi^2(\mathrm{df}) distribution, recovering Equation 8.39. In all other cases, the \lambda_k differ from one, causing the unscaled X^2 statistic to deviate from its nominal reference distribution.

Robust test statistics address this problem in two main ways. Some methods approximate the mixture distribution in Equation 8.41 by a single rescaled chi-square distribution (Section 8.5.4, Section 8.5.6, Section 8.5.7, Section 8.5.5), whereas others approximate the mixture directly by combining the estimated eigenvalues \hat{\lambda}_k in a numerically stable manner (Section 8.5.11).

8.5.4 The mean-corrected statistic

The simplest correction (Bartlett, 1937) rescales X^2 by a constant c chosen such that the corrected statistic has the appropriate expected value under the mixture distribution in Equation 8.41:

X^2_M = X^2/c, \qquad c = \mathrm{tr}[\mathbf{U}\boldsymbol{\Gamma}]/d. \tag{8.44}

The corrected statistic X^2_M is then evaluated against a \chi^2(\mathrm{df}) reference distribution. This yields the Satorra–Bentler scaled chi-square statistic (Satorra & Bentler, 1994), where c is known as the scaling factor. When the model is correctly specified and the weight matrix is asymptotically consistent (for example, under ML estimation with normal data), c = 1, and the correction leaves the original statistic unchanged.

In lavaan, X^2_M can be requested using test = "satorra.bentler" (or the shorthand estimator = "MLM"):

fit_mlm <- cfa(model, data = HolzingerSwineford1939,
               test = "satorra.bentler")
fitMeasures(fit_mlm, c("chisq", "df", "pvalue",
                       "chisq_scaled", "df_scaled", "pvalue_scaled",
                       "chisq_scaling_factor"))
               chisq                   df               pvalue 
              85.306               24.000                0.000 
        chisq.scaled            df.scaled        pvalue.scaled 
              80.872               24.000                0.000 
chisq.scaling.factor 
               1.055 

The unscaled statistic X^2 is reported as chisq, whereas the scaled statistic X^2_M is reported as chisq.scaled. The scaling factor c is given by chisq.scaling.factor. Under normality, the value of c is typically close to 1.

8.5.5 The Yuan-Bentler statistics

The Yuan–Bentler test statistics are mean-corrected statistics in the spirit of Equation 8.44, but they replace the sample-based version of \boldsymbol{\Gamma} used in the residual weight matrix \mathbf{U}\boldsymbol{\Gamma} by the model-based counterpart \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}} (Yuan & Bentler, 2000) of Equation 8.19. The corresponding scaling correction is defined as

c = \mathrm{tr}[\mathbf{U} \boldsymbol{\Gamma}^{\mathrm{MOD}}]/d,

where \mathbf{U} is given by

\mathbf{U} = \mathbf{A}(\boldsymbol{\sigma}) - \mathbf{A}(\boldsymbol{\sigma})\boldsymbol{\Delta} \bigl(\boldsymbol{\Delta}^{\prime}\mathbf{A}(\boldsymbol{\sigma})\boldsymbol{\Delta}\bigr)^{-1} \boldsymbol{\Delta}^{\prime}\mathbf{A}(\boldsymbol{\sigma}).

This is the version used in lavaan when test = "yuan.bentler" is specified. For complete data, expected information is employed so that \mathbf{A}(\boldsymbol{\sigma}) = \mathbf{A}_E(\boldsymbol{\sigma}). When data are incomplete and missing = "ml" is used, observed information is employed, yielding \mathbf{A}(\boldsymbol{\sigma}) = \mathbf{A}_O(\boldsymbol{\sigma}).

Using the shorthand notation \mathbf{A} = \mathbf{A}(\boldsymbol{\sigma}) and \mathbf{B} = \mathbf{B}(\boldsymbol{\sigma}), the trace term can be rewritten as

\begin{aligned} \mathrm{tr}[\mathbf{U} \boldsymbol{\Gamma}^{\mathrm{MOD}}] &= \mathrm{tr}[\mathbf{A} \mathbf{A}^{-1} \mathbf{B} \mathbf{A}^{-1}] - \mathrm{tr}[ \mathbf{A} \boldsymbol{\Delta} \bigl(\boldsymbol{\Delta}^{\prime}\mathbf{A}\boldsymbol{\Delta}\bigr)^{-1} \boldsymbol{\Delta}^{\prime}\mathbf{A} \mathbf{A}^{-1} \mathbf{B} \mathbf{A}^{-1} ]\\ &= \mathrm{tr}[ \mathbf{B} \mathbf{A}^{-1}] - \mathrm{tr}[ \mathbf{A} \boldsymbol{\Delta} \bigl(\boldsymbol{\Delta}^{\prime}\mathbf{A}\boldsymbol{\Delta}\bigr)^{-1} \boldsymbol{\Delta}^{\prime} \mathbf{B} \mathbf{A}^{-1} ]\\ &= \mathrm{tr}[ \mathbf{B} \mathbf{A}^{-1}] - \mathrm{tr}[ \bigl(\boldsymbol{\Delta}^{\prime}\mathbf{A}\boldsymbol{\Delta}\bigr)^{-1} \boldsymbol{\Delta}^{\prime} \mathbf{B} \mathbf{A}^{-1} \mathbf{A} \boldsymbol{\Delta}]\\ &= \mathrm{tr}[ \mathbf{B} \mathbf{A}^{-1}] - \mathrm{tr}[ \bigl(\boldsymbol{\Delta}^{\prime}\mathbf{A}\boldsymbol{\Delta}\bigr)^{-1} \boldsymbol{\Delta}^{\prime} \mathbf{B} \boldsymbol{\Delta}] \end{aligned}

where the transition from the second to the third line uses the cyclic property of the trace operator. Defining \mathbf{A}(\boldsymbol{\vartheta}) = \boldsymbol{\Delta}^{\prime}\mathbf{A}\boldsymbol{\Delta} and \mathbf{B}(\boldsymbol{\vartheta}) = \boldsymbol{\Delta}^{\prime}\mathbf{B}\boldsymbol{\Delta}, the scaling factor can be written as

c = \Bigl[\mathrm{tr}\bigl[\mathbf{B}(\hat{\boldsymbol{\sigma}})\, \mathbf{A}(\hat{\boldsymbol{\sigma}})^{-1}\bigr] - \mathrm{tr}\bigl[\mathbf{B}(\hat{\boldsymbol{\vartheta}})\, \mathbf{A}(\hat{\boldsymbol{\vartheta}})^{-1}\bigr]\Bigr] / d. \tag{8.45}

This formulation, proposed by Asparouhov and Muthén (2010), is somewhat more flexible than the original version because \mathbf{A}(\hat{\boldsymbol{\vartheta}}) may now be taken as the full Hessian-based observed information matrix. In the original formulation, only the \mathsf{H}_1 approximation or the expected information matrix could be used for \mathbf{A}(\hat{\boldsymbol{\vartheta}}).

This is the version implemented in Mplus, and it can be requested in lavaan via test = "yuan.bentler.mplus". It is also the default Yuan–Bentler variant when estimator = "MLR" is used.

For both variants, the corrected statistic X^2_{YB} = X^2/c is evaluated against a \chi^2(\mathrm{df}) reference distribution. Because \boldsymbol{\Gamma}^{\mathrm{MOD}} can also be computed in the presence of missing data (using missing = "ml"), the Yuan–Bentler test statistics are applicable to both complete and incomplete datasets.

8.5.6 The mean-and-variance adjusted statistic

A more sophisticated correction for complete data (Satterthwaite, 1941, 1946) matches both the mean and the variance of the reference distribution:

X^2_{MV} = X^2/c^{\star}, \qquad c^{\star} = \frac{\mathrm{tr}\bigl[(\mathbf{U}\boldsymbol{\Gamma})^2\bigr]} {\mathrm{tr}[\mathbf{U}\boldsymbol{\Gamma}]}, \qquad d^{\star} = \frac{\bigl(\mathrm{tr}[\mathbf{U}\boldsymbol{\Gamma}]\bigr)^2} {\mathrm{tr}\bigl[(\mathbf{U}\boldsymbol{\Gamma})^2\bigr]}. \tag{8.46}

The resulting statistic X^2_{MV} is then evaluated against a \chi^2(d^{\star}) reference distribution.

In lavaan, this test can be requested using test = "mean.var.adjusted":

fit_mv <- cfa(model, data = HolzingerSwineford1939, 
                 test = "mean.var.adjusted")
fitMeasures(fit_mv, c("chisq_scaled", "df_scaled", "pvalue_scaled"))
 chisq.scaled     df.scaled pvalue.scaled 
       67.228        19.951         0.000 

One drawback of this approach is that the adjusted degrees of freedom (d^{\star}) no longer coincide with the ordinary model degrees of freedom (d or \mathrm{df}). Moreover, d^{\star} is typically noninteger, as illustrated in the output above, which many users find unintuitive or confusing. The next variant avoids this issue.

8.5.7 The scaled-and-shifted statistic

A variant of the mean-and-variance adjusted statistic that preserves the original degrees of freedom (d) is the scaled-and-shifted statistic (Asparouhov & Muthén, 2010):

X^2_{SS} = a\,X^2 + b, \qquad a = \sqrt{d/\mathrm{tr}\bigl[(\mathbf{U}\boldsymbol{\Gamma})^2\bigr]}, \qquad b = d - \sqrt{\frac{d \, \bigl(\mathrm{tr}[\mathbf{U}\boldsymbol{\Gamma}]\bigr)^2} {\mathrm{tr}\bigl[(\mathbf{U}\boldsymbol{\Gamma})^2\bigr]} }. \tag{8.47}

As with X^2 and X^2_{M}, X^2_{SS} is referred to \chi^2(d) with the original integer d. This is the variant that is used for the MLMV, ULSMV, and WLSMV shorthands. The shorthand names still reflect the original mean-and-variance (MV) adjusted test statistics, which have been renamed (in lavaan) to MLMVS, ULSMVS, and WLSMVS respectively, where the suffix S refers to Satterthwaite.

In lavaan, the scaled-and-shifted test statistic can be requested as test = "scaled.shifted":

fit_ss <- cfa(model, data = HolzingerSwineford1939,
              test = "scaled.shifted")
fitMeasures(fit_ss, c("chisq_scaled", "df_scaled", "pvalue_scaled"))
 chisq.scaled     df.scaled pvalue.scaled 
       75.853        24.000         0.000 

8.5.8 The corrected adjusted statistics

Both X^2_{MV} (Equation 8.46) and X^2_{SS} (Equation 8.47) involve the trace of the squared residual weight matrix, \mathrm{tr}\bigl[(\mathbf{U}\boldsymbol{\Gamma})^2\bigr]. The naive plug-in estimator of this quantity is severely (upward) biased unless P^{\star} is small relative to N. As the number of observed variables grows, the bias inflates the estimated variance of the mixture distribution, and the adjusted test statistics underreject, often severely so (Hayakawa, 2019). To remedy this, Hayakawa (2019) replaced the naive estimator by an unbiased estimator of the trace of a squared covariance matrix (originally developed for high-dimensional inference by Srivastava and by Himeno and Yamada), which remains accurate even when P^{\star} is large relative to N. The estimator is computed from the casewise (saturated) moment contributions, so the raw data are required.

These corrected variants are available as test = "mean.var.adjusted.corrected" (aliases: "mvc", "hayakawa") and test = "scaled.shifted.corrected" (alias: "ssc"); the latter is a natural extension of the correction to the scaled-and-shifted statistic that is not part of the original paper. Following Hayakawa (2019), the corrected tests are best combined with the RLS base statistic (via scaled_test = "browne.residual.nt.model"; see also Section 8.5.10):

fit_mvc <- cfa(model, data = HolzingerSwineford1939,
               test = "mean.var.adjusted.corrected",
               scaled_test = "browne.residual.nt.model")
fitMeasures(fit_mvc, c("chisq_scaled", "df_scaled", "pvalue_scaled"))
 chisq.scaled     df.scaled pvalue.scaled 
       76.251        23.803         0.000 

In version 0.7-4, the corrected tests are only available for single-group, single-level models with complete continuous data and estimator = "ML", and for the structural test of local SAM (Section 18.8.1). In the (small) Holzinger–Swineford example the correction is barely noticeable; its benefits appear when the number of variables is large relative to the sample size.

8.5.9 Options for the scaling correction

The scaling factor c in Equation 8.44, as well as the scale and shift parameters a and b in Equation 8.46 and Equation 8.47, depend on estimates of both \mathbf{U} and \boldsymbol{\Gamma} (the latter in any of the variants cataloged in Section 8.3).

For the \mathbf{U} matrix, the computational details are governed by the information, h1_information, and observed_information arguments. This gives rise to two main cases:

  1. information = "expected", or information = "observed" together with observed_information = "h1": in this case, Equation 8.42 is used, and h1_information may be either "structured" or "unstructured".

  2. information = "observed" together with observed_information = "hessian": in this case, Equation 8.43 is used. If h1_information = "unstructured", this only affects \mathbf{A}(\boldsymbol{\sigma}), not \mathbf{A}(\boldsymbol{\vartheta}).

For the complete-data variants of the robust test statistics, that is, "satorra.bentler", "mean.var.adjusted", and "scaled.shifted", the estimate of \boldsymbol{\Gamma} is always sample-based and unstructured. Consequently, the information options affect only \mathbf{U} and not \boldsymbol{\Gamma}.

For the incomplete-data variants ("yuan.bentler" and "yuan.bentler.mplus"), the information options also influence the model-based version of \boldsymbol{\Gamma}. When missing = "ml" is used, observed information is the default. With complete data (or after listwise deletion), expected information is used by default. For test = "yuan.bentler.mplus", the information options affect only the second trace term in Equation 8.45, because the first trace term is always computed using saturated-model estimates. In contrast, for test = "yuan.bentler", the information options affect both trace terms.

For even finer control, lavaan allows the information settings used for constructing \boldsymbol{\Gamma} to differ from those used for \mathbf{U} when test = "yuan.bentler" is specified. This can be achieved using the arguments omega_information and omega_h1_information (for the bread of \boldsymbol{\Gamma}^{\mathrm{MOD}}) and omega_information_meat and omega_h1_information_meat (for its meat), which take the same values as their counterparts without the omega_ prefix.

Despite this large number of options, some combinations are still not available directly in lavaan. However, many of these can be implemented without much difficulty using custom R code, as illustrated in Savalei and Rosseel (2022).

The scaling options affect the computation of the test statistic independently of the computation of the standard errors. As a result, it is possible (although uncommon) to request a robust test statistic together with conventional standard errors, or vice versa.

A computational note: although the formulas above are written in terms of the P^{\star} \times P^{\star} matrix product \mathbf{U}\boldsymbol{\Gamma}, lavaan computes the traces \mathrm{tr}[\mathbf{U}\boldsymbol{\Gamma}] and \mathrm{tr}\bigl[(\mathbf{U}\boldsymbol{\Gamma})^2\bigr] without ever forming \mathbf{U} or \mathbf{U}\boldsymbol{\Gamma} explicitly: the required quantities are accumulated in the (much smaller) T-dimensional parameter space, for both dense (ML, GLS) and diagonal (DWLS, ULS) weight matrices. This matters in particular for categorical models, where P^{\star} (thresholds plus polychoric correlations) grows quickly with the number of variables. The full matrices are still constructed on demand when they are needed as such, for example when requesting lavInspect(fit, "UGamma") or lavInspect(fit, "UfromUGamma"), or when the individual eigenvalues are required (as in the FMG family of Section 8.5.11).

8.5.10 Residual-based test statistics

The residual-based tests of Browne (1984) form the test statistic directly from the discrepancy between the observed and the model-implied moment vectors, without going through a discrepancy function. Let \mathbf{r} = \mathbf{s}- \hat{\boldsymbol{\sigma}} be the P^{\star}-vector of residuals between the sample and model-implied moments and let \boldsymbol{\Delta}_c be a matrix whose columns span the orthogonal complement of the column space of \boldsymbol{\Delta}. The Browne residual statistic is then (Browne, 1984, eq. 2.20a)

X^2_B = (N- 1)\, \mathbf{r}^{\prime} \boldsymbol{\Delta}_c \bigl(\boldsymbol{\Delta}_c^{\prime}\, \boldsymbol{\Gamma}\, \boldsymbol{\Delta}_c\bigr)^{-1} \boldsymbol{\Delta}_c^{\prime} \mathbf{r}. \tag{8.48}

Under the null hypothesis of correct model specification, X^2_B \xrightarrow{d} \chi^2(\mathrm{df}). An algebraically equivalent form avoids the orthogonal complement \boldsymbol{\Delta}_c and needs only the inverse of \boldsymbol{\Gamma} (in the normal-theory case, the \mathsf{H}_1 information matrix):

X^2_B = (N- 1)\, \Bigl[ \mathbf{r}^{\prime} \boldsymbol{\Gamma}^{-1} \mathbf{r} - \mathbf{r}^{\prime} \boldsymbol{\Gamma}^{-1} \boldsymbol{\Delta} \bigl(\boldsymbol{\Delta}^{\prime} \boldsymbol{\Gamma}^{-1} \boldsymbol{\Delta}\bigr)^{-1} \boldsymbol{\Delta}^{\prime} \boldsymbol{\Gamma}^{-1} \mathbf{r} \Bigr]. \tag{8.49}

The first term is the quadratic form of the residuals in the metric of \boldsymbol{\Gamma}^{-1}; the second term removes the part of it that the free parameters can absorb. lavaan uses this form whenever the orthogonal complement is cumbersome to construct. With equality constraints (linear or nonlinear, the latter linearized at the solution), \boldsymbol{\Delta} is replaced by \boldsymbol{\Delta}\mathbf{Z}, where \mathbf{Z} is the orthonormal basis of the tangent space of the constraints introduced in Section 8.2.5; in a multiple-group model with cross-group constraints, the groups are then combined into a single quadratic form (with \boldsymbol{\Gamma}_g^{-1} weighted by N_g/N) rather than summed as separate per-group statistics. The same form is used for two-level models, as described at the end of this section. The matrix \boldsymbol{\Gamma} can be estimated in any of the four ways cataloged in Section 8.3, yielding four lavaan variants:

  • "browne.residual.adf": the sample-based ADF estimator \hat{\boldsymbol{\Gamma}} of Equation 8.16 (continuous) or Equation 8.17 (categorical). Available for nonnormal continuous and categorical data.
  • "browne.residual.nt": the sample-based normal-theory estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{NT}} of Equation 8.18. For normal continuous data.
  • "browne.residual.adf.model": the model-based estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD}} of Equation 8.19 (or Equation 8.21 under missing = "ml"). For nonnormal continuous data, complete or incomplete.
  • "browne.residual.nt.model": the model-based normal-theory estimator \hat{\boldsymbol{\Gamma}}^{\mathrm{MOD,NT}} of Equation 8.20 (or Equation 8.22 under missing = "ml"). For normal continuous data, complete or incomplete.

With incomplete continuous data (missing = "ml", "ml.x", "two.stage" or "robust.two.stage"), the two sample-based variants use the incomplete-data versions of their \hat{\boldsymbol{\Gamma}} described in Section 8.3: the covariance matrix of the saturated (EM) estimates, evaluated at these estimates. This is the inverse of the observed information of the saturated model for the normal-theory variant, and the sandwich for the ADF variant. The two model-based variants evaluate the same matrices at the model-implied moments. With incomplete data, this makes a difference: the model-based matrices also reflect the misfit of the model, the resulting statistics are conservative (they reject a correct model less often than the nominal level), and they have much less power than the likelihood ratio statistic when the model does not fit. The sample-based variants are therefore preferred with incomplete data. As with complete data, the ADF variant needs a large sample.

For the WLS-type family of estimators with \boldsymbol{\Gamma}= \mathbf{W}^{-1}, \boldsymbol{\Delta}^{\prime} \boldsymbol{\Gamma}^{-1} \mathbf{r} = \mathbf{0} when \boldsymbol{\Delta} is evaluated at the optimal solution \hat{\boldsymbol{\vartheta}}. As a result, X^2_B = X^2_{\mathrm{WLS}} for WLS estimation if test = "browne.residual.adf" is used, and X^2_B = X^2_{\mathrm{GLS}} for GLS estimation if test = "browne.residual.nt" is used.

Under ML estimation, test = "browne.residual.nt.model" is asymptotically equivalent to the reweighted least squares (RLS) statistic of Browne (1974). This statistic is in fact part of the current default for estimator = "ML": unless the user overrides test=, lavaan computes both the standard chi-square and browne.residual.nt.model, because the type-I error rates of the latter are markedly closer to the nominal level in small to moderate samples. (For the robust MLR variant, and in the presence of sampling weights, the ADF version browne.residual.adf is added instead.) With incomplete data (missing = "ml" or "ml.x"), the second test is the sample-based version browne.residual.nt, for the reason given above; its value is usually very close to that of the standard chi-square. The extra test appears as a second block in the summary() output; the fit measures, standard errors, and point estimates are unaffected. The same defaults apply to two-level ML models (Section 16.8.3), with or without conditional_x = TRUE. For missing = "pairwise", no suitable \hat{\boldsymbol{\Gamma}} exists, and only the standard statistic is computed.

If the estimators ULS and DWLS are requested with continuous data, test = "browne.residual.nt" is the default.

The residual-based tests are requested directly via the test= argument:

fit_browne <- cfa(model, data = HolzingerSwineford1939, estimator = "ML",
                  test = c("browne.residual.adf", "browne.residual.nt"))
fit_browne

For the two-level random-intercept models of Section 16.3 (ML estimation only), all four variants are available, and the statistic is computed in the information form Equation 8.49 with the clusters as the independent units. The residual vector is the difference between the unrestricted (\mathsf{H}_1) moments of Section 16.6 and the model-implied moments of both levels,

\mathbf{r} = \begin{pmatrix} \hat{\boldsymbol{\mu}}_W \\ \mathrm{vech}\,\hat{\boldsymbol{\Sigma}}_W \\ \hat{\boldsymbol{\mu}}_B \\ \mathrm{vech}\,\hat{\boldsymbol{\Sigma}}_B \end{pmatrix} - \begin{pmatrix} \boldsymbol{\mu}_W(\hat{\boldsymbol{\vartheta}}) \\ \mathrm{vech}\,\boldsymbol{\Sigma}_W(\hat{\boldsymbol{\vartheta}}) \\ \boldsymbol{\mu}_B(\hat{\boldsymbol{\vartheta}}) \\ \mathrm{vech}\,\boldsymbol{\Sigma}_B(\hat{\boldsymbol{\vartheta}}) \end{pmatrix}, \tag{8.50}

in the order of the two-level model Jacobian \boldsymbol{\Delta} of Section 8.2.4. Writing \mathbf{A} for the matrix that takes the place of \boldsymbol{\Gamma}^{-1} in Equation 8.49, and n for the factor that takes the place of N- 1, the four variants are:

  • "browne.residual.nt": \mathbf{A} is the per-cluster \mathsf{H}_1 information matrix of Section 16.8.1 (expected; observed, by Louis’s method, under missing = "ml"), evaluated at the \mathsf{H}_1 estimates, and n = N_J, the number of clusters, matching the per-cluster unit of that matrix.
  • "browne.residual.nt.model": the same, but with the \mathsf{H}_1 information evaluated at the model-implied moments \boldsymbol{\mu}_W(\hat{\boldsymbol{\vartheta}}), \boldsymbol{\Sigma}_W(\hat{\boldsymbol{\vartheta}}), \boldsymbol{\mu}_B(\hat{\boldsymbol{\vartheta}}), \boldsymbol{\Sigma}_B(\hat{\boldsymbol{\vartheta}}) (the structured \mathsf{H}_1 information of Section 8.2); n = N_J.
  • "browne.residual.adf": \mathbf{A} is the (generalized) inverse of the two-level sandwich estimator \hat{\boldsymbol{\Gamma}} = N \cdot \widehat{\mathrm{acov}}(\mathbf{s}) that also serves the two-level least-squares estimators (Section 16.11.1), with \widehat{\mathrm{acov}}(\mathbf{s}) = N_J^{-1} \mathbf{A}_{h1}^{-1} \mathbf{B}_{h1} \mathbf{A}_{h1}^{-1}, where \mathbf{A}_{h1} is the per-cluster \mathsf{H}_1 information and \mathbf{B}_{h1} the first-order information built from the cluster-wise \mathsf{H}_1 scores, both at the \mathsf{H}_1 estimates; n = N, consistent with the scaling of \hat{\boldsymbol{\Gamma}} by the number of observations. Combined, this is the same quadratic form as N_J\, \mathbf{r}^{\prime} \mathbf{A}_{h1} \mathbf{B}_{h1}^{-1} \mathbf{A}_{h1} \mathbf{r} (minus the absorbed part).
  • "browne.residual.adf.model": \mathbf{A} = \mathbf{A}_{h1} \mathbf{B}_{h1}^{-1} \mathbf{A}_{h1}, the inverse of the model-based sandwich, with both information matrices evaluated at the model-implied moments; n = N_J.

The degrees of freedom are those of the standard test (Equation 16.13). Equality constraints and cross-group constraints are handled as in the single-level case: \boldsymbol{\Delta} is projected onto the tangent space of the constraints, and the groups enter a single quadratic form. The rows of \mathbf{A} that belong to the moments of the exogenous covariates are zero under fixed_x = TRUE, as are the rows of the within-level means of the shared variables (which are structurally zero; see Section 16.4.2); these entries drop out of the statistic. The model-based variants give the same statistic whether the covariates are treated as fixed or as random, because the residuals of the x-moments are zero either way. All four variants accept incomplete data (missing = "ml"): the information matrices are then the observed ones, and the sample-based variants evaluate them at the \mathsf{H}_1 estimates, as in the single-level case. For two-level data, the model-based normal-theory variant also performs well (it is only smaller than the likelihood ratio statistic if the misfit is very large), but the model-based ADF variant has less power. With conditional_x = TRUE, the two-level residual is formed in the conditional statistic space (residual intercepts, slopes, and residual covariances per level). The two-level least-squares estimators keep their own default tests (Section 16.11.1).

8.5.11 The FMG family of test statistics

The Foldnes-Moss-Gronneberg (FMG) family (Foldnes et al., 2025, 2026) is a recent collection of test statistics that approximate the chi-square mixture limit Equation 8.41 directly, without approximating it by a single chi-square. Given the eigenvalues \hat\lambda_1, \ldots, \hat\lambda_d of \hat{\mathbf{U}}\hat{\boldsymbol{\Gamma}}, the p-value of the test is computed from

H(t;\, \tilde\lambda_1, \ldots, \tilde\lambda_d) = P\!\Bigl(\sum_{k=1}^{d}\tilde\lambda_k\,Z_k^2 > t\Bigr), \qquad Z_k \stackrel{\mathrm{iid}}{\sim} \mathcal{N}(0, 1), \tag{8.51}

where \tilde\lambda_k is a stabilized approximation of \hat\lambda_k. The members of the FMG family differ in how the stabilization is performed:

  • "all": no stabilization, \tilde\lambda_k = \hat\lambda_k for k = 1, \ldots, d. This is the most direct mixture-based test (also studied as \mathrm{EBA}_d in Foldnes & Grønneberg, 2018), and is asymptotically exact, but the eigenvalue estimates have considerable sampling variability in moderate samples.
  • "sb": replace every \tilde\lambda_k by the common average (1/d)\sum_j \hat\lambda_j. This is exactly the Satorra–Bentler scaling re-expressed as a sum-of-chi-squares: a block-averaging with one block of size d.
  • "peba" (penalized eigenvalue block averaging): for peba2, the sorted eigenvalues are split into two equal blocks, and each \tilde\lambda_k is set to its block mean shrunk toward the grand mean. peba4 uses four blocks, and so on. The penalization stabilizes the estimates by pulling block means toward the grand mean, trading some asymptotic accuracy for substantially lower sampling variability.
  • "pols" (penalized OLS): \tilde\lambda_k is obtained by fitting a simple linear regression of the sorted eigenvalues against their rank, with a penalty pulling the slope toward zero.
  • "sf": the scaled-F test of Wu and Lin (2016), which approximates the distribution of X^2_{\mathrm{ML}} by a scaled F distribution whose degrees of freedom are functions of \sum \hat\lambda_k, \sum \hat\lambda_k^2, and \sum \hat\lambda_k^3.
  • "ss": the scaled-and-shifted statistic of Section 8.5.7, re-expressed within the FMG eigenvalue framework.

Each FMG test can be combined with two further choices:

  • the base statistic: either the standard ML chi-square X^2_{\mathrm{ML}} (in lavaan’s default likelihood = "normal") or the reweighted least squares statistic X^2_{\mathrm{RLS}} of Browne (1974), which is the model-based normal-theory Browne residual test (browne.residual.nt.model). Several Monte Carlo studies have found X^2_{\mathrm{RLS}} to perform somewhat better than X^2_{\mathrm{ML}} as an FMG base statistic.
  • the \hat{\boldsymbol{\Gamma}} estimator: the conventional plug-in (biased) estimator, or the unbiased estimator (UG) of Du and Bentler (2022).

In lavaan, FMG tests are requested by name. The naming convention follows Foldnes et al. (2025):

{method}{param}_{ug?}_{ml|rls?}

where method is one of peba, pols, all, pall, sb, ss, or sf; param is the block count for peba (e.g. peba4) or the penalization parameter for pols (e.g. pols2); ug selects the unbiased \hat{\boldsymbol{\Gamma}} estimator; and ml or rls selects the base statistic. For example, peba4_ug_rls is penalized eigenvalue block averaging with four blocks, the unbiased \hat{\boldsymbol{\Gamma}}, and the RLS base statistic. Both suffixes can be omitted. Without an explicit ug suffix, the \hat{\boldsymbol{\Gamma}} choice follows the gamma_unbiased option (default: FALSE, i.e., the conventional plug-in estimator). Without an explicit ml/rls suffix, the base statistic follows the scaled_test argument: the standard ML chi-square when scaled_test is "standard" (the default), and the RLS statistic when scaled_test = "browne.residual.nt.model".

In addition, the convenience value test = "fmg" is available as a preset: it resolves to "peba4_rls", the combination recommended by the FMG authors for testing a single model. The preset can also be combined with the suffixes (e.g., "fmg_ug", "fmg_ml"). When used for a nested model comparison in lavTestLRT(), the same preset resolves to a pall-based variant instead.

fit_fmg <- cfa(model, data = HolzingerSwineford1939,
               test = c("peba4", "peba4_ug_rls"))
fitMeasures(fit_fmg, c("chisq", "df", "pvalue", "pvalue_scaled"))

Technical details, including why \hat\lambda_k is unstable in small samples and why penalization helps, are given in Foldnes et al. (2025) and Foldnes et al. (2026).

8.5.12 The Bollen-Stine bootstrap test

Instead of comparing X^2 to an asymptotic reference distribution, the bootstrap approach approximates its finite-sample null distribution directly. The data are first transformed so that the model-implied moments match the population moments under the null hypothesis. Bootstrap samples are then drawn from this transformed data set, the model is refitted to each bootstrap sample, and the empirical distribution of the resulting X^2 values is used to obtain a p-value.

Let \mathbf{Y} denote the complete data matrix. The transformation proceeds as follows:

  • First, the data are centered by subtracting the observed sample mean vector \bar{\mathbf{y}} from each row of \mathbf{Y}, yielding the centered matrix \mathbf{Y}^{(c)}.

  • Next, the centered data are whitened by postmultiplication with \mathbf{S}^{-1/2} and subsequently recolored by postmultiplication with \hat{\boldsymbol{\Sigma}}^{1/2}:

    \mathbf{Y}^{\star(c)} = \mathbf{Y}^{(c)} \, \mathbf{S}^{-1/2} \, \hat{\boldsymbol{\Sigma}}^{1/2}.

  • Finally, the transformed data matrix \mathbf{Y}^{\star} is obtained by adding the model-implied mean vector \hat{\boldsymbol{\mu}} to each row of \mathbf{Y}^{\star(c)}.

The resulting transformed matrix \mathbf{Y}^{\star} replaces the original data matrix \mathbf{Y} in the subsequent bootstrap procedure.

In the broader statistical literature, this approach is known as the model-based bootstrap or residual bootstrap. It was introduced into the SEM literature by Bollen and Stine (1992), following the work of Beran and Srivastava (1985), and is now commonly referred to as the Bollen–Stine bootstrap test. The procedure is available only for continuous data without missing values.

In lavaan, the test can be requested using test = "bollen.stine":

fit_boot <- cfa(model, data = HolzingerSwineford1939, test = "bollen.stine",
                bootstrap = list(R = 5000L, iseed = 1234,
                                 parallel = "snow", ncpus = 8L))

See Section 8.4.12 for additional details on the bootstrap= argument. When both se = "bootstrap" and test = "bollen.stine" are specified, the latter takes precedence. Consequently, the standard errors are computed from the bootstrap replications generated from the transformed data set.

8.5.13 The lavTest() function

By default, the summary() method reports only those test statistics that were computed during model fitting, as determined by the test= and scaled_test= arguments specified at estimation time. The lavTest() function can be used to request additional test statistics from an already fitted model, without re-estimating the model:

# default: returns the standard chi-square test
lavTest(fit_ml)

# request several variants in one call
lavTest(fit_ml, test = c("standard", "satorra.bentler",
                         "browne.residual.nt", "peba4"))

The test= argument of lavTest() accepts the same values as those listed in Table 8.5. Three additional arguments determine the output:

  • scaled_test=: specifies the test statistic to be scaled when a scaled statistic is requested. The default is "standard", but alternative choices are possible, such as "browne.residual.nt".

  • output=: if set to "list" (the default), the results are returned as a list with one element per test statistic. If set to "text", the results are displayed in a more user-friendly format, identical to the format used in the printed summary() output.

  • drop_list_single=: if output = "list", and only a single test statistic is requested, the result for that statistic is returned directly rather than wrapped inside a list of length one.

For example, the following call requests the satorra.bentler scaled statistic, computed from the RLS (browne.residual.nt.model) base statistic rather than the default ML chi-square:

lavTest(fit_ml, test = "satorra.bentler",
        scaled_test = "browne.residual.nt.model", output = "text")
Model Test User Model:
                                              Standard      Scaled
  Browne's residual (NT model-based) test                         
  Test Statistic                                81.368      77.139
  Degrees of freedom                                24          24
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.055
    Satorra-Bentler correction                                    
                                                      
  Test statistic                                85.306
  Degrees of freedom                                24
  P-value (Chi-square)                           0.000

8.6 Estimator shorthand notation

As discussed in Section 7.2 and Table 7.2, certain estimator names serve as shorthands for specific combinations of point estimator, standard error method, test statistic, and information settings. Table 8.7 lists the four most commonly used ML shorthands together with their equivalent full specifications. The shorthand notations for the ULS (ULSM, ULSMV, and ULSMVS) and DWLS (WLSM, WLSMV, and WLSMVS) families operate in the same way, although there is no counterpart of MLR for these estimators.

Table 8.7: Common ML estimator shorthands and their equivalent full specifications.
Shorthand Equivalent full specification
estimator = "MLM" estimator = "ML", se = "robust.sem", test = "satorra.bentler", information = c("expected","expected"), h1_information = c("structured","structured")
estimator = "MLMV" estimator = "ML", se = "robust.sem", test = "scaled.shifted", information = c("expected","expected"), h1_information = c("structured","structured")
estimator = "MLMVS" estimator = "ML", se = "robust.sem", test = "mean.var.adjusted", information = c("expected","expected"), h1_information = c("structured","structured")
estimator = "MLR" estimator = "ML", se = "robust.huber.white", test = "yuan.bentler.mplus", information = c("observed","observed"), observed_information = c("hessian","hessian"), h1_information = c("structured","structured")

To verify the defaults that are set by a shorthand, use:

fit_mlr <- cfa(model, data = HolzingerSwineford1939, estimator = "MLR")
lavInspect(fit_mlr, "options")[c("se", "test", "information",
                                 "observed.information", "h1.information")]
$se
[1] "robust.huber.white"

$test
[1] "standard"           "yuan.bentler.mplus"

$information
[1] "observed" "observed"

$observed.information
[1] "hessian" "hessian"

$h1.information
[1] "structured" "structured"

These shorthand names were introduced to mirror the conventions used in the Mplus software package (Muthén & Muthén, 2012), where they are available as built-in options. Note that in lavaan, the information argument is a vector of length two: the first element controls the computation of standard errors, whereas the second element controls the computation of the test statistic.

8.7 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 8.8 maps the topics of this chapter to their source files.

Table 8.8: Source files behind the standard errors and test statistics.
Topic File(s)
information matrices, augmented/constrained inversion (lav_model_info_augment_invert()) lav_model_information.R
small-sample corrections of the sandwich meat (information_meat_hc: leverages, per-parameter weights, adjusted meat) lav_vcov_hc.R
two-level expected information (lav_mvn_cl_info_expected_delta()) and first-order information (lav_mvreg_cl_info_firstorder(), lav_mvn_cl_mi_info_firstorder() with missing = "ml") lav_mvnorm_cluster.R
lav_mvreg_cluster.R
lav_mvnorm_cluster_missing.R
active-set classification of inequality constraints (lav_con_cin_inactive_idx()) lav_constraints.R
degrees of freedom under equality constraints (lav_test_df()) lav_test_utils.R
defined parameters: the function built from the := lines lav_partable_constraints.R
bootstrap standard errors (and the Bollen–Stine transformation) lav_bootstrap.R
approximate bootstrap draws (infinitesimal jackknife, first and second order; the guard) lav_bootstrap_ij.R
test-statistic dispatch and renaming (lav_test_rename()) lav_test.R
Hayakawa correction lav_test_hayakawa.R
Browne residual test statistics lav_test_browne.R
FMG (eigenvalue-based) test statistics lav_test_fmg.R

8.7.1 Constrained models

The Jacobian \mathbf{R}_{\text{act}} of the active constraints (Section 8.2.5) and the corresponding Lagrange multipliers are stored in the @con.jac and @con.lambda slots of the internal model object; with ceq_simple = TRUE, the indicator matrix \mathbf{L} of Section 7.7.7 is stored as @ceq.simple.K. The function \mathbf{f} that maps the free parameters to the defined parameters (Section 8.4.14) is stored as @Model@def.function.