Learn R Programming

blavaan

blavaan is a free, open source R package for Bayesian latent variable analysis. It relies on JAGS and Stan to estimate models via MCMC.

The blavaan functions and syntax are similar to lavaan. For example, consider the Political Democracy example from Bollen (1989):

library(lavaan) # for the PoliticalDemocracy data
library(blavaan)

model <- '
   # latent variable definitions
     ind60 =~ x1 + x2 + x3
     dem60 =~ y1 + y2 + y3 + y4
     dem65 =~ y5 + y6 + y7 + y8
   # regressions
     dem60 ~ ind60
     dem65 ~ ind60 + dem60
   # residual covariances
     y1 ~~ y5
     y2 ~~ y4 + y6
     y3 ~~ y7
     y4 ~~ y8
     y6 ~~ y8
'
fit <- bsem(model, data = PoliticalDemocracy)
summary(fit)

The development version of blavaan (containing updates not yet on CRAN) can be installed via the command below. Compilation is required; this may be a problem for users who currently rely on a binary version of blavaan from CRAN.

remotes::install_github("ecmerkle/blavaan", INSTALL_opts = "--no-multiarch")

For further information, see:

Merkle, E. C., Fitzsimmons, E., Uanhoro, J., & Goodrich, B. (2021). Efficient Bayesian structural equation modeling in Stan. Journal of Statistical Software, 100(6), 1–22.

Merkle, E. C., & Rosseel, Y. (2018). blavaan: Bayesian structural equation models via parameter expansion. Journal of Statistical Software, 85(4), 1–30.

blavaan is supported by the Institute of Education Sciences, U.S. Department of Education, Grant R305D210044, as well as NSF grants SES-1061334 and 1460719.

Copy Link

Version

Install

install.packages('blavaan')

Monthly Downloads

5,786

Version

0.5-8

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Edgar Merkle

Last Published

January 8th, 2025

Functions in blavaan (0.5-8)

blavFitIndices

SEM Fit Indices for Bayesian SEM
blav_internal

blavaan internal functions
blavInspect

Inspect or Extract Information from a Fitted blavaan Object
blavaan

Fit a Bayesian Latent Variable Model
bcfa

Fit Confirmatory Factor Analysis Models
blavPredict

Predict the values of latent variables, observed variables, and missing variables.
bgrowth

Fit Growth Curve Models
bsem

Fit Structural Equation Models
standardizedPosterior

Standardized Posterior
plot.blavaan

blavaan Diagnostic Plots
blavaan-class

Class For Representing A (Fitted) Bayesian Latent Variable Model
blavCompare

Bayesian model comparisons
dpriors

Specify Default Prior Distributions
ppmc

Posterior Predictive Model Checks
sampleData

Sample data from the posterior (or prior) distribution.