50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


baggr (version 0.2.0)

priors: Prior distributions in baggr

Description

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.

Usage

multinormal(location, Sigma)

lkj(shape, order = NULL)

normal(location, scale)

cauchy(location, scale)

uniform(lower, upper)

Arguments

location

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

Sigma

Variance-covariance matrix for multivariate normal.

shape

Shape parameter for LKJ

order

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

scale

SD for Normal, scale for Cauchy

lower

Lower bound for Uniform

upper

Upper bound for Uniform

Details

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:

  • prior_hypermean will take "normal", "uniform" and "cauchy" input for a scalar mean. For a vector mean, it will take any of these arguments and apply them independently to each component of the vector, or it can also take a "multinormal" argument (see the example below).

  • prior_hypersd will take "normal" and "uniform"

  • prior_hypercor allows "lkj" input

Examples

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

# }
# NOT RUN {
# 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)))
baggr(microcredit_summary_data, model = "mutau",
      pooling = "partial", prior = custom_priors)
# }

Run the code above in your browser using DataLab