| Type: | Package |
| Title: | Robust Test Statistics for Structural Equation Models |
| Description: | Computes robust p-values for overall fit and nested comparisons of structural equation models fitted with 'lavaan'. Implements penalized eigenvalue block averaging and penalized regression (Foldnes, Moss, Grønneberg, 2025) <doi:10.1080/10705511.2024.2372028>, including their extension to nested models (Foldnes, Grønneberg, Moss, 2026) <doi:10.3758/s13428-026-02968-4>, alongside familiar corrections such as Satorra-Bentler. Supported settings include complete-data ML, GLS, and ULS, categorical DWLS and ULS, and full-information maximum likelihood with one or several groups. |
| Version: | 1.0.0 |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| URL: | https://github.com/JonasMoss/semTests |
| Depends: | R (≥ 3.5.0) |
| Imports: | lavaan (≥ 0.7-2), methods |
| Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-07-19 11:49:01 UTC; jonas |
| Author: | Jonas Moss |
| Maintainer: | Jonas Moss <jonas.moss.statistics@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-19 15:40:02 UTC |
Verify that two categorical fits define one comparable nested problem.
Description
Verify that two categorical fits define one comparable nested problem.
Usage
check_categorical_nested_pair(m0, m1)
Require a converged fit and flag inadmissible solutions.
Description
Require a converged fit and flag inadmissible solutions.
Usage
check_fit_quality(fit, arg = "object")
Reject anything that is not a fitted lavaan object.
Description
The class gate for pvalues() / pvalues_nested(). It must run before any
@-slot access so a NULL / data.frame / list argument fails with a readable
message instead of a cryptic S4 "no slot of name ..." error – the nested
entry point in particular reads m0@test to compute the degrees of freedom
before the support gate runs.
Usage
check_lavaan(x, arg = "object")
Arguments
x |
The object passed by the user. |
arg |
The argument name, used in the message (e.g. |
Value
x, invisibly.
Verify that two fits describe one comparable nested problem.
Description
This gate checks fit-level compatibility that is required regardless of data type. It prevents a difference test across different samples, variables, groups, estimators, or information conventions. Substantive nesting still needs an argument based on the model specifications.
Usage
check_nested_pair(m0, m1)
Reject a fit whose configuration is outside the supported surface.
Description
The single entry-level gate for pvalues(). It admits exactly the
configurations documented in semTests-support – the supported continuous
and categorical estimators, complete data, and FIML with one or several
groups – and stops
with a pointer to ?semTests-support otherwise. Statistic- and gamma-specific
rejections (the normal-theory-only RLS statistic and UG gamma) depend on the
parsed test string and stay with the code that consumes them (make_chisqs()
and gamma_matrices()). This gate checks the shape of the fit.
Usage
check_supported(fit, arg = "object")
Arguments
fit |
A fitted |
Value
fit, invisibly.
Reject a nested pair whose configuration is outside the supported surface.
Description
The single entry-level gate for pvalues_nested(): categorical nesting uses
Satorra 2000 with a delta restriction map, missing-data nesting otherwise
requires both fits to be FIML, and FIML nesting supports method = "2000"
only. Each fit is also run through
check_supported(). The UG-gamma rejection for FIML stays in the p-value
engine because it depends on the parsed test string.
Usage
check_supported_nested(m0, m1, method, A.method = "delta")
Arguments
m0, m1 |
Two nested |
method |
The nested reduction method, |
A.method |
The FIML restriction map, |
Value
TRUE, invisibly.
Compute p-values for one parsed test specification.
Description
Compute p-values for one parsed test specification.
Usage
compute_pvalues(
m0,
unbiased,
trad,
eba,
peba,
pols,
chisq = c("ml", "rls"),
m1 = NULL,
A.method = "delta",
fiml.convention = "observed"
)
Calculate the jth eba pvalue.
Description
Calculate the jth eba pvalue.
Usage
eba_pvalue(chisq, lambdas, j)
Align an H0 parameter basis to H1's full-parameter ordering.
Description
Align an H0 parameter basis to H1's full-parameter ordering.
Usage
fiml_align_parameter_basis(m0, m1, basis0)
Verify that two FIML fits use identical observations.
Description
Verify that two FIML fits use identical observations.
Usage
fiml_check_same_data(m0, m1)
Saturated observed-data FIML information in moment space.
Description
lavaan 0.7-2 exposes the corrected FIML H1 information. Setting
h1.information on a local copy requests the unstructured, observed
saturated information without refitting or changing the fitted parameters.
Usage
fiml_h1_information_observed(fit)
FIML goodness-of-fit eigenvalues.
Description
The observed convention uses observed saturated information, matching the
convention independently implemented and validated in magmaan. The lavaan
convention returns lavaan's own inspected UGamma spectrum.
Usage
fiml_lambdas(fit, df, fiml.convention = c("observed", "lavaan"))
FIML Satorra-2000 nested restriction eigenvalues.
Description
FIML Satorra-2000 nested restriction eigenvalues.
Usage
fiml_lambdas_nested(
m0,
m1,
df,
A.method = c("delta", "exact"),
fiml.convention = c("observed", "lavaan")
)
Gamma-free nested FIML ingredients in H1's effective parameter space.
Description
Gamma-free nested FIML ingredients in H1's effective parameter space.
Usage
fiml_nested_ingredients(m1, fiml.convention = c("observed", "lavaan"))
Stable identities for lavaan's full free parameters.
Description
Stable identities for lavaan's full free parameters.
Usage
fiml_parameter_keys(fit)
Return the leading symmetric-product eigenvalues without forming AB.
Description
Return the leading symmetric-product eigenvalues without forming AB.
Usage
fiml_sandwich_eigenvalues(U, Gamma, df)
Extract model degrees of freedom through lavaan's public API.
Description
Extract model degrees of freedom through lavaan's public API.
Usage
fit_df(fit)
Provenance of a semTests_pvalues object.
Description
Records the fit-level options actually used to compute the p-values, so the returned object is self-describing across estimators and data types.
Usage
fit_provenance(
fit,
nested,
method = NA,
A.method = NA,
fiml.convention = NA,
df = NULL,
tests = NULL,
parsed_options = NULL
)
Get gamma from a model.
Description
Get gamma from a model.
Usage
gamma_matrices(m1, unbiased = 1, m0 = NULL)
Arguments
m1 |
Model to extract gamma from. |
unbiased |
Biased (1), unbiased (2), or both (3). |
m0 |
Optional second model, used if |
Value
List of (un)biased gammas.
Calculate unbiased gamma from gamma and object.
Description
Calculate unbiased gamma from gamma and object.
Usage
gamma_to_gamma_unbiased(gammas, object)
Arguments
gammas |
List of gammas for each group. |
object |
|
Value
List of unbiased gammas.
Upper tail of a linear combination of chi-square_1 variables
Description
Computes P(Q > q) for Q = \sum_j \lambda_j Z_j^2 with
independent Z_j \sim N(0,1). Drop-in replacement for
CompQuadForm::imhof(q, lambda)$Qq: the Imhof integral in the body of the
distribution, a Lugannani-Rice saddlepoint in the far tail where the integral
degrades.
Usage
imhof_pvalue(q, lambda)
Arguments
q |
Numeric scalar or vector of thresholds representing the observed chi-square. |
lambda |
Numeric vector of eigenvalues (may be mixed sign). |
Value
Numeric vector of upper-tail probabilities, length length(q).
References
Imhof, J. P. (1961). Computing the distribution of quadratic forms in normal variables. Biometrika, 48(3/4), 419–426. doi:10.1093/biomet/48.3-4.419
Lugannani, R., & Rice, S. O. (1980). Saddle point approximation for the distribution of the sum of independent random variables. Advances in Applied Probability, 12(2), 475–490. doi:10.2307/1426607
Ruben, H. (1962). Probability content of regions under spherical normal distributions, IV: The distribution of homogeneous and non-homogeneous quadratic functions of normal variables. The Annals of Mathematical Statistics, 33(2), 542–570. doi:10.1214/aoms/1177704580
Is this the classical normal-theory, complete-data, random-x ML case?
Description
The Du-Bentler unbiased gamma and the RLS (browne.residual.nt.model)
statistic are defined here. Other families use the biased gamma and the
estimator's own uncorrected statistic.
Usage
is_classic_nt(fit)
Is this a continuous FIML/missing-data lavaan fit?
Description
Is this a continuous FIML/missing-data lavaan fit?
Usage
is_fiml(fit)
Reference spectrum of the nested test, without forming the full UGamma.
Description
For Satorra's (2000) method the nonzero eigenvalues are those of the m x m
matrix C^{-1} D' Gamma D (see nested_factor_2000). This avoids the
q x q UGamma and its eigendecomposition.
Usage
lambdas_nested(m0, m1, unbiased = 1, df)
Arguments
m0, m1 |
Two nested |
unbiased |
Biased (1), unbiased (2), or both (3) gamma. |
df |
Number of restrictions (degrees-of-freedom difference). |
Value
A list of eigenvalue vectors, one per gamma estimate.
Calculate nested ugamma.
Description
This can also be used with restrictions.
Usage
lav_ugamma_nested_2000(m0, m1, gamma_matrix, a = NULL)
Arguments
m0, m1 |
Two nested |
gamma_matrix |
Gamma weighted by groups. |
a |
The |
Value
Ugamma for nested object.
Biased single-model spectrum exposed by lavaan.
Description
Biased single-model spectrum exposed by lavaan.
Usage
lavaan_lambdas(object, df)
Calculate the scaled and shifted / the mean-variance adjusted p-value
Description
Calculate the scaled and shifted / the mean-variance adjusted p-value
Usage
scaled_and_shifted(chisq, lambdas)
Arguments
chisq |
Chi-square fit value from a lavaan object. |
lambdas |
Eigenvalues of UG matrix. |
Value
The scaled and shifted p-value or the mean-variance adjusted p-value.
Stack lavaan's per-group moment derivatives.
Description
Stack lavaan's per-group moment derivatives.
Usage
model_delta_matrix(fit)
Moment derivatives with respect to effective model parameters.
Description
Moment derivatives with respect to effective model parameters.
Usage
model_effective_delta(fit)
Map effective model parameters to lavaan's full free-parameter space.
Description
Handles explicit equality-constraint bases, simple equality constraints, and equality constraints combined with inequalities or bounds.
Usage
model_parameter_basis(fit)
Gamma-free factors of the reduced nested spectrum (Satorra 2000).
Description
Returns the restriction-space factor D and companion C such that the m
nonzero eigenvalues of the full q x q UGamma equal those of
C^{-1} D' Gamma D, an m x m problem with m the number of restrictions.
This is the materialised reduction of Moss (2026): the full q x q U matrix
and its eigendecomposition are never formed. With U = D C^+ D' one has
D = V Delta P^+ A' and C = A P^+ A', where V is the (group-weighted)
weight, Delta the Jacobian, P^+ the inverted information, and A the
restriction matrix.
Usage
nested_factor_2000(m0, m1, a = NULL)
Calculate the jth pall pvalue.
Description
Calculate the jth pall pvalue.
Usage
pall(chisq, lambdas)
Parse and validate public test specifications.
Description
Parse and validate public test specifications.
Usage
parse_tests(tests)
Calculate the jth eba pvalue.
Description
Calculate the jth eba pvalue.
Usage
peba_pvalue(chisq, lambdas, j)
Calculate penalized OLS pvalue.
Description
Calculate penalized OLS pvalue.
Usage
pols_pvalue(chisq, lambdas, gamma)
Print method for p-values from pvalues() / pvalues_nested().
Description
Prints the p-values, then a one-line provenance footer (estimator, data type, information, df) recording the options used.
Usage
## S3 method for class 'semTests_pvalues'
print(x, ...)
Arguments
x |
A |
... |
Passed to the default print method. |
Value
x, invisibly.
Calculate the jth all pvalue.
Description
Calculate the jth all pvalue.
Usage
pvalue_all(chisq, lambdas)
Compute robust p-values for one or two lavaan objects
Description
Compute one or several p-values for a fitted lavaan model. Available
methods include penalized eigenvalue block averaging, penalized regression,
and familiar robust corrections. The defaults select the recommended method
for the fitted model.
Usage
pvalues(
object,
tests = if (is_classic_nt(object)) "pEBA4_RLS" else "pEBA4",
fiml.convention = c("observed", "lavaan")
)
pvalues_nested(
m0,
m1,
method = c("2000", "2001"),
tests = if (is_classic_nt(m0)) "PALL_UG_ML" else "PALL",
A.method = c("delta", "exact"),
fiml.convention = c("observed", "lavaan")
)
Arguments
object, m0, m1 |
One or two |
tests |
A non-empty character vector of tests. Each element uses one of
|
fiml.convention |
For FIML fits, use the fully observed-information
convention ( |
method |
Nested reduction method. Only Satorra's |
A.method |
For nested FIML or categorical models, choose |
Details
The tests argument is a character vector. Each element has one of the forms
TEST, TEST_UG, TEST_ML, TEST_RLS, TEST_UG_ML, or TEST_UG_RLS.
For example, SB_UG_RLS.
The first part names the test. The available names are listed below.
Add
UGto use the unbiased estimator of the fourth-order moment matrix from Du and Bentler (2022). Leave it out to use the standard biased matrix. Performance depends on the data-generating process, so neither gamma choice dominates in every setting.The final part chooses the chi-square statistic.
MLuses the normal-discrepancy statistic (Bollen, 1989).RLSuses Browne's (1974) reweighted least squares statistic.
The peba method is the recommended default. It partitions the eigenvalues
into j equally sized sets (if not possible, the smallest set is incomplete),
shrinks them towards their common mean, and averages within each set. Provide
a positive integer j no greater than the test df. Values from 2 through
6 are usually good candidates. The method was introduced by Foldnes, Moss,
and Grønneberg
(2025).
pols is a penalized regression method with a finite positive penalization
term. Foldnes, Moss, and Grønneberg (2025) studied pols=2, which has
good performance in a variety of contexts.
pall penalizes all eigenvalues in ugamma, while all uses all eigenvalues
without penalization. pall is the recommended option for nested models, for
which the penalized methods were extended and evaluated by Foldnes,
Grønneberg, and Moss (2026).
The eba method is the unpenalized predecessor of peba (Foldnes and
Grønneberg, 2018). It averages within the eigenvalue blocks without
shrinkage. peba usually performs better. eba remains available for
comparisons, and values from j=2 through j=4 tend to work best.
Familiar corrections are available too:
-
stduses the ordinary chi-square reference distribution. -
sbgives the Satorra–Bentler p-value (Satorra and Bentler, 1994). -
ssgives the scaled and shifted p-value (Asparouhov and Muthén, 2010). -
sfgives the scaled F p-value (Wu and Lin, 2016).
Estimators and data types
semTests-support (?semTests-support) gives the complete matrix of
supported estimators, data types, and configurations. Here is the short
version.
The limiting null law of the test statistic is a weighted sum of
chi-squares for any minimum-discrepancy estimator. pvalues() supports
ML/MLM/MLR, GLS, ULS,
FIML (missing data), and categorical DWLS/ULS families, with single- and
multi-group continuous, ordered, and mixed-indicator fits.
pvalues_nested() supports continuous estimators and categorical
Satorra-2000 comparisons with a delta restriction map. The fitted model must
expose the asymptotic moment covariance. Robust choices such as
test = "satorra.bentler" or estimator = "MLM", "MLR", or "DWLS"
provide it. The RLS statistic (browne.residual.nt.model) and the unbiased
(UG) Du-Bentler gamma are defined for the classical continuous,
complete-data, random-x ML case. Other families use the standard statistic
and biased gamma. Fixed or conditional observed exogenous predictors are
currently refused. Full WLS/ADF is refused outright: its weight is already
the inverse moment covariance, so the correction is exactly the identity and
every test would equal the ordinary chi-square.
GLS, ULS, categorical DWLS/ULS, FIML missing data, and nested FIML or categorical comparison are validated to numerical tolerance against an independent implementation and are marked stable; see the Stability section in semTests-support.
Both entry points require a converged fit and warn if lavaan reports an
inadmissible solution. Nested comparisons require the same requested
estimator, fitting conventions, variables, groups, sample sizes, raw data,
and missingness mask. semTests checks comparability. The substantive
nesting argument remains part of the analysis.
For FIML, fiml.convention = "observed" (the default) uses observed
saturated and model information throughout. An independent implementation
validates this construction. The "lavaan" option reproduces lavaan
0.7-2's robust-test construction. For a single model it uses lavaan's
inspected UGamma. For nested models it uses lavaan's H1 weight convention
and selected model information. The returned object records the convention,
which keeps this inferential choice visible in saved results.
For a single FIML model, "lavaan" means the eigenvalue spectrum returned by
lavInspect(fit, "UGamma"). The scalar Yuan–Bentler–Mplus test stored by a
default MLR fit is a different correction and may give a different result.
For nested FIML models, "lavaan" reproduces
lavTestLRT(..., method = "satorra.2000").
Value
A named numeric vector of p-values, of class semTests_pvalues,
carrying an "semtests" attribute that records the requested tests,
requested and base estimator, base-statistic and gamma choices,
information type, data type, parameterization where applicable, nested
method and restriction map where applicable, and degrees of freedom.
References
Foldnes, N., Moss, J., & Grønneberg, S. (2025). Improved goodness of fit procedures for structural equation models. Structural Equation Modeling: A Multidisciplinary Journal, 32(1), 1–13. doi:10.1080/10705511.2024.2372028
Foldnes, N., Grønneberg, S., & Moss, J. (2026). Penalized eigenvalue block averaging: Extension to nested model comparison and Monte Carlo evaluations. Behavior Research Methods, 58, article 107. doi:10.3758/s13428-026-02968-4
Satorra, A. (2000). Scaled and adjusted restricted tests in multi-sample analysis of moment structures. In R. D. H. Heijmans, D. S. G. Pollock, & A. Satorra (Eds.), Innovations in Multivariate Statistical Analysis (pp. 233–247). Kluwer Academic. doi:10.1007/978-1-4615-4603-0_17
Satorra, A., & Bentler, P. M. (2001). A scaled difference chi-square test statistic for moment structure analysis. Psychometrika, 66(4), 507–514. doi:10.1007/BF02296192
Satorra, A., & Bentler, P. M. (1994). Corrections to test statistics and standard errors in covariance structure analysis. In A. von Eye & C. C. Clogg (Eds.), Latent Variables Analysis: Applications for Developmental Research (pp. 399–419). Sage.
Asparouhov, T., & Muthén, B. O. (2010). Simple second order chi-square correction. Mplus Technical Appendix. https://www.statmodel.com/download/WLSMV_new_chi21.pdf
Wu, H., & Lin, J. (2016). A Scaled F Distribution as an Approximation to the Distribution of Test Statistics in Covariance Structure Analysis. Structural Equation Modeling. doi:10.1080/10705511.2015.1057733
Foldnes, N., & Grønneberg, S. (2018). Approximating Test Statistics Using Eigenvalue Block Averaging. Structural Equation Modeling, 25(1), 101–114. doi:10.1080/10705511.2017.1373021
Du, H., & Bentler, P. M. (2022). 40-Year Old Unbiased Distribution Free Estimator Reliably Improves SEM Statistics for Nonnormal Data. Structural Equation Modeling: A Multidisciplinary Journal, 29(6), 872–887. doi:10.1080/10705511.2022.2063870
Kenward, M. G., & Molenberghs, G. (1998). Likelihood based frequentist inference when data are missing at random. Statistical Science, 13(3), 236–247. doi:10.1214/ss/1028905886
Bollen, K. A. (1989). Structural Equations with Latent Variables. John Wiley & Sons. doi:10.1002/9781118619179
Browne, M. W. (1974). Generalized least squares estimators in the analysis of covariance structures. South African Statistical Journal, 8, 1–24.
See Also
semTests-support for the full list of supported configurations.
Examples
library("semTests")
library("lavaan")
model <- "visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9"
object <- cfa(model, HolzingerSwineford1939, estimator = "MLM")
pvalues(object)
# For the pEBA6 method with biased gamma and ML chisq statistic:
pvalues(object, "pEBA6_ML")
# Nested model comparison (constrain the textual loadings to be equal):
constrained <- "visual =~ x1 + x2 + x3
textual =~ a*x4 + a*x5 + a*x6
speed =~ x7 + x8 + x9"
m1 <- cfa(model, HolzingerSwineford1939, estimator = "MLM")
m0 <- cfa(constrained, HolzingerSwineford1939, estimator = "MLM")
pvalues_nested(m0, m1)
Requested lavaan estimator, before shortcut normalization.
Description
Requested lavaan estimator, before shortcut normalization.
Usage
requested_estimator(fit)
Calculate the scaled_f p-value.
Description
Calculate the scaled_f p-value.
Usage
scaled_f(chisq, eig)
Arguments
chisq |
Chi-square fit value from a lavaan object. |
eig |
eig of UG matrix. |
Value
scaled f p-value.
Supported estimators, data types, and configurations
Description
Use this page to check what pvalues() and pvalues_nested() support.
The eigenvalue-based p-values target a limiting null law that is a weighted
sum of chi-squares. This result holds for any minimum-discrepancy estimator
and therefore includes estimators beyond normal-theory ML. The tables below
give the supported combinations. Configurations outside them are refused at
the entry point (see check_supported()), and the test suite follows the
same boundary.
Details
Single-model (pvalues())
| Estimator | Data | Groups | Missing | Availability | Stability |
| ML / MLM / MLR | continuous | single or multi | complete | available | stable |
| GLS | continuous | single or multi | complete | available | stable |
| ULS | continuous | single or multi | complete | available | stable |
| ML / MLR (FIML) | continuous | single or multi | FIML | available | stable |
| DWLS family | ordered/mixed | single or multi | listwise/pairwise | available | stable |
| ULS family | ordered/mixed | single or multi | listwise/pairwise | available | stable |
| WLS (ADF) | continuous | single or multi | complete | rejected | -- |
| WLS (ADF) | ordered/mixed | single or multi | listwise/pairwise | rejected | -- |
Nested (pvalues_nested())
| Estimators | Data | Groups | Missing | Method | A.method | Availability | Stability |
| ML/MLM/MLR | continuous | single or multi | complete | 2000 | -- | available | stable |
| GLS, ULS | continuous | single or multi | complete | 2000 | -- | available | stable |
| ML / MLR (FIML) | continuous | single or multi | FIML (both fits) | 2000 only | exact or delta | available | stable |
| DWLS/ULS families | ordered/mixed | single or multi | listwise/pairwise | 2000 only | delta only | available | stable |
| any | continuous | -- | mixed / non-FIML | -- | -- | rejected | -- |
Stability
The classical normal-theory ML path (continuous, complete data) is the mature,
paper-backed core. The other supported estimators – GLS, ULS, categorical
DWLS/ULS fits, FIML missing-data fits, and their nested comparisons – are
also marked stable: each is validated to numerical tolerance against an
independent implementation (magmaan) across a simulation battery, in addition
to the deterministic implementation tests every available row carries. The
fiml.convention = "lavaan" option reproduces lavaan's own spectrum for
compatibility rather than as an independently validated construction.
Configurations outside the tables are refused at the entry point.
Observed exogenous covariates
Observed exogenous predictors are supported when they are modeled jointly
with the other variables. In lavaan, request this random-x analysis with
fixed.x = FALSE and conditional.x = FALSE. The independent validation
suite covers continuous ML, GLS, ULS, FIML, and mixed categorical DWLS in
this setting, for single models and nested comparisons.
Fixed or conditional observed exogenous predictors are currently refused. Their reference distribution conditions on the realized covariate design and needs a separate saturated-model projection. If a covariate is intended to be fixed, keep that scientific choice and do not silently change it to random merely to pass the software check.
Fit quality and nested comparability
Both entry points require converged lavaan fits and warn when lavaan's post-estimation check reports an inadmissible solution. Nested comparisons additionally require the same requested estimator, fitting conventions, observed variables, groups, sample sizes, raw data, and missingness mask. These checks establish comparability. The scientific argument that one model is genuinely nested within the other still belongs in the analysis.
The constrained model belongs in m0. If the models are supplied in reverse
df order, semTests warns and swaps them. Only the Satorra-2000 reduction is
available. method = "2001" has been withdrawn because it performs poorly.
Statistic and gamma options
Test names use one of TEST, TEST_UG, TEST_ML, TEST_RLS,
TEST_UG_ML, or TEST_UG_RLS (e.g. "SB_UG_RLS"). See pvalues() for the
test families. Two of the options are defined only for the classical case:
The RLS statistic (
browne.residual.nt.model, Browne 1974) and theUG(Du-Bentler) unbiased gamma are available only for classical normal-theory ML with continuous, complete data,estimator = "ML",fixed.x = FALSE, andconditional.x = FALSE. lavaan degrades RLS to ADF elsewhere, and the Du-Bentler correction has no derivation for the other families or a fixed covariate design.semTestsrefuses either request and points you to the standard statistic and biased gamma.-
Categorical and mixed-indicator fits use lavaan's biased inspected
UGammaspectrum and unscaled estimator statistic directly. Supported estimator families are DWLS (including WLSMV/WLSM/WLSMVS) and ULS (including ULSMV). Nested comparison is restricted tomethod = "2000"andA.method = "delta". -
Pairwise categorical missingness means support for lavaan's pairwise sample-statistic and
UGammacalculation. Pairwise deletion has its own missingness assumptions and does not provide FIML or generally MAR-valid inference. -
FIML (missing data) uses the biased gamma and the standard statistic only.
UGandRLSare refused. FIML supports one or several groups with continuous data. Observed exogenous predictors are supported under joint random-x inference, usingfixed.x = FALSEandconditional.x = FALSE.fiml.convention = "observed"(the default) uses observed saturated and model information, following the recommendation of Kenward and Molenberghs (1998), and is independently validated against magmaan."lavaan"reproduces lavaan 0.7-2's inspected robust-test spectrum, including its expected H1 weight.
Why full WLS/ADF is refused
For full WLS (ADF), with continuous or categorical sample statistics, the
fitting weight is already the inverse of the asymptotic moment covariance, so
UGamma is a projector: its nonzero eigenvalues are all exactly one and the
eigenvalue correction collapses to the identity. Every robust p-value would
therefore equal the ordinary 1 - pchisq(chisq, df). Because the correction
adds nothing, full WLS is refused at the entry point. Fit a DWLS/ULS family
for a non-degenerate robust test, or read the standard chi-square directly.
References
Foldnes, N., Moss, J., & Grønneberg, S. (2025). Improved goodness of fit procedures for structural equation models. Structural Equation Modeling: A Multidisciplinary Journal, 32(1), 1–13. doi:10.1080/10705511.2024.2372028
Foldnes, N., Grønneberg, S., & Moss, J. (2026). Penalized eigenvalue block averaging: Extension to nested model comparison and Monte Carlo evaluations. Behavior Research Methods, 58, article 107. doi:10.3758/s13428-026-02968-4
Kenward, M. G., & Molenberghs, G. (1998). Likelihood based frequentist inference when data are missing at random. Statistical Science, 13(3), 236–247. doi:10.1214/ss/1028905886
Satorra, A. (2000). Scaled and adjusted restricted tests in multi-sample analysis of moment structures. In R. D. H. Heijmans, D. S. G. Pollock, & A. Satorra (Eds.), Innovations in Multivariate Statistical Analysis (pp. 233–247). Kluwer Academic. doi:10.1007/978-1-4615-4603-0_17
See Also
Signal a typed semTests error.
Description
Signal a typed semTests error.
Usage
semtests_abort(message, subclass = "semTests_error")
Signal a typed semTests warning.
Description
Signal a typed semTests warning.
Usage
semtests_warn(message, subclass = "semTests_warning")
Split string into options.
Description
Split string into options.
Usage
split_input(string)
Arguments
string |
Input string |
Calculate traditional pvalues.
Description
Calculate traditional pvalues.
Usage
trad_pvalue(
df,
chisq,
lambdas,
type = c("std", "sf", "ss", "sb", "pall", "all")
)
Arguments
df, chisq, lambdas, type |
Parameters needed to calculate the p-values. |
Value
Traditional p-values.
Calculate non-nested gamma
Description
Calculate non-nested gamma
Usage
ugamma(object, unbiased = 1)
Extract a stable leading UGamma spectrum.
Description
The theoretical spectrum is real and non-negative. Small negative or imaginary components arise from the nonsymmetric numerical representation of a matrix that is similar to a symmetric positive-semidefinite product. Numerical negatives are truncated; materially negative values are rejected.
Usage
ugamma_eigenvalues(ugamma, df, context = "UGamma")
Full nested UGamma reference used to validate the reduced implementation.
Description
Full nested UGamma reference used to validate the reduced implementation.
Usage
ugamma_nested_reference(m0, m1, unbiased = 1)
Validate public test specifications.
Description
Validate public test specifications.
Usage
validate_tests(tests)
Arguments
tests |
Character vector supplied to the public |
Value
tests, invisibly.