Description Usage Arguments Details References See Also Examples
View source: R/BridgeWrapper.R
Bayesian Bridge Regression via Gibbs sampling.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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)
|
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 <= 0 to estimate. |
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. |
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 β + ε, ε \sim N(0, σ^2 \; I),
p(β) \propto \exp(∑_j -(|β_j|/τ)^{α}).
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 ν=τ^{-α}, and a beta prior for alpha, when estimating those parameters. That is
σ^2 \sim IG(\textmd{sig2.shape}, \textmd{sig2.scale}),
ν \sim Ga(\textmd{nu.shape}, \textmd{rate}=\textmd{nu.rate}),
α \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
.
Nicholas G. Poslon, James G. Scott, and Jesse Windle. The Bayesian Bridge. http://arxiv.org/abs/1109.2279.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # 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);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.