Latent Variable Models Diagnostics
Overview
Diagnostics and visualization tools for latent variable models fitted with 'lavaan' (Rosseel, 2012 doi:10.18637/jss.v048.i02). The package provides fast, parallel-safe factor-score prediction (lavPredict_parallel()), data augmentation with model predictions, residuals, delta-method standard errors and confidence intervals (augment()), and model-based latent grids for continuous, ordinal, or mixed indicators (prepare()). It offers item-level empirical versus model curve comparison using generalized additive models for both continuous and ordinal indicators (item_data(), item_plot()) via 'mgcv' (Wood, 2017, ISBN:9781498728331), residual diagnostics including residual correlation tables and plots (resid_cor(), resid_corrplot()) using 'corrplot' (Wei and Simko, 2021 https://github.com/taiyun/corrplot), and Q–Q checks of residual z-statistics (resid_qq()), optionally with non-overlapping labels from 'ggrepel' (Slowikowski, 2024 https://CRAN.R-project.org/package=ggrepel). Heavy computations are parallelized via 'future'/'furrr' (Bengtsson, 2021 doi:10.32614/RJ-2021-048; Vaughan and Dancho, 2018 https://CRAN.R-project.org/package=furrr). Methods build on established literature and packages listed above.
- **Initial CRAN release.**
- Provides diagnostics and visualization tools for latent variable models fitted with
lavaanorblavaan.
Core functionality
augment()— augments fitted models with predicted values, residuals, SEs, and CIs (continuous, ordinal, or mixed indicators).prepare()— constructs model-based item curves and latent grids for continuous/ordinal indicators.lavPredict_parallel()— robust, parallel wrapper forlavaan::lavPredict()with automatic handling of ordinal data.
Item-level diagnostics
item_data()— extracts model-based and empirical item-level information for plotting or inspection.item_plot()— visualizes empirical vs. model-implied item curves, including confidence intervals.
Residual diagnostics
resid_cor()— computes residual (co)relations and z-statistics.resid_corrplot()— visualizes residual correlations usingcorrplot.
Show all changes in 0.1.0Hide the rest of the changes in 0.1.0
resid_qq()— draws Q–Q plots of residual correlation z-statistics.
Model summaries and utilities
parameter_estimates()— enhanced extraction of standardized parameter estimates with robust SEs.model_info()— extracts compact model metadata (grouping, variables, parameterization, etc.).hopper_plot()— summarizes fit indices and modification indices across multiple models.
From NEWS.md in the release
Install
Health
CRAN check results are not tracked yet.
- OK14 OK2026-03-10
Documentation
- Help pages
- 12
- Examples that run
- 67%8 run in a plain check · 4 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 100%
- Documented parameters
- 94%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Dependencies
Code & Tests
People & History
- archivedRemoved from CRAN2026-05-15policy violation Attempts to use all CPU cores
- RR 4.6.0 released · 2026-04-24
- 0.1.02026-01-17
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2026-01-17
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 83 KB
Cite
Cite this package
Run in R for the authors' entry:
citation("lavDiag")The package provides a citation file, so citation() returns the authors' own entry.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.