Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

regression.coefficient.conjugate.prior

Regression Coefficient Conjugate Prior


Description

A conjugate prior for regression coefficients, conditional on residual variance, and sample size.

Usage

RegressionCoefficientConjugatePrior(
    mean,
    sample.size,
    additional.prior.precision = numeric(0),
    diagonal.weight = 0)

Arguments

mean

The mean of the prior distribution, denoted 'b' below. See Details.

sample.size

The value denoted 'kappa' below. This can be interpreted as a number of observations worth of weight to be assigned to mean in the posterior distribution.

additional.prior.precision

A vector of non-negative numbers representing the diagonal matrix Lambda^{-1} below. Positive values for additional.prior.precision will ensure the distribution is proper even if the regression model has no data. If all columns of the design matrix have positive variance then additional.prior.precision can safely be set to zero. A zero-length numeric vector is a slightly more efficient equivalent to a vector of all zeros.

diagonal.weight

The weight given to the diagonal when XTX is averaged with its diagonal. The purpose of diagonal.weight is to keep the prior distribution proper even if X is less than full rank. If the design matrix is full rank then diagonal.weight can be set to zero.

Details

A conditional prior for the coefficients (beta) in a linear regression model. The prior is conditional on the residual variance sigma^2, the sample size n, and the design matrix X. The prior is

beta | sigsq, X ~ N(b, sigsq * (Lambda^{-1} + V))

where

V^{-1} = ((1 - w) * XTX + w * Diag(XTX)) * kappa / n.

The prior distribution also depends on the cross product matrix XTX and the sample size n, which are not arguments to this function. It is expected that the underlying C++ code will get those quantities elsewhere (presumably from the regression modeled by this prior).

Author(s)

References

Gelman, Carlin, Stern, Rubin (2003), "Bayesian Data Analysis", Chapman and Hall.


Boom

Bayesian Object Oriented Modeling

v0.9.7
LGPL-2.1 | file LICENSE
Authors
Steven L. Scott is the sole author and creator of the BOOM project. Some code in the BOOM libraries has been modified from other open source projects. These include Cephes (obtained from Netlib, written by Stephen L. Moshier), NEWUOA (M.J.D Powell, obtained from Powell's web site), and a modified version of the R math libraries (R core development team). Original copyright notices have been maintained in all source files. In these cases, copyright claimed by Steven L. Scott is limited to modifications made to the original code. Google claims copyright for code written while Steven L. Scott was employed at Google from 2008 - 2018, but BOOM is not an officially supported Google project.
Initial release
2021-02-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.