bmerDist-class {blme} | R Documentation |
Bayesian Linear Mixed-Effects Model Prior Representations and bmer*Dist Methods
Description
Objects created in the initialization step of a blme model that represent the type of prior being applied.
Objects from the Class
Objects can be created by calls of the
form new("bmerPrior", ...)
or, more commonly, as side effects of the
blmer
and bglmer
functions.
When using the main blme
functions, the prior-related arguments can be
passed what essentially
are function calls with the distinction that they are delayed in evaluation
until information about the model is available. At that time, the functions
are defined in a special environment and then evaluated in an
environment that directly inherits form the one in which blmer
or
bglmer
was called. This is reflected in some of the
prototypes of various prior-creating functions which depend on parameters not
available in the top-level environment.
Finally, if the trailing parentheses are omitted from a blmer
/bglmer
prior argument, they are simply added as a form of “syntactic sugar”.
Prior Distributions
This section lists the prototypes for the functions that are called to parse a prior during a model fit.
Fixed Effect Priors
-
normal(sd = c(10, 2.5), cov, common.scale = TRUE)
Applies a Gaussian prior to the fixed effects. Normal priors are constrained to have a mean of 0 - non-zero priors are equivalent to shifting covariates.
The covariance hyperparameter can be specified either as a vector of standard deviations, using the
sd
argument, a vector of variances using thecov
argument, or the entire variance/covariance matrix itself. When specifying standard deviations, a vector of length less than the number of fixed effects will have its tail repeated, while the first element is assumed to apply only to the intercept term. So in the default ofc(10, 2.5)
, the intercept receives a standard deviation of 10 and the various slopes are all given a standard deviation of 2.5.The
common.scale
argument specifies whether or not the prior is to be interpretted as being on the same scale as the residuals. To specify a prior in an absolute sense, set toFALSE
. Argument is only applicable to linear mixed models. -
t(df = 3, mean = 0, scale = c(10^2, 2.5^2), common.scale = TRUE)
The degrees of freedom -
df
argument - must be positive. Ifmean
is of length 1, it is repeated for every fixed effect. Length 2 repeats just the second element for all slopes. Otherwise, the length must be equal to that of the number of fixed effects.If
scale
is of length 1, it is repeated along the diagonal for every component. Length 2 repeats just the second element for all slopes. Length equal to the number of fixed effects sees the vector simply turned into a diagonal matrix. Finally, it can be a full scale matrix, so long as it is positive definite.t
priors for linear mixed models require that the fixed effects be added to set of parameters that are numerically optimized, and thus can substantially increase running time. In addition, whencommon.scale
isTRUE
, the residual variance must be numerically optimized as well.normal
priors on the common scale can be fully profiled and do not suffer from this drawback.At present,
t
priors cannot be used with theREML = TRUE
argument as that implies an integral without a closed form solution. -
horseshoe(mean = 0, global.shrinkage = 2.5, common.scale = TRUE)
The horseshoe shrinkage prior is implemented similarly to the
t
prior, in that it requires adding the fixed effects to the parameter set for numeric optimization.global.shrinkage
, also referred to as\tau
, must be positive and is on the scale of a standard deviation. Local shrinkage parameters are treated as independent across all fixed effects and are integrated out. See Carvalho et al. (2009) in the references.
Covariance Priors
-
gamma(shape = 2.5, rate = 0, common.scale = TRUE, posterior.scale = "sd")
Applicable only for univariate grouping factors. A rate of
0
or a shape of0
imposes an improper prior. The posterior scale can be"sd"
or"var"
and determines the scale on which the prior is meant to be applied. -
invgamma(shape = 0.5, scale = 10^2, common.scale = TRUE, posterior.scale = "sd")
Applicable only for univariate grouping factors. A scale of
0
or a shape of0
imposes an improper prior. Options are as above. -
wishart(df = level.dim + 2.5, scale = Inf, common.scale = TRUE, posterior.scale = "cov")
A scale of
Inf
or a shape of0
imposes an improper prior. The behavior for singular matrices with only some infinite eigenvalues is undefined. Posterior scale can be"cov"
or"sqrt"
, the latter of which applies to the unique matrix root that is also a valid covariance matrix. -
invwishart(df = level.dim - 0.5, scale = diag(10^2 / (df + level.dim + 1), level.dim), common.scale = TRUE, posterior.scale = "cov")
A scale of
0
or a shape of0
imposes an improper prior. The behavior for singular matrices with only some zero eigenvalues is undefined. -
custom(fn, chol = FALSE, common.scale = TRUE, scale = "none")
Applies to the given function (
fn
). Ifchol
isTRUE
,fn
is passed a right factor of covariance matrix;FALSE
results in the matrix being passed directly.scale
can be"none"
,"log"
, or"dev"
corresponding top(\Sigma)
,\log p(\Sigma)
, and-2 \log p(\Sigma)
respectively.Since the prior is may have an arbitrary form, setting
common.scale
toFALSE
for a linear mixed model means that full profiling may no longer be possible. As such, that parameter is numerically optimized.
Residual Variance Priors
-
point(value = 1.0, posterior.scale = "sd")
Fixes the parameter to a specific value given as either an
"sd"
or a"var"
. -
gamma(shape = 0, rate = 0, posterior.scale = "var")
As above with different defaults.
-
invgamma(shape = 0, scale = 0, posterior.scale = "var")
As above with different defaults.
Evaluating Environment
The variables that the defining environment have populated are:
-
p
aliased ton.fixef
- the number of fixed effects -
n
aliased ton.obs
- the number of observations -
q.k
aliased tolevel.dim
- for covariance priors, the dimension of the grouping factor/grouping level -
j.k
aliased ton.grps
- also for covariance priors, the number of groups that comprise a specific grouping factor
Methods
- toString
Pretty-prints the distribution and its parameters.
References
Carvalho, Carlos M., Nicholas G. Polson, and James G. Scott. "Handling Sparsity via the Horseshoe." AISTATS. Vol. 5. 2009.
See Also
blmer()
and bglmer()
,
which produce these objects, and bmerMod-class
objects which contain them.