Learn R Programming

⚠️There's a newer version (2.32.1) of this package.Take me there.

rstanarm

This is an R package that emulates other R model-fitting functions but uses Stan (via the rstan package) for the back-end estimation. The primary target audience is people who would be open to Bayesian inference if using Bayesian software were easier but would use frequentist software otherwise.

Installation

Latest Release

The most recent rstanarm release can be installed from CRAN via

install.packages("rstanarm")

Development Version

To install from GitHub, first make sure that you can install the rstan package and C++ toolchain by following these instructions. Once rstan is successfully installed, you can install rstanarm from GitHub using the devtools package by executing the following in R:

if (!require(devtools)) {
  install.packages("devtools")
  library(devtools)
}
install_github("stan-dev/rstanarm", args = "--preclean", local = FALSE, build_vignettes = TRUE)

Make sure to include the args = "--preclean" argument or the development version of package will not install properly. If installation fails, please let us know by filing an issue.

Getting help

Contributing

If you are interested in contributing to the development of rstanarm please see the Contributing to development page of the wiki.

Copy Link

Version

Install

install.packages('rstanarm')

Monthly Downloads

12,100

Version

2.13.1

License

GPL (>=3)

Maintainer

Ben Goodrich

Last Published

January 19th, 2024

Functions in rstanarm (2.13.1)

model.matrix.stanreg

model.matrix method for stanreg objects
rstanarm-package

Applied Regression Modeling via RStan
se

Extract standard errors
predict.stanreg

Predict method for stanreg objects
neg_binomial_2

Family function for negative binomial GLMs
pp_validate

Model validation via simulation
print.kfold

Print method for kfold
print.stanreg

Print method for stanreg objects
stan_gamm4

Bayesian generalized linear additive models with group-specific terms via Stan
stan_glm

Bayesian generalized linear models via Stan
adapt_delta

Target average acceptance probability
example_model

Example model
shinystan

Using the ShinyStan GUI with rstanarm models
stan_biglm

Bayesian regularized linear but big models via Stan
terms.stanreg

terms method for stanreg objects
posterior_predict.stanreg

Draw from posterior predictive distribution
pp_check.stanreg

Graphical posterior predictive checks
loo.stanreg

Leave-one-out (LOO) and K-fold cross-validation
model.frame.stanreg

model.frame method for stanreg objects
prior_summary.stanreg

Extract and/or print a summary of the priors used for an rstanarm model
priors

Prior distributions and options
stan_polr

Bayesian ordinal regression models via Stan
get_y

Extract X, Y or Z from a stanreg object
log_lik.stanreg

Pointwise log-likelihood matrix
family.stanreg

family method for stanreg objects
formula.stanreg

formula method for stanreg objects
stan_glmer

Bayesian generalized linear models with group-specific terms via Stan
stan_aov

Bayesian regularized linear models via Stan
pairs.stanreg

Pairs method for stanreg objects
posterior_linpred

Posterior distribution of the linear predictor
stanreg-objects

Fitted model objects