Learn R Programming

BayesBridge (version 0.6)

bridge.reg: Bayesian Bridge Regression

Description

Bayesian Bridge Regression via Gibbs sampling.

Usage

bridge.reg(y, X, nsamp, alpha=0.5,
           sig2.shape=0.0, sig2.scale=0.0, nu.shape=2.0, nu.rate=2.0,
           alpha.a=1.0, alpha.b=1.0,
           sig2.true=0.0, tau.true=0.0,
           burn=500, method="triangle", ortho=FALSE)

bridge.reg.tri(y, X, nsamp, alpha=0.5, sig2.shape=0.0, sig2.scale=0.0, nu.shape=2.0, nu.rate=2.0, alpha.a=1.0, alpha.b=1.0, sig2.true=0.0, tau.true=0.0, burn=500, ortho=FALSE, betaburn=0, extras=FALSE)

bridge.reg.stb(y, X, nsamp, alpha=0.5, sig2.shape=0.0, sig2.scale=0.0, nu.shape=2.0, nu.rate=2.0, alpha.a=1.0, alpha.b=1.0, sig2.true=0.0, tau.true=0.0, burn=500, ortho=FALSE)

Arguments

y
An N dimensional vector of data.
X
An N x P dimensional design matrix.
nsamp
The number of MCMC samples saved.
alpha
The exponential power parameter; set
sig2.shape
Shape parameter for sig2's prior.
sig2.scale
Scale parameter for sig2's prior.
nu.shape
Shape parameter for nu's prior.
nu.rate
Rate parameter for nu's prior.
alpha.a
First shape parameter for alpha's prior.
alpha.b
Second shape parameter for alpha's prior.
sig2.true
The variance when it is known.
tau.true
The scale parameter tau when it is known.
burn
The number of MCMC samples discarded.
method
The method to use. Either "triangle" or "stable".
ortho
When the design matrix is orthogonal set to TRUE.
betaburn
Number of burn iterations when sampling beta.
extras
Only used for package testing.

Details

Bridge regression is a regularized regression in which the regression coefficient's prior is an exponential power distribution. Specifically, inference on the regression coefficient beta is made using the model

$$y = X \beta + \epsilon, \epsilon \sim N(0, \sigma^2 \; I),$$ $$p(\beta) \propto \exp(\sum_j -(|\beta_j|/\tau)^{\alpha}).$$

The variance sig2, the scale parameter tau, and alpha may be estimated. This routine uses an inverse-gamma prior for sig2, a gamma prior for $\nu=\tau^{-\alpha}$, and a beta prior for alpha, when estimating those parameters. That is

$$\sigma^2 \sim IG(\textmd{sig2.shape}, \textmd{sig2.scale}),$$ $$\nu \sim Ga(\textmd{nu.shape}, \textmd{rate}=\textmd{nu.rate}),$$ $$\alpha \sim Be(\textmd{alpha.a}, \textmd{alpha.b}).$$

The parameters sig2, tau, or alpha are taken to be known when sig2.true > 0, tau.true > 0, or alpha > 0 respectively.

When the design matrix is orthogonal set ortho=TRUE.

References

Nicholas G. Poslon, James G. Scott, and Jesse Windle. The Bayesian Bridge. http://arxiv.org/abs/1109.2279.

See Also

bridge.EM.

Examples

Run this code
# Load the diabetes data...
data(diabetes, package="BayesBridge");
cov.name = colnames(diabetes$x);
y = diabetes$y;
X = diabetes$x;

# Center the data.
y = y - mean(y);
mX = colMeans(X);
for(i in 1:442){
    X[i,] = X[i,] - mX;
}

# Run the bridge regression when sig2 and tau are unknown.
gb = bridge.reg(y, X, nsamp=10000, alpha=0.5, 
     sig2.shape=0.0, sig2.scale=0.0, nu.shape=2.0, nu.rate=2.0);

Run the code above in your browser using DataLab