priors {baggr}R Documentation

Prior distributions in baggr


This page provides a list of all available distributions that can be used to specify priors in baggr(). These convenience functions are designed to allow the user to write the priors in the most "natural" way when implementing them in baggr. Apart from passing on the arguments, their only other role is to perform a rudimentary check if the distribution is specified correctly.


multinormal(location, Sigma)

lkj(shape, order = NULL)

normal(location, scale)

cauchy(location, scale)

uniform(lower, upper)



Mean for normal and multivariate normal (in which case location is a vector), and median for Cauchy distributions


Variance-covariance matrix for multivariate normal.


Shape parameter for LKJ


Order of LKJ matrix (typically it does not need to be specified, as it is inferred directly in the model)


SD for Normal, scale for Cauchy


Lower bound for Uniform


Upper bound for Uniform


The prior choice in baggr is always done via 3 distinct arguments: prior_hypermean, prior_hypersd, and prior_hypercor.

These respectively refer to the priors on the average of the effects across the groups (hypermean), the standard deviation of the effects across the groups (hypersd), and the correlation in the distribution of parameters across groups when the model allows multivariate shrinkage (say on control group means and effects).

Notation for priors is "plain-text", in that you can write the distributions as normal(5,10), uniform(0,100) etc. As with any other argument one has the option to simply input the prior directly, e.g. prior_hypermean = normal(0,1) , or by creating a named list of custom priors and then inputting the list to the argument priors. See the examples below for more.

Different parameters admit different priors:


Witold Wiecek, Rachael Meager


Lewandowski, Daniel, Dorota Kurowicka, and Harry Joe. "Generating Random Correlation Matrices Based on Vines and Extended Onion Method." Journal of Multivariate Analysis 100, no. 9 (October 1, 2009): 1989-2001.


# (these are not the recommended priors -- for syntax illustration only)

# change the priors for 8 schools:
baggr(schools, model = "rubin", pooling = "partial",
      prior_hypermean = normal(5,5),
      prior_hypersd = normal(0,20))

# passing priors as a list
custom_priors <- list(hypercor = lkj(1), hypersd = normal(0,10),
                      hypermean = multinormal(c(0,0),matrix(c(10,3,3,10),2,2)))
microcredit_summary_data <- prepare_ma(microcredit, outcome = "consumption")
baggr(microcredit_summary_data, model = "mutau",
      pooling = "partial", prior = custom_priors)

[Package baggr version 0.6.4 Index]