Bayesian Multilevel Mediation

Easy estimation of Bayesian multilevel mediation models with Stan.


bmlm is an R package providing convenient methods for Bayesian estimation of multilevel mediation models using Stan.

For more details, visit the package's website.

Install

To install the latest stable version of bmlm from CRAN, run

install.packages("bmlm")

The latest development version of bmlm requires devtools for installation. If you don't have the devtools package installed in R, first run this line:

install.packages("devtools")

Then proceed to install bmlm:

devtools::install_github("mvuorre/bmlm", args = "--preclean")

bmlm ships with an example data set from Intensive Longitudinal Methods: An Introduction to Diary and Experience Sampling Research (Bolger & Laurenceau, 2013, chapter 9). To estimate the multilevel mediation model presented in that chapter, run:

library(bmlm)
data(BLch9)
fit <- mlm(BLch9)

After a while, you will have a joint posterior distribution of plausible parameter values from the model applied to this data. Inspect the model:

mlm_summary(fit)

Information

Please contact the author of the package for questions and suggestions. I recommend creating a new issue on GitHub.

Citation

If you use this software, please cite it:

citation("bmlm")
#> To cite package bmlm in publications, please use:
#> 
#>   Vuorre, M., (2016). bmlm: Bayesian Multilevel Mediation. R
#>   package version 1.2.1. https://cran.r-project.org/package=bmlm
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Manual{,
#>     title = {bmlm: Bayesian Multilevel Mediation},
#>     author = {Matti Vuorre},
#>     year = {2016},
#>     url = {https://cran.r-project.org/package=bmlm},
#>   }

News

bmlm 1.2.9

Removed sigma_y from being modeled when binary_y = TRUE.

bmlm 1.2.1

Removed posterior probabilities from default outputs.

Added type = "violin" as option for plotting coefficients with mlm_pars_plot().

bmlm 1.2.0

Users may now change each individual regression parameter's prior, instead of classes of priors.

Users may now change the shape parameter of the LKJ prior.

bmlm 1.1.1

Coefficient plots now reorder parameter estimates, if user has requested varying effects.

Path plot now by default does not scale the edges.

bmlm 1.1.0

bmlm now uses pre-compiled C++ code for the Stan models, which eliminates the need to compile a model each time mlm() is run. This significantly speeds up model estimation.

The Stan code used by mlm() is now built from separate chunks, allowing more flexible and robust model development.

bmlm 1.0.0

Initial release to CRAN.

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("bmlm")

1.3.0 by Matti Vuorre, 2 months ago


https://github.com/mvuorre/bmlm/


Report a bug at http://github.com/mvuorre/bmlm/issues/


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


Authors: Matti Vuorre [aut, cre]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports rstan, ggplot2, methods

Depends on Rcpp

Suggests qgraph, knitr, rmarkdown, reshape2, dplyr, ReporteRs

Linking to StanHeaders, rstan, BH, Rcpp, RcppEigen


See at CRAN