Learn R Programming

BBSSL (version 0.1.0)

Gibbs: Gibbs

Description

This function runs SSVS for linear regression with Spike-and-Slab LASSO prior. By default, this function uses the speed-up trick in Bhattacharya et al. (2016) when p > n.

Usage

Gibbs(y, X, a, b, lambda, maxiter, burn.in, initial.beta = NULL, sigma = 1)

Arguments

y

A vector of continuous responses (n x 1).

X

The design matrix (n x p), without an intercept.

a, b

Parameters of the prior.

lambda

A two-dim vector = c(lambda0, lambda1).

maxiter

An integer which specifies the maximum number of iterations for MCMC.

burn.in

An integer which specifies the maximum number of burn-in iterations for MCMC.

initial.beta

A vector of initial values of beta to used. If set to NULL, the LASSO solution with 10-fold cross validation is used. Default is NULL.

sigma

Noise standard deviation. Default is 1.

Value

A list, including matrix 'beta' ((maxiter-burn.in) x p), matrix 'tau2' ((maxiter-burn.in) x p), matrix 'gamma' ((maxiter-burn.in) x p), vector 'theta' ((maxiter-burn.in) x 1).

References

Nie, L., & Ro<U+010D>kov<U+00E1>, V. (2020). Bayesian Bootstrap Spike-and-Slab LASSO. arXiv:2011.14279.

Bhattacharya, A., Chakraborty, A., & Mallick, B. K. (2016). Fast sampling with Gaussian scale mixture priors in high-dimensional regression. Biometrika, 103(4):985.

Examples

Run this code
# NOT RUN {
n = 50; p = 12;
truth.beta = c(1.3, 1.3, 1.3, 1.3);
truth.sigma = 1
data = Generate_data(truth.beta, p, n, truth.sigma = 1, rho = 0.6,"block",4)
y = data$y; X = data$X; beta = data$beta

# --------------- set parameters -----------------
lambda0 = 7; lambda1 = 0.15; lambda = c(lambda0, lambda1)
a = 1; b = p #beta prior for theta

# this is for demonstration of usage only
# in practice, you may want to use more iterations!
MCchain1 = Gibbs(y, X, a, b, lambda, maxiter = 1000, burn.in = 100)
# }

Run the code above in your browser using DataLab