shrinkage.regression {BoomSpikeSlab}  R Documentation 
Fits a Bayesian regression model with a shrinkage prior on the coefficient. The model is
y[i] ~ N(x[i,] * beta, sigma^2) 1 / sigma^2 ~ Gamma(df/2, ss/2) group(beta, 1) ~ N(b1, v1) group(beta, 2) ~ N(b2, v2) ...
In this notation, group(beta, k) ~ N(bk, vk) indicates that the subset of coefficients in group k are a priori independent draws from the specified normal distribution. In addition, each subsetlevel prior may include a hyperprior, in which case the subsetlevel prior parameters will be updated as part of the MCMC. The hyperprior has the form of independent priors on the mean and precision parameters:
bi ~ N(prior.mean, prior.variance) 1.0 / vi ~ Chisq(df, guess.at.sd).
ShrinkageRegression(response, predictors, coefficient.groups, residual.precision.prior = NULL, suf = NULL, niter, ping = niter / 10, seed = NULL) CoefficientGroup(indices, mean.hyperprior = NULL, sd.hyperprior = NULL, prior = NULL)
response 
The numeric vector of responses. 
predictors 
The matrix of predictors, including an intercept term, if desired. 
coefficient.groups 
A list of objects of type

residual.precision.prior 
An object of type

suf 
An object of class 
niter 
The desired number of MCMC iterations. 
ping 
The frequency with which to print status updates. 
seed 
The integervalued seed (or 
indices 
A vector of integers giving the positions of the regression coefficients that should be viewed as exchangeable. 
mean.hyperprior 
A 
sd.hyperprior 
An 
prior 
An object of type 
ShrinkageRegression
returns a list containing MCMC draws from
the posterior distribution of model parameters. Each of the following
is a matrix, with rows corresponding to MCMC draws, and columsn to
distinct parameters.
coefficients: regression coefficients.
residual.sd: the residual standard deviation from the regression model.
group.means: The posterior distribution of the mean of each
coefficient group. If no mean hyperprior was assigned to a
particular group, then the value here will be a constant (the
values supplied by the prior
argument to
CoefficientGroup
for that group).
group.sdsThe posterior distribution of the standard
deviation of each coefficient group. If no sd.hyperprior was
assigned to a particular group, then the value here will be a
constant (the values supplied by the prior
argument to
CoefficientGroup
for that group).
CoefficientGroup
is a configuration utility used to define
which coefficients should be shrunk together. It returns an object
(list) formatted in the manner expected by
ShrinkageRegression
.
Steven L. Scott
b0 < 1 b1 < rnorm(20, 3, .2) b2 < rnorm(30, 4, 7) nobs < 10000 beta < c(b0, b1, b2) X < cbind(1, matrix(rnorm(nobs * (length(beta)  1)), nrow = nobs, ncol = length(beta)  1)) y.hat < X %*% beta y < rnorm(nobs, y.hat, .5) groups < list(intercept = CoefficientGroup(1, prior = NormalPrior(0, 100)), first = CoefficientGroup(2:21, mean.hyperprior = NormalPrior(0, 100), sd.hyperprior = SdPrior(.2, 1)), second = CoefficientGroup(22:51, mean.hyperprior = NormalPrior(0, 100), sd.hyperprior = SdPrior(7, 1))) model < ShrinkageRegression(y, X, groups, residual.precision.prior = SdPrior(.5, 1), niter = 1000)