prior_factor creates a prior distribution for fitting
models with factor predictors. (Note that results across different operating
systems might vary due to differences in JAGS numerical precision.)
Usage
prior_factor(
  distribution,
  parameters,
  truncation = list(lower = -Inf, upper = Inf),
  prior_weights = 1,
  contrast = "meandif"
)Arguments
- distribution
 name of the prior distribution. The possible options are
"point"for a point density characterized by a
locationparameter."normal"for a normal distribution characterized by a
meanandsdparameters."lognormal"for a lognormal distribution characterized by a
meanlogandsdlogparameters."cauchy"for a Cauchy distribution characterized by a
locationandscaleparameters. Internally converted into a generalized t-distribution withdf = 1."t"for a generalized t-distribution characterized by a
location,scale, anddfparameters."gamma"for a gamma distribution characterized by either
shapeandrate, orshapeandscaleparameters. The later is internally converted to theshapeandrateparametrization"invgamma"for an inverse-gamma distribution characterized by a
shapeandscaleparameters. The JAGS part uses a 1/gamma distribution with a shape and rate parameter."beta"for a beta distribution characterized by an
alphaandbetaparameters."exp"for an exponential distribution characterized by either
rateorscaleparameter. The later is internally converted torate."uniform"for a uniform distribution defined on a range from
atob
- parameters
 list of appropriate parameters for a given
distribution.- truncation
 list with two elements,
lowerandupper, that define the lower and upper truncation of the distribution. Defaults tolist(lower = -Inf, upper = Inf). The truncation is automatically set to the bounds of the support.- prior_weights
 prior odds associated with a given distribution. The value is passed into the model fitting function, which creates models corresponding to all combinations of prior distributions for each of the model parameters and sets the model priors odds to the product of its prior distributions.
- contrast
 type of contrast for the prior distribution. The possible options are
"meandif"for contrast centered around the grand mean with equal marginal distributions, making the prior distribution exchangeable across factor levels. In contrast to
"orthonormal", the marginal distributions are identical regardless of the number of factor levels and the specified prior distribution corresponds to the difference from grand mean for each factor level. Only supportsdistribution = "mnormal"anddistribution = "mt"which generates the corresponding multivariate normal/t distributions."orthonormal"for contrast centered around the grand mean with equal marginal distributions, making the prior distribution exchangeable across factor levels. Only supports
distribution = "mnormal"anddistribution = "mt"which generates the corresponding multivariate normal/t distributions."treatment"for contrasts using the first level as a comparison group and setting equal prior distribution on differences between the individual factor levels and the comparison level.
"independent"for contrasts specifying dependent prior distribution for each factor level (note that this leads to an overparameterized model if the intercept is included).
Examples
# create an orthonormal prior distribution
p1 <- prior_factor(distribution = "mnormal", contrast = "orthonormal",
                   parameters = list(mean = 0, sd = 1))