Learn R Programming

blme (version 1.0-3)

bmerDist-class: 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.

Arguments

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 thesdargument, a vector of variances using thecovargument, 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.

Thecommon.scaleargument 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, scale = c(10^2, 2.5^2), common.scale = TRUE)The degrees of freedom -dfargument - must be positive. Ifscaleis 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 a full scale matrix, so long as it is positive definite.tpriors 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.scaleisTRUE, the residual variance must be numerically optimized as well.normalpriors on the common scale can be fully profiled and do not suffer from this drawback.
  • At present,tpriors cannot be used with theREML = TRUEargument as that implies an integral without a closed form solution.

    Covariance Priors

    • gamma(shape = 2.5, rate = 0, common.scale = TRUE, posterior.scale = "sd")Applicable only for univariate grouping factors. A rate of0or a shape of0imposes 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 of0or a shape of0imposes an improper prior. Options are as above.
    • wishart(df = level.dim + 2.5, scale = Inf, common.scale = TRUE, posterior.scale = "cov")A scale ofInfor a shape of0imposes 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 of0or a shape of0imposes 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). IfcholisTRUE,fnis passed arightfactor of covariance matrix;FALSEresults in the matrix being passed directly.scalecan be"none","log", or"dev"corresponding to$p(\Sigma)$,$\log p(\Sigma)$, and$-2 \log p(\Sigma)$respectively.

    Since the prior is may have an arbitrary form, settingcommon.scaletoFALSEfor 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:
    • paliased ton.fixef- the number of fixed effects
    • naliased ton.obs- the number of observations
    • q.kaliased tolevel.dim- for covariance priors, the dimension of the grouping factor/grouping level
    • j.kaliased ton.grps- also for covariance priors, the number of groups that comprise a specific grouping factor

    See Also

    blmer() and bglmer(), which produce these objects, and bmerMod-class objects which contain them.