This function fits linear regression models with a Bayesian adaptive Lasso prior as in Leng et al. (2014).
Usage
balasso.lm(
X,
y,
a,
b,
intercept = FALSE,
variance.prior.type = "conjugate",
max.iters = 6000L,
burn.in = 1000L,
thin = 1L
)Arguments
- X
A matrix of predictors of dimension \(n\)-by-\(p\), where each of the \(n\) rows is an observation vector.
- y
Response variable. It should be a numeric vector size \(n\).
- a
A positive scalar corresponding to the shape parameter in the gamma distribution used as hyper-prior in the shrinkage parameters, \(\lambda_{j}^{2}\), for \(j\in\{1,\dots,n\}\).
- b
A positive scalar corresponding to the rate parameter in the gamma distribution used as hyper-prior in the shrinkage parameters, \(\lambda_{j}^{2}\), for \(j\in\{1,\dots,n\}\).
- intercept
Logical. If
TRUE, an intercept term is included in the model; otherwise, the intercept is integrated out. IfTRUE, the prior on the intercept would be a non-informative prior of the form \(p(\mu)\propto 1\). Default isFALSE.- variance.prior.type
A character string denoting whether the variance on the sampling variance should be an independent-type prior or a conjugate-type prior. See Moran et al. (2019) for details. The options are either
"independent"or"conjugate". Default is"conjugate"as in Leng et al. (2014).- max.iters
A positive integer corresponding to the total number of MCMC iterations. Default is 6000.
- burn.in
A positive integer corresponding to the number of draws discarded as burn-in. It should be smaller than
max.iters. Default is 1000.- thin
A positive integer specifying the period for saving samples. Default is 1.
Value
An object of S3 class, "lmBayes", containing:
Post.beta: A matrix of sizen.draws-by-n.preds, where each row is a posterior draw of the regression coefficients.Post.sigma2: A vector of sizen.draws, where each element is a posterior draw of the sampling variance.Post.tau2: A matrix of sizen.draws-by-n.preds, where each row is a posterior draw of the latent parameters \(\tau_{j}^{2}\).Post.lambda2: A matrix of sizen.draws-by-n.preds, where each row is a posterior draw of the shrinkage parameters \(\lambda_{j}^{2}\).Post.mu: A vector of sizen.draws, where each element is a posterior draw of the intercept term.elapsed: The elapsed (wall-clock) time of the MCMC sampler.a: The shape parameter in the gamma distribution used as a hyper-prior.b: The rate parameter in the gamma distribution used as a hyper-prior.intercept: Whether or not an intercept term was included in the model.variance.prior.type: Whether the variance on the sampling variance was an independent-type prior or a conjugate-type prior.max.iters: The total number of MCMC iterations.burn.in: The number of draws discarded as burn-in.thin: The period for saving draws.n.obs: The sample size.n.preds: The number of predictors.n.draws: The number of posterior draws after burn-in and thinning.X: Matrix of predictors.y: Vector of responses.post.pred.fitted.values: A matrix of sizen.draws-by-n.obs, where each row is a draw from the posterior predictive distribution of the fitted values.post.pred.residuals: A matrix of sizen.draws-by-n.obs, where each row is a draw from the posterior predictive distribution of the residuals.