Robust Test Statistics for Structural Equation Models

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) , including their extension to nested models (Foldnes, Grønneberg, Moss, 2026) , 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. Score and criterion-difference tests of parameter restrictions are also available, including restrictions in misspecified models.


semTests semTests logo

CRAN_Status_Badge R-CMD-check Codecov testcoverage Project Status:Active

semTests computes robust p-values for structural equation models fitted with lavaan: tests of overall fit, nested model comparisons, and score and criterion-difference tests of parameter restrictions. It implements penalized eigenvalue block averaging and penalized regression (Foldnes, Moss, and Grønneberg, 2025) and their extension to nested models (Foldnes, Grønneberg, and Moss, 2026). It supports ML, GLS, ULS, categorical DWLS and ULS, and FIML, with one or several groups.

Installation

install.packages("semTests")
# Development version:
# remotes::install_github("JonasMoss/semTests")

Example

library("semTests")
model <- "visual  =~ x1 + x2 + x3
          textual =~ x4 + x5 + x6
          speed   =~ x7 + x8 + x9"
fit <- lavaan::cfa(model, lavaan::HolzingerSwineford1939)
pvalues(fit)
#>    peba4_rls 
#> 5.165712e-07 
#> estimator: ML | data: continuous | information: expected | df: 24

To test a restriction, fit the restricted model and pass it first:

restricted <- "visual  =~ x1 + a*x2 + a*x3
               textual =~ x4 + x5 + x6
               speed   =~ x7 + x8 + x9"
fit0 <- lavaan::cfa(restricted, lavaan::HolzingerSwineford1939)
pvalues_nested(fit0, fit)
#> pall_ug_ml 
#> 0.06061142 
#> estimator: ML | data: continuous | information: expected | df: 1 | nested (method 2000, A.method delta)
semtest(fit0, fit)
#> score test: Common criterion pseudo-target satisfies the restricted model 
#>   type statistic df rank      reference    p_value
#>  score  2.770785  1    1 weighted_chisq 0.06131629
#>                                                     hypothesis
#>  Common criterion pseudo-target satisfies the restricted model

Learn more

  • vignette("semTests", package = "semTests"): getting started
  • vignette("categorical-data", package = "semTests"): ordinal indicators and measurement invariance
  • vignette("fiml-missing-data", package = "semTests"): missing data with FIML
  • vignette("score-criterion", package = "semTests"): score and criterion tests

?semTests-support lists every supported combination, and citation("semTests") shows how to cite the package. Bugs and ideas go to GitHub issues.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("semTests")

2.0.0 by Jonas Moss, 7 days ago


https://github.com/JonasMoss/semTests


Browse source code at https://github.com/cran/semTests


Authors: Jonas Moss [aut, cre] , Njål Foldnes [ctb] , Steffen Grønneberg [ctb] (ORCID:


Documentation:   PDF Manual  


GPL (>= 3) license


Imports lavaan, methods, pbivnorm

Suggests testthat, knitr, rmarkdown


See at CRAN