Package: brms 2.22.6

Paul-Christian Bürkner

brms: Bayesian Regression Models using 'Stan'

Fit Bayesian generalized (non-)linear multivariate multilevel models using 'Stan' for full Bayesian inference. A wide range of distributions and link functions are supported, allowing users to fit -- among others -- linear, robust linear, count data, survival, response times, ordinal, zero-inflated, hurdle, and even self-defined mixture models all in a multilevel context. Further modeling options include both theory-driven and data-driven non-linear terms, auto-correlation structures, censoring and truncation, meta-analytic standard errors, and quite a few more. In addition, all parameters of the response distribution can be predicted in order to perform distributional regression. Prior specifications are flexible and explicitly encourage users to apply prior distributions that actually reflect their prior knowledge. Models can easily be evaluated and compared using several methods assessing posterior or prior predictions. References: Bürkner (2017) <doi:10.18637/jss.v080.i01>; Bürkner (2018) <doi:10.32614/RJ-2018-017>; Bürkner (2021) <doi:10.18637/jss.v100.i05>; Carpenter et al. (2017) <doi:10.18637/jss.v076.i01>.

Authors:Paul-Christian Bürkner [aut, cre], Jonah Gabry [ctb], Sebastian Weber [ctb], Andrew Johnson [ctb], Martin Modrak [ctb], Hamada S. Badr [ctb], Frank Weber [ctb], Aki Vehtari [ctb], Mattan S. Ben-Shachar [ctb], Hayden Rabel [ctb], Simon C. Mills [ctb], Stephen Wild [ctb], Ven Popov [ctb], Ioannis Kosmidis [ctb]

brms_2.22.6.tar.gz
brms_2.22.6.zip(r-4.5)brms_2.22.6.zip(r-4.4)brms_2.22.6.zip(r-4.3)
brms_2.22.6.tgz(r-4.4-any)brms_2.22.6.tgz(r-4.3-any)
brms_2.22.6.tar.gz(r-4.5-noble)brms_2.22.6.tar.gz(r-4.4-noble)
brms_2.22.6.tgz(r-4.4-emscripten)brms_2.22.6.tgz(r-4.3-emscripten)
brms.pdf |brms.html
brms/json (API)
NEWS

# Install 'brms' in R:
install.packages('brms', repos = c('https://staffanbetner.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/paul-buerkner/brms/issues

Datasets:
  • epilepsy - Epileptic seizure counts
  • inhaler - Clarity of inhaler instructions
  • kidney - Infections in kidney patients
  • loss - Cumulative Insurance Loss Payments

On CRAN:

bayesian-inferencebrmsmultilevel-modelsstanstatistical-models

16.49 score 1.3k stars 31 packages 13k scripts 24k downloads 316 mentions 304 exports 73 dependencies

Last updated 3 days agofrom:cbd7a26129. Checks:ERROR: 1 WARNING: 6. Indexed: no.

TargetResultDate
Doc / VignettesFAILNov 18 2024
R-4.5-winWARNINGNov 18 2024
R-4.5-linuxWARNINGNov 18 2024
R-4.4-winWARNINGNov 18 2024
R-4.4-macWARNINGNov 18 2024
R-4.3-winWARNINGNov 18 2024
R-4.3-macWARNINGNov 18 2024

Exports:acatacformulaadd_criterionadd_icadd_ic<-add_looadd_rstan_modeladd_waicararmaas_drawsas_draws_arrayas_draws_dfas_draws_listas_draws_matrixas_draws_rvarsas.brmsprioras.mcmcasym_laplaceautocorbayes_factorbayes_R2bernoulliBetabeta_binomialbfbridge_samplerbrmbrm_multiplebrmsfamilybrmsfit_needs_refitbrmsformulabrmstermscarcategoricalcombine_modelscompare_icconditional_effectsconditional_smoothsconstantcontrol_paramscor_arcor_armacor_arrcor_bstscor_carcor_cosycor_errorsarcor_fixedcor_icarcor_lagsarcor_macor_sarcosycoxcratiocscsecumulativecustom_familydasym_laplacedata_predictordata_responsedbeta_binomialddirichletdefault_priordensity_ratiodexgaussiandfrechetdgen_extreme_valuedhurdle_gammadhurdle_lognormaldhurdle_negbinomialdhurdle_poissondinv_gaussiandirichletdlogistic_normaldmulti_normaldmulti_student_tdo_calldshifted_lnormdskew_normaldstudent_tdvon_misesdwienerdzero_inflated_betadzero_inflated_beta_binomialdzero_inflated_binomialdzero_inflated_negbinomialdzero_inflated_poissonempty_priorexgaussianexponentialexpose_functionsexpp1extract_drawsfcorfixeffrechetgen_extreme_valuegeometricget_dparget_priorget_ygpgrhorseshoehurdle_cumulativehurdle_gammahurdle_lognormalhurdle_negbinomialhurdle_poissonhypothesisinv_logit_scaledis.brmsfitis.brmsfit_multipleis.brmsformulais.brmsprioris.brmstermsis.cor_armais.cor_brmsis.cor_caris.cor_cosyis.cor_fixedis.cor_saris.mvbrmsformulais.mvbrmstermskfoldkfold_predictlassolflog_liklog_posteriorlogistic_normallogit_scaledlogm1lognormallooLOOloo_compareloo_epredloo_linpredloo_model_weightsloo_moment_matchloo_predictloo_predictive_intervalloo_R2loo_subsamplemamake_conditionsmake_stancodemake_standatamarginal_effectsmarginal_smoothsmcmc_plotmemimixturemmmmcmomodel_weightsmultinomialmvbfmvbindmvbrmsformulanchainsndrawsneff_rationegbinomialngrpsniterationsnlfnsamplesnuts_paramsnvariablesopenclparnamesparse_bfpasym_laplacepbeta_binomialpexgaussianpfrechetpgen_extreme_valuephurdle_gammaphurdle_lognormalphurdle_negbinomialphurdle_poissonpinv_gaussianpost_probposterior_averageposterior_epredposterior_intervalposterior_linpredposterior_predictposterior_samplesposterior_smoothsposterior_summaryposterior_tablepp_averagepp_checkpp_expectpp_mixturepredictive_errorpredictive_intervalprepare_predictionspriorprior_prior_drawsprior_samplesprior_stringprior_summarypshifted_lnormpsispskew_normalpstudent_tpvon_misespzero_inflated_betapzero_inflated_beta_binomialpzero_inflated_binomialpzero_inflated_negbinomialpzero_inflated_poissonqasym_laplaceqfrechetqgen_extreme_valueqshifted_lnormqskew_normalqstudent_tR2D2ranefrasym_laplacerbeta_binomialrdirichletread_csv_as_stanfitrecompile_modelreloorename_parsresp_bhazresp_catresp_censresp_decresp_indexresp_miresp_rateresp_seresp_subsetresp_thresresp_trialsresp_truncresp_vintresp_vrealresp_weightsrestructurerexgaussianrfrechetrgen_extreme_valuerhatrinv_gaussianrlogistic_normalrmulti_normalrmulti_student_trows2labelsrshifted_lnormrskew_normalrstudent_trvon_misesrwienerssarsave_parsset_mecorset_nlset_priorset_rescorshifted_lognormalskew_normalsratiostancodestandatastanplotstanvarstudentt2theme_blacktheme_defaultthreadingunstrupdate_adtermsvalidate_newdatavalidate_priorVarCorrvariablesvon_miseswaicWAICweibullwienerxbetazero_inflated_betazero_inflated_beta_binomialzero_inflated_binomialzero_inflated_negbinomialzero_inflated_poissonzero_one_inflated_beta

Dependencies:abindbackportsbayesplotBHbridgesamplingBrobdingnagcallrcheckmateclicodacodetoolscolorspacedescdigestdistributionaldplyrfansifarverfuturefuture.applygenericsggplot2ggridgesglobalsgluegridExtragtableinlineisobandlabelinglatticelifecyclelistenvloomagrittrMASSMatrixmatrixStatsmgcvmunsellmvtnormnleqslvnlmenumDerivparallellypillarpkgbuildpkgconfigplyrposteriorprocessxpsQuickJSRR6RColorBrewerRcppRcppEigenRcppParallelreshape2rlangrstanrstantoolsscalesStanHeadersstringistringrtensorAtibbletidyselectutf8vctrsviridisLitewithr

Readme and manuals

Help Manual

Help pageTopics
Bayesian Regression Models using 'Stan'brms-package brms
Add model fit criteria to model objectsadd_criterion add_criterion.brmsfit
Add model fit criteria to model objectsadd_ic add_ic.brmsfit add_ic<- add_loo add_waic
Add compiled 'rstan' models to 'brmsfit' objectsadd_rstan_model
Additional Response Informationaddition-terms cat cens dec index rate resp_bhaz resp_cat resp_cens resp_dec resp_index resp_mi resp_rate resp_se resp_subset resp_thres resp_trials resp_trunc resp_vint resp_vreal resp_weights se subset thres trials trunc vint vreal weights
Set up AR(p) correlation structuresar
Set up ARMA(p,q) correlation structuresarma
Transform into a brmsprior objectas.brmsprior
Extract Posterior Drawsas.array.brmsfit as.data.frame.brmsfit as.matrix.brmsfit
(Deprecated) Extract posterior samples for use with the 'coda' packageas.mcmc as.mcmc.brmsfit
The Asymmetric Laplace DistributionAsymLaplace dasym_laplace pasym_laplace qasym_laplace rasym_laplace
Autocorrelation structuresautocor-terms
(Deprecated) Extract Autocorrelation Objectsautocor autocor.brmsfit
Bayes Factors from Marginal Likelihoodsbayes_factor bayes_factor.brmsfit
Compute a Bayesian version of R-squared for regression modelsbayes_R2 bayes_R2.brmsfit
The Beta-binomial DistributionBetaBinomial dbeta_binomial pbeta_binomial rbeta_binomial
Log Marginal Likelihood via Bridge Samplingbridge_sampler bridge_sampler.brmsfit
Fit Bayesian Generalized (Non-)Linear Multivariate Multilevel Modelsbrm
Run the same 'brms' model on multiple datasetsbrm_multiple
Special Family Functions for 'brms' Modelsacat asym_laplace bernoulli Beta beta_binomial brmsfamily categorical cox cratio cumulative dirichlet exgaussian exponential frechet gen_extreme_value geometric hurdle_cumulative hurdle_gamma hurdle_lognormal hurdle_negbinomial hurdle_poisson logistic_normal lognormal multinomial negbinomial shifted_lognormal skew_normal sratio student von_mises weibull wiener xbeta zero_inflated_beta zero_inflated_beta_binomial zero_inflated_binomial zero_inflated_negbinomial zero_inflated_poisson zero_one_inflated_beta
Class 'brmsfit' of models fitted with the 'brms' packagebrmsfit brmsfit-class
Set up a model formula for use in 'brms'bf brmsformula
Linear and Non-linear formulas in 'brms'acformula bf-helpers brmsformula-helpers lf nlf set_mecor set_nl set_rescor
Descriptions of 'brmshypothesis' Objectsbrmshypothesis plot.brmshypothesis print.brmshypothesis
Parse Formulas of 'brms' Modelsbrmsterms brmsterms.brmsformula brmsterms.default brmsterms.mvbrmsformula parse_bf
Spatial conditional autoregressive (CAR) structurescar
Extract Model Coefficientscoef.brmsfit
Combine Models fitted with 'brms'combine_models
Compare Information Criteria of Different Modelscompare_ic
Display Conditional Effects of Predictorsconditional_effects conditional_effects.brmsfit marginal_effects marginal_effects.brmsfit plot.brms_conditional_effects
Display Smooth Termsconditional_smooths conditional_smooths.brmsfit marginal_smooths marginal_smooths.brmsfit
Constant priors in 'brms'constant
Extract Control Parameters of the NUTS Samplercontrol_params control_params.brmsfit
(Deprecated) AR(p) correlation structurecor_ar
(Deprecated) ARMA(p,q) correlation structurecor_arma cor_arma-class
(Deprecated) Correlation structure classes for the 'brms' packagecor_brms cor_brms-class
(Deprecated) Spatial conditional autoregressive (CAR) structurescor_car cor_icar
(Deprecated) Compound Symmetry (COSY) Correlation Structurecor_cosy cor_cosy-class
(Deprecated) Fixed user-defined covariance matricescor_fixed cov_fixed
(Deprecated) MA(q) correlation structurecor_ma
(Deprecated) Spatial simultaneous autoregressive (SAR) structurescor_errorsar cor_lagsar cor_sar
Set up COSY correlation structurescosy
Prior sensitivity: Create priorsense datacreate_priorsense_data.brmsfit
Category Specific Predictors in 'brms' Modelscs cse
Custom Families in 'brms' Modelscustomfamily custom_family
Default priors for Bayesian modelsdefault_prior get_prior
Default Priors for 'brms' Modelsdefault_prior.default
Compute Density Ratiosdensity_ratio
Extract Diagnostic Quantities of 'brms' Modelsdiagnostic-quantities log_posterior log_posterior.brmsfit neff_ratio neff_ratio.brmsfit nuts_params nuts_params.brmsfit rhat rhat.brmsfit
The Dirichlet Distributionddirichlet Dirichlet rdirichlet
Transform 'brmsfit' to 'draws' objectsas_draws as_draws.brmsfit as_draws_array as_draws_array.brmsfit as_draws_df as_draws_df.brmsfit as_draws_list as_draws_list.brmsfit as_draws_matrix as_draws_matrix.brmsfit as_draws_rvars as_draws_rvars.brmsfit draws-brms
Index 'brmsfit' objectsand chains, draws-index-brms draws. Index iterations, nchains nchains.brmsfit ndraws ndraws.brmsfit niterations niterations.brmsfit nvariables nvariables.brmsfit variables variables, variables.brmsfit
Support Functions for 'emmeans'emmeans-brms-helpers emm_basis.brmsfit recover_data.brmsfit
Epileptic seizure countsepilepsy
The Exponentially Modified Gaussian Distributiondexgaussian ExGaussian pexgaussian rexgaussian
Expose user-defined 'Stan' functionsexpose_functions expose_functions.brmsfit
Exponential function plus one.expp1
Extract Model Family Objectsfamily.brmsfit
Fixed residual correlation (FCOR) structuresfcor
Expected Values of the Posterior Predictive Distributionfitted.brmsfit
Extract Population-Level Estimatesfixef fixef.brmsfit
The Frechet Distributiondfrechet Frechet pfrechet qfrechet rfrechet
The Generalized Extreme Value Distributiondgen_extreme_value GenExtremeValue pgen_extreme_value qgen_extreme_value rgen_extreme_value
Draws of a Distributional Parameterget_dpar
Projection Predictive Variable Selection: Get Reference Modelget_refmodel.brmsfit
Set up Gaussian process terms in 'brms'gp
Set up basic grouping terms in 'brms'gr
Regularized horseshoe priors in 'brms'horseshoe
Hurdle Distributionsdhurdle_gamma dhurdle_lognormal dhurdle_negbinomial dhurdle_poisson Hurdle phurdle_gamma phurdle_lognormal phurdle_negbinomial phurdle_poisson
Non-Linear Hypothesis Testinghypothesis hypothesis.brmsfit hypothesis.default
Clarity of inhaler instructionsinhaler
Scaled inverse logit-linkinv_logit_scaled
The Inverse Gaussian Distributiondinv_gaussian InvGaussian pinv_gaussian rinv_gaussian
Checks if argument is a 'brmsfit' objectis.brmsfit
Checks if argument is a 'brmsfit_multiple' objectis.brmsfit_multiple
Checks if argument is a 'brmsformula' objectis.brmsformula
Checks if argument is a 'brmsprior' objectis.brmsprior
Checks if argument is a 'brmsterms' objectis.brmsterms
Check if argument is a correlation structureis.cor_arma is.cor_brms is.cor_car is.cor_cosy is.cor_fixed is.cor_sar
Checks if argument is a 'mvbrmsformula' objectis.mvbrmsformula
Checks if argument is a 'mvbrmsterms' objectis.mvbrmsterms
Predictions from K-Fold Cross-Validationkfold_predict
K-Fold Cross-Validationkfold kfold.brmsfit
Infections in kidney patientskidney
(Defunct) Set up a lasso prior in 'brms'lasso
Interface to 'shinystan'launch_shinystan launch_shinystan.brmsfit
Compute the Pointwise Log-LikelihoodlogLik.brmsfit log_lik log_lik.brmsfit
The (Multivariate) Logistic Normal Distributiondlogistic_normal LogisticNormal rlogistic_normal
Scaled logit-linklogit_scaled
Logarithm with a minus one offset.logm1
Model comparison with the 'loo' packageloo_compare loo_compare.brmsfit
Model averaging via stacking or pseudo-BMA weighting.loo_model_weights loo_model_weights.brmsfit
Moment matching for efficient approximate leave-one-out cross-validationloo_moment_match loo_moment_match.brmsfit loo_moment_match.loo
Compute Weighted Expectations Using LOOloo_epred loo_epred.brmsfit loo_linpred loo_linpred.brmsfit loo_predict loo_predict.brmsfit loo_predictive_interval loo_predictive_interval.brmsfit
Compute a LOO-adjusted R-squared for regression modelsloo_R2 loo_R2.brmsfit
Efficient approximate leave-one-out cross-validation (LOO) using subsamplingloo_subsample loo_subsample.brmsfit
Efficient approximate leave-one-out cross-validation (LOO)LOO loo LOO.brmsfit loo.brmsfit
Cumulative Insurance Loss Paymentsloss
Set up MA(q) correlation structuresma
Prepare Fully Crossed Conditionsmake_conditions
MCMC Plots Implemented in 'bayesplot'mcmc_plot mcmc_plot.brmsfit stanplot stanplot.brmsfit
Predictors with Measurement Error in 'brms' Modelsme
Predictors with Missing Values in 'brms' Modelsmi
Finite Mixture Families in 'brms'mixture
Set up multi-membership grouping terms in 'brms'mm
Multi-Membership Covariatesmmc
Monotonic Predictors in 'brms' Modelsmo
Model Weighting Methodsmodel_weights model_weights.brmsfit
The Multivariate Normal Distributiondmulti_normal MultiNormal rmulti_normal
The Multivariate Student-t Distributiondmulti_student_t MultiStudentT rmulti_student_t
Bind response variables in multivariate modelsmvbind
Set up a multivariate model formula for use in 'brms'mvbf mvbrmsformula
Number of Grouping Factor Levelsngrps ngrps.brmsfit
(Deprecated) Number of Posterior Samplesnsamples nsamples.brmsfit
GPU support in Stan via OpenCLopencl
Create a matrix of output plots from a 'brmsfit' objectpairs.brmsfit
Extract Parameter Namesparnames parnames.brmsfit
Trace and Density Plots for MCMC Drawsplot.brmsfit
Posterior Model Probabilities from Marginal Likelihoodspost_prob post_prob.brmsfit
Posterior draws of parameters averaged across modelsposterior_average posterior_average.brmsfit
Draws from the Expected Value of the Posterior Predictive Distributionposterior_epred posterior_epred.brmsfit pp_expect
Compute posterior uncertainty intervalsposterior_interval posterior_interval.brmsfit
Posterior Draws of the Linear Predictorposterior_linpred posterior_linpred.brmsfit
Draws from the Posterior Predictive Distributionposterior_predict posterior_predict.brmsfit
(Deprecated) Extract Posterior Samplesposterior_samples posterior_samples.brmsfit
Posterior Predictions of Smooth Termsposterior_smooths posterior_smooths.brmsfit
Summarize Posterior drawsposterior_summary posterior_summary.brmsfit posterior_summary.default
Table Creation for Posterior Drawsposterior_table
Posterior predictive draws averaged across modelspp_average pp_average.brmsfit
Posterior Predictive Checks for 'brmsfit' Objectspp_check pp_check.brmsfit
Posterior Probabilities of Mixture Component Membershipspp_mixture pp_mixture.brmsfit
Draws from the Posterior Predictive Distributionpredict.brmsfit
Posterior Draws of Predictive Errorspredictive_error predictive_error.brmsfit
Predictive Intervalspredictive_interval predictive_interval.brmsfit
Prepare Predictionsextract_draws prepare_predictions prepare_predictions.brmsfit
Print a summary for a fitted model represented by a 'brmsfit' objectprint.brmsfit print.brmssummary
Print method for 'brmsprior' objectsprint.brmsprior
Extract Prior Drawsprior_draws prior_draws.brmsfit prior_samples
Priors of 'brms' modelsprior_summary prior_summary.brmsfit
Pareto smoothed importance sampling (PSIS)psis psis.brmsfit
R2D2 Priors in 'brms'R2D2
Extract Group-Level Estimatesranef ranef.brmsfit
Read CmdStan CSV files as a brms-formatted stanfit objectread_csv_as_stanfit
Recompile Stan models in 'brmsfit' objectsrecompile_model
Compute exact cross-validation for problematic observationsreloo reloo.brmsfit reloo.loo
Rename parameters in brmsfit objectsrename_pars
Posterior Draws of Residuals/Predictive Errorsresiduals.brmsfit
Restructure Old R Objectsrestructure
Restructure Old 'brmsfit' Objectsrestructure.brmsfit
Convert Rows to Labelsrows2labels
Defining smooths in 'brms' formulass t2
Spatial simultaneous autoregressive (SAR) structuressar
Control Saving of Parameter Drawssave_pars
Prior Definitions for 'brms' Modelsbrmsprior brmsprior-class empty_prior prior prior_ prior_string set_prior
The Shifted Log Normal Distributiondshifted_lnorm pshifted_lnorm qshifted_lnorm rshifted_lnorm Shifted_Lognormal
The Skew-Normal Distributiondskew_normal pskew_normal qskew_normal rskew_normal SkewNormal
Stan Code for Bayesian modelsmake_stancode stancode
Extract Stan code from 'brmsfit' objectsstancode.brmsfit
Stan Code for 'brms' Modelsstancode.default
Stan data for Bayesian modelsmake_standata standata
Extract data passed to Stan from 'brmsfit' objectsstandata.brmsfit
Data for 'brms' Modelsstandata.default
User-defined variables passed to Stanstanvar stanvars
The Student-t Distributiondstudent_t pstudent_t qstudent_t rstudent_t StudentT
Create a summary of a fitted model represented by a 'brmsfit' objectsummary.brmsfit
(Deprecated) Black Theme for 'ggplot2' Graphicstheme_black
Default 'bayesplot' Theme for 'ggplot2' Graphicstheme_default
Threading in Stanthreading
Set up UNSTR correlation structuresunstr
Update Formula Addition Termsupdate_adterms
Update 'brms' modelsupdate.brmsfit
Update 'brms' models based on multiple data setsupdate.brmsfit_multiple
Validate New Datavalidate_newdata
Validate Prior for 'brms' Modelsvalidate_prior
Extract Variance and Correlation ComponentsVarCorr VarCorr.brmsfit
Covariance and Correlation Matrix of Population-Level Effectsvcov.brmsfit
The von Mises Distributiondvon_mises pvon_mises rvon_mises VonMises
Widely Applicable Information Criterion (WAIC)WAIC waic WAIC.brmsfit waic.brmsfit
The Wiener Diffusion Model Distributiondwiener rwiener Wiener
Zero-Inflated Distributionsdzero_inflated_beta dzero_inflated_beta_binomial dzero_inflated_binomial dzero_inflated_negbinomial dzero_inflated_poisson pzero_inflated_beta pzero_inflated_beta_binomial pzero_inflated_binomial pzero_inflated_negbinomial pzero_inflated_poisson ZeroInflated