priors | R Documentation |
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) lognormal(mu, sigma) student_t(nu, mu, sigma) cauchy(location, scale) uniform(lower, upper)
location |
Mean for normal and multivariate normal (in which case |
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 |
mu |
mean of ln(X) for lognormal or location for Student's generalised T |
sigma |
SD of ln(X) for lognormal or scale for Student's generalised T |
nu |
degrees of freedom for Student's generalised T |
lower |
Lower bound for Uniform |
upper |
Upper bound for Uniform |
The prior choice in baggr is done via distinct arguments for each type of prior,
e.g. prior_hypermean
, or a named list of several passed to prior
.
See the examples below.
Notation for priors is "plain-text", in that you can write the distributions as
normal(5,10)
, uniform(0,100)
etc.
Different parameters admit different priors (see baggr for explanations of
what the different prior_
arguments do):
prior_hypermean
, prior_control
, and prior_beta
will take "normal"
, "uniform"
, "lognormal"
, and
"cauchy"
input for scalars.
For a vector hypermean (see "mutau"
model), 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
, prior_control_sd
, and prior_sigma
will take "normal"
, "uniform"
, and "lognormal"
but negative parts of the distribution are truncated
prior_hypercor
allows "lkj"
input (see Lewandowski et al.)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.