| Title: | Bayesian MI-LASSO for Variable Selection on Multiply-Imputed Datasets |
|---|---|
| Description: | Provides a suite of Bayesian MI-LASSO for variable selection methods for multiply-imputed datasets. The package includes four Bayesian MI-LASSO models using shrinkage (Multi-Laplace, Horseshoe, ARD) and Spike-and-Slab (Spike-and-Laplace) priors, along with tools for model fitting via MCMC, four-step projection predictive variable selection, and hyperparameter calibration. Methods are suitable for both continuous and binary covariates under missing-at-random or missing-completely-at-random assumptions. See Zou, J., Wang, S. and Chen, Q. (2025), Bayesian MI-LASSO for Variable Selection on Multiply-Imputed Data. ArXiv, 2211.00114. <doi:10.48550/arXiv.2211.00114> for more details. We also provide the frequentist MI-LASSO function. |
| Authors: | Jungang Zou [aut, cre], Sijian Wang [aut], Qixuan Chen [aut] |
| Maintainer: | Jungang Zou <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 1.0.10 |
| Built: | 2026-10-09 13:25:17 UTC |
| Source: | https://github.com/zjg540066169/bmiselect |
Fit a Bayesian multiple-imputation LASSO (BMI-LASSO) model across multiply-imputed datasets, using one of four priors: Multi-Laplace, Horseshoe, ARD, or Spike-Laplace. Automatically standardizes data, runs MCMC in parallel, performs variable selection via four-step projection predictive variable selection, and selects a final submodel by BIC.
BMI_LASSO( X, Y, model, standardize = TRUE, search = "grid", grid = seq(0, 1, 0.01), orthogonal = FALSE, nburn = 5000, npost = 5000, seed = NULL, nchains = 1, ncores = 1, output_verbose = TRUE, printevery = 1000, selection_set = NULL, criterion = "bic", ... )BMI_LASSO( X, Y, model, standardize = TRUE, search = "grid", grid = seq(0, 1, 0.01), orthogonal = FALSE, nburn = 5000, npost = 5000, seed = NULL, nchains = 1, ncores = 1, output_verbose = TRUE, printevery = 1000, selection_set = NULL, criterion = "bic", ... )
X |
A numeric matrix or array of predictors. If a matrix |
Y |
A numeric vector or matrix of outcomes. If a vector of length |
model |
Character; which prior to use. One of |
standardize |
Logical; whether to normalize each |
search |
Character; how the candidate submodels along the path are
generated. |
grid |
Numeric vector; thresholds explored by the |
orthogonal |
Logical; if |
nburn |
Integer; number of burn-in MCMC iterations per chain. Default |
npost |
Integer; number of post-burn-in samples to retain per chain. Default |
seed |
Optional integer; base random seed. Each chain adds its index. When supplied, BLAS is pinned to a single thread for the duration of the fit so results are bit-reproducible (multithreaded BLAS otherwise makes the MCMC draws, and hence the selection, non-deterministic). |
nchains |
Integer; number of MCMC chains to run in parallel. Default |
ncores |
Integer; number of parallel cores to use. Default |
output_verbose |
Logical; print progress messages. Default |
printevery |
Integer; print status every so many iterations. Default |
selection_set |
Optional logical vector of length |
criterion |
Character; model-size selection criterion along the candidate
path. |
... |
Additional model-specific hyperparameters:
|
A named list with elements:
posteriorList of length nchains of MCMC outputs (posterior draws).
selectList of length nchains of logical matrices showing
which variables are selected at each grid value.
best_selectList of length nchains of the single best
selection (by BIC) for each chain.
posterior_best_modelsList of length nchains of projected
posterior draws for the best submodel.
bic_modelsList of length nchains of BIC values and
degrees-of-freedom for each candidate submodel.
loo_models(criterion other than "bic") The elpd
path, its pointwise contributions, the max Pareto-k per candidate, the
candidate sizes, the elpd-maximising index and the one-standard-error
index. NULL otherwise.
summary_table_fullA data frame summarizing rank-normalized split-Rhat and other diagnostics for the full model.
summary_table_selectedA data frame summarizing diagnostics for the selected submodel after projection.
pooled(nchains > 1 only; NULL otherwise) The
multi-chain pooled four-step selection: all chains' draws are pooled
and selected ONCE, so the chains yield a single coherent submodel rather than
one selection per chain. A list with best_select, select,
bic_models / loo_models, posterior_best_models
(calibrated + projected draws), and summary_table_selected (pooled
mean and 95\
unchanged.
sim <- sim_A(n = 100, p = 20, type = "MAR", SNP = 1.5, low_missing = TRUE, n_imp = 5, seed = 123) X <- sim$data_MI$X Y <- sim$data_MI$Y fit <- BMI_LASSO(X, Y, model = "Horseshoe", nburn = 100, npost = 100, nchains = 1, ncores = 1) str(fit$best_select)sim <- sim_A(n = 100, p = 20, type = "MAR", SNP = 1.5, low_missing = TRUE, n_imp = 5, seed = 123) X <- sim$data_MI$X Y <- sim$data_MI$Y fit <- BMI_LASSO(X, Y, model = "Horseshoe", nburn = 100, npost = 100, nchains = 1, ncores = 1) str(fit$best_select)
Fit a LASSO-like penalty across D multiply-imputed datasets by
iteratively reweighted ridge regressions (Equation (4) of the manuscript).
For each tuning parameter in lamvec, it returns the pooled
coefficient estimates, the BIC, and the selected variables.
MI_LASSO( X, Y, lamvec = (2^(seq(-1, 4, by = 0.05)))^2/2, maxiter = 200, eps = 1e-20, ncores = 1 )MI_LASSO( X, Y, lamvec = (2^(seq(-1, 4, by = 0.05)))^2/2, maxiter = 200, eps = 1e-20, ncores = 1 )
X |
A matrix |
Y |
A vector length |
lamvec |
Numeric vector of penalty parameters |
maxiter |
Integer; maximum number of ridge–update iterations per |
eps |
Numeric; convergence tolerance on coefficient change. Default |
ncores |
Integer; number of cores for parallelizing over |
If length(lamvec) > 1, a list with elements:
bestList for the with minimal BIC containing:
coefficients ((p+1)×D intercept + slopes),
bic (BIC scalar),
varsel (logical length-p vector of selected predictors),
lambda (the chosen penalty).
lambda_pathlength(lamvec)×2 matrix of each
lambda and its corresponding BIC.
If length(lamvec) == 1, returns a single list (as above) for that
penalty.
sim <- sim_A(n = 100, p = 20, type = "MAR", SNP = 1.5, low_missing = TRUE, n_imp = 5, seed = 123) X <- sim$data_MI$X Y <- sim$data_MI$Y fit <- MI_LASSO(X, Y, lamvec = c(0.1))sim <- sim_A(n = 100, p = 20, type = "MAR", SNP = 1.5, low_missing = TRUE, n_imp = 5, seed = 123) X <- sim$data_MI$X Y <- sim$data_MI$Y fit <- MI_LASSO(X, Y, lamvec = c(0.1))
Generates a dataset for Scenario A used in Bayesian MI-LASSO benchmarking. Covariates are iid standard normal, with a fixed true coefficient vector, linear outcome, missingness imposed on specified columns under MCAR or MAR, and multiple imputations via predictive mean matching.
sim_A( n = 100, p = 20, type = "MAR", SNP = 1.5, low_missing = TRUE, n_imp = 5, seed = NULL )sim_A( n = 100, p = 20, type = "MAR", SNP = 1.5, low_missing = TRUE, n_imp = 5, seed = NULL )
n |
Integer. Number of observations. |
p |
Integer. Number of covariates (columns). Either 20, or 40 or more. |
type |
Character. Missingness mechanism: "MCAR" or "MAR". |
SNP |
Numeric. Signal-to-noise ratio controlling error variance. |
low_missing |
Logical. If TRUE, use low missingness rates; if FALSE, higher missingness. FALSE is available only for |
n_imp |
Integer. Number of multiple imputations to generate. |
seed |
Integer or NULL. Random seed for reproducibility. |
A list with components:
A list of complete covariate matrix and outcomes before missingness.
A list of covariate matrix and outcomes with missing values.
A list of array of imputed covariates (n_imp × n × p) and a matrix of imputed outcomes (n_imp × n).
A list of complete-case covariate matrix and outcomes.
Logical vector of true nonzero coefficient indices.
True covariance matrix used for X.
True coefficient vector.
sim <- sim_A(n = 100, p = 20, type = "MAR", SNP = 1.5, low_missing = TRUE, n_imp = 5, seed = 123) str(sim)sim <- sim_A(n = 100, p = 20, type = "MAR", SNP = 1.5, low_missing = TRUE, n_imp = 5, seed = 123) str(sim)
Generates a dataset for Scenario B used in Bayesian MI-LASSO benchmarking. Covariates are multivariate normal with AR(1) covariance, with a fixed true coefficient vector, linear outcome, missingness imposed on specified columns under MCAR or MAR, and multiple imputations via predictive mean matching.
sim_B( n = 100, p = 20, low_missing = TRUE, type = "MAR", SNP = 1.5, corr = 0.5, n_imp = 5, seed = NULL )sim_B( n = 100, p = 20, low_missing = TRUE, type = "MAR", SNP = 1.5, corr = 0.5, n_imp = 5, seed = NULL )
n |
Integer. Number of observations. |
p |
Integer. Number of covariates (columns). Either 20, or 40 or more. |
low_missing |
Logical. If TRUE, use low missingness rates; if FALSE, higher missingness. FALSE is available only for |
type |
Character. Missingness mechanism: "MCAR" or "MAR". |
SNP |
Numeric. Signal-to-noise ratio controlling error variance. |
corr |
Numeric. AR(1) correlation parameter |
n_imp |
Integer. Number of multiple imputations to generate. |
seed |
Integer or NULL. Random seed for reproducibility. |
A list with components:
A list of complete covariate matrix and outcomes before missingness.
A list of covariate matrix and outcomes with missing values.
A list of array of imputed covariates (n_imp × n × p) and a matrix of imputed outcomes (n_imp × n).
A list of complete-case covariate matrix and outcomes.
Logical vector of true nonzero coefficient indices.
True covariance matrix used for X.
True coefficient vector.
sim <- sim_B(n = 100, p = 20, type = "MAR", SNP = 1.5, corr = 0.5, low_missing = TRUE, n_imp = 5, seed = 123) str(sim)sim <- sim_B(n = 100, p = 20, type = "MAR", SNP = 1.5, corr = 0.5, low_missing = TRUE, n_imp = 5, seed = 123) str(sim)
Generates binary covariates by thresholding an AR(1) latent Gaussian, then proceeds as in sim_B.
sim_C( n = 100, p = 20, low_missing = TRUE, type = "MAR", SNP = 1.5, corr = 0.5, n_imp = 5, seed = NULL )sim_C( n = 100, p = 20, low_missing = TRUE, type = "MAR", SNP = 1.5, corr = 0.5, n_imp = 5, seed = NULL )
n |
Integer. Number of observations. |
p |
Integer. Number of covariates (columns). Only |
low_missing |
Logical. If TRUE, use low missingness rates; if FALSE, higher missingness. |
type |
Character. Missingness mechanism: "MCAR" or "MAR". |
SNP |
Numeric. Signal-to-noise ratio controlling error variance. |
corr |
Numeric. AR(1) correlation parameter |
n_imp |
Integer. Number of multiple imputations to generate. |
seed |
Integer or NULL. Random seed for reproducibility. |
A list with components:
A list of complete covariate matrix and outcomes before missingness.
A list of covariate matrix and outcomes with missing values.
A list of array of imputed covariates (n_imp × n × p) and a matrix of imputed outcomes (n_imp × n).
A list of complete-case covariate matrix and outcomes.
Logical vector of true nonzero coefficient indices.
True covariance matrix used for X.
True coefficient vector.
sim <- sim_C(n = 100, p = 20, type = "MAR", SNP = 1.5, corr = 0.5, low_missing = TRUE, n_imp = 5, seed = 123) str(sim)sim <- sim_C(n = 100, p = 20, type = "MAR", SNP = 1.5, corr = 0.5, low_missing = TRUE, n_imp = 5, seed = 123) str(sim)