psychonetrics is an R package that unifies structural equation modeling (SEM) and network analysis under a single framework. The core innovation is simple but powerful: any variance-covariance matrix in a model can be parameterized as a Gaussian Graphical Model (GGM), where edges represent partial correlations—i.e., conditional independence relationships between variables.
This means that standard psychometric models—confirmatory factor analysis, structural equation models, vector autoregressive models—can all be extended with network structures. A latent covariance matrix can become a latent network. Residual covariances can become a residual network. The package provides maximum likelihood estimation, model fit testing, and automated model search for all of these models.
More generally, any variance-covariance structure Σ in the model can be decomposed in one of five ways:
| Type | Decomposition | Interpretation |
|---|---|---|
cov | Σ (direct) | Covariance matrix |
chol | Σ = LL′ | Cholesky decomposition |
prec | Σ = K−1 | Precision (inverse covariance) matrix |
ggm | Σ = Δ(I − Ω)−1Δ | Gaussian Graphical Model (network) |
cor | Σ = SD · P · SD | Correlation matrix |
Furthermore, the package includes powerful exploratory search algorithms and offers novel modeling capabilities for longitudinal data (vector-autoregression), binary data (Ising model), and ill-defined latent variable models (Cholesky decomposition).
Specify, estimate, and test hypothesized network structures with full model fit statistics.
Compare networks and SEM models across groups with flexible equality constraints and invariance testing.
ML, FIML (missing data), PML/PFIML (penalized)*, WLS, DWLS, and WLSMV* estimation.
Pruning, stepwise search, and combined strategies guided by modification indices and information criteria.
LASSO, Ridge, and Elastic Net regularization with automatic penalty selection via EBIC.
Continuous, ordinal*, and binary data. Cross-sectional, time-series, and panel data. Raw data or summary statistics.
Full Information Maximum Likelihood (FIML) for handling missing data without listwise deletion.
Core computations in C++ via Rcpp and RcppArmadillo for fast estimation, even with large models.
* Experimental feature — not yet fully validated.
Models a variance-covariance matrix directly. Use the GGM parameterization to estimate network models of observed variables, including multi-group comparisons.
Wrappers: ggm(), precision(), cholesky(), corr()
Latent variable models (CFA / SEM) where latent and residual covariances can be modeled as networks. Supports bifactor models and latent growth curves.
Wrappers: lnm(), rnm(), lrnm(), bifactor(), latentgrowth()
Network model for binary/dichotomous data based on the Ising model from statistical physics. Models pairwise interactions between binary nodes.
Function: Ising()
Lag-1 vector autoregressive models for time-series data. The contemporaneous covariance structure can be modeled as a GGM (graphical VAR). Extracts temporal (PDC) and contemporaneous (PCC) networks.
Wrappers: gvar()
Dynamic latent variable models for panel data. Decomposes temporal dynamics, within-person contemporaneous relations, and between-person individual differences into separate network structures.
Wrappers: panelgvar(), panelvar(), panellvgvar()
# Install from CRAN:
install.packages("psychonetrics")
# Or install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("SachaEpskamp/psychonetrics")
# Load the package:
library("psychonetrics")
The typical psychonetrics workflow follows a pipe-based pattern:
library("psychonetrics")
library("dplyr")
# 1. Specify a model (e.g., a Gaussian Graphical Model):
model <- ggm(data, vars = vars, omega = "full")
# 2. Estimate:
model <- model %>% runmodel
# 3. Inspect results:
model %>% fit # Fit indices (chi-square, CFI, RMSEA, BIC, ...)
model %>% parameters # Parameter estimates with SEs and p-values
model %>% MIs # Modification indices
# 4. Modify and compare:
model_pruned <- model %>% prune(alpha = 0.01) # Remove non-significant edges
model_final <- model_pruned %>% stepup # Add edges by modification index
compare(saturated = model, pruned = model_pruned, final = model_final)
See the General Tutorial for a comprehensive walkthrough.
If you use psychonetrics in your research, please cite the following papers:
BibTeX entries:
@article{epskamp2020psychometric,
author = {Epskamp, Sacha},
title = {Psychometric network models from time-series and panel data},
journal = {Psychometrika},
volume = {85},
number = {1},
pages = {206--231},
year = {2020},
doi = {10.1007/s11336-020-09697-3}
}
@article{epskamp2022meta,
author = {Epskamp, Sacha and Isvoranu, Adela-Maria and Cheung, Mike W.-L.},
title = {Meta-analytic {G}aussian network aggregation},
journal = {Psychometrika},
volume = {87},
number = {1},
pages = {12--46},
year = {2022},
doi = {10.1007/s11336-021-09764-3}
}