Skip to contents

This function fits linear regression models with a nonparametric Bayesian Lasso prior as in Marin et al. (2025+).

Usage

bnplasso.lm(
  X,
  y,
  a,
  b,
  alpha,
  intercept = FALSE,
  variance.prior.type = "independent",
  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 a centering measure in the DP prior.

b

A positive scalar corresponding to the rate parameter in the gamma distribution used as a centering measure in the DP prior.

alpha

A positive scalar corresponding to the concentration parameter in the DP prior.

intercept

Logical. If TRUE, an intercept term is included in the model; otherwise, the intercept is integrated out. If TRUE, the prior on the intercept would be a non-informative prior of the form \(p(\mu)\propto 1\). Default is FALSE.

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 "independent".

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 size n.draws-by-n.preds, where each row is a posterior draw of the regression coefficients.

  • Post.sigma2: A vector of size n.draws, where each element is a posterior draw of the sampling variance.

  • Post.tau2: A matrix of size n.draws-by-n.preds, where each row is a posterior draw of the latent parameters \(\tau_{j}^{2}\).

  • Post.lambda2: A matrix of size n.draws-by-n.preds, where each row is a posterior draw of the shrinkage parameters \(\lambda_{j}^{2}\).

  • Post.clust_idx: A matrix of size n.draws-by-n.preds, where each row indicates to which cluster the regression coefficients belong to.

  • Post.K: A vector of size n.draws, where each element indicates the number of clusters in the corresponding MCMC iteration.

  • Post.mu: A vector of size n.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 centering measure in the Dirichlet process prior.

  • b: The rate parameter in the gamma distribution used as a centering measure in the Dirichlet process prior.

  • alpha: The concentration parameter in the Dirichlet process 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 size n.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 size n.draws-by-n.obs, where each row is a draw from the posterior predictive distribution of the residuals.

References

S. Marin, B. Long,and A. H. Westveld (2025+), Adaptive Shrinkage with a Nonparametric Bayesian Lasso.Journal of Computational and Graphical Statistics. doi:10.1080/10618600.2025.2572327

G. E. Moran, V. Rockova, and E. I. George (2019), Variance Prior Forms for High-Dimensional Bayesian Variable Selection. Bayesian Analysis, 14(4):1091-1119.

Author

Santiago Marin