A tidy workflow for generating, estimating, reporting, and plotting structural equation models using ‘lavaan’, ‘OpenMx’, or ‘Mplus’. Throughout this workflow, elements of syntax, results, and graphs are represented as ‘tidy’ data, making them easy to customize. Includes functionality to estimate latent class analyses, and to plot ‘dagitty’ and ‘igraph’ objects.
The tidySEM package offers the following functionality:
- Generate SEM model syntax in a top-down, tidy way, regardless of what software is used to estimate it
- Tabulate model output in a publication-ready, uniform manner,
- Make easily customizable graphs for SEM-models,
- Estimate latent class analyses / mixture models in
OpenMx
These functions are designed with the tidy tools manifesto (Wickham, last updated 23-11-2019) in mind, and interface with the existing suite of packages in the tidyverse.
Installation
You can install the public release of tidySEM from CRAN with:
install.packages("tidySEM")You can install the development version of metamixture from GitHub with:
# install.packages("pak")
pak::pak("cjvanlissa/tidySEM")Documentation
Every user-facing function in the package is documented, and the documentation can be accessed by running ?function_name in the R console, e.g., ?graph_sem.
Furthermore, the tidySEM package includes the following vignettes:
Structural Equation Modeling in General
- Generating syntax and estimating models: Generate model syntax and estimate structural equation models.
- Tabulating results: Extract, format, and report model parameters and fit statistics.
- Plotting graphs: Create and customize graphical representations of structural equation models.
- Graphing conventions for SEM: Understand the graphical notation and conventions used to represent structural equation models.
- Ordinal modeling in OpenMx: Specify ordinal measurement models in OpenMx, including thresholds and their parameterization.
Latent Class Analysis / Mixture Modeling
- Introduction to latent class analysis: An introduction to latent class and profile analysis, covering data preparation, model estimation, class enumeration, interpretation, and reporting.
- Exploratory latent class analysis: Explore latent class solutions and determine the appropriate number of classes.
- Confirmatory latent class analysis: Specify and test theoretically motivated latent class models.
- Latent class analysis with ordinal indicators: Estimate and interpret latent class models with ordered categorical indicators.
- Mixed-indicator latent class analysis: Estimate latent class models combining continuous and categorical indicators.
- Latent class growth analysis: Identify latent classes with distinct longitudinal trajectories.
- Auxiliary variable analyses: Examine relationships between latent class membership and external variables using BCH, two-step maximum likelihood, and pseudo-class methods.
- PMC tutorial: Compare competing mixture models using Predictive Model Comparison.
- SMART-LCA checklist: Apply reporting guidelines and recommended practices to improve the transparency and reproducibility of latent class analyses.
Citing tidySEM
Van Lissa CJ (????). tidySEM: Tidy Structural Equation Modeling. R package version 0.3.0, https://cjvanlissa.github.io/tidySEM/.
To cite the latent class analysis functionality in tidySEM, cite:
Van Lissa, C. J., Garnier-Villarreal, M., & Anadria, D. (2023). Recommended Practices in Latent Class Analysis using the Open-Source R-Package tidySEM. Structural Equation Modeling. https://doi.org/10.1080/10705511.2023.2250920
Contributing and Contact Information
If you have ideas, please get involved. You can contribute by opening an issue on ‘GitHub’, or sending a pull request with proposed features (see further instructions below).
By participating in this project, you agree to abide by the Contributor Covenant.
Pull requests
- Please always contribute via pull request instead of committing to master, so I can review the contribution.
- You can either fork the repository to your own account and then submit a pull request, or make minor changes directly on this repository, and choose to commit them to a different branch and send a pull request when you save those changes
- If you fix an issue, in your Commit message, please write “closes #issuenumber” so we can trace which commits fixed which issues
- Please add a line to NEWS.md for each bug fix or feature contribution
- Please increment the minor version number in DESCRIPTION, e.g.: 0.2.3.1 -> 0.2.3.2
