Learn R Programming

BMIselect (version 1.0.1)

multi_laplace_mcmc: Multi-Laplace MCMC Sampler for Multiply-Imputed Regression

Description

Implements Bayesian variable selection under the Multi-Laplace prior on regression coefficients across multiply-imputed datasets. The prior shares local shrinkage parameters (lambda2) across imputations and places a Gamma(h, v) hyperprior on the global parameter rho.

Usage

multi_laplace_mcmc(
  X,
  Y,
  intercept = TRUE,
  h = 2,
  v = NULL,
  nburn = 4000,
  npost = 4000,
  seed = NULL,
  verbose = TRUE,
  printevery = 1000,
  chain_index = 1
)

Value

A named list with elements:

post_beta

Array npost × D × p of sampled regression coefficients.

post_alpha

Matrix npost × D of sampled intercepts (if used).

post_sigma2

Numeric vector of length npost, sampled residual variances.

post_lambda2

Matrix npost × p of sampled local shrinkage parameters.

post_rho

Numeric vector of length npost, sampled global parameters.

post_fitted_Y

Array npost × D × n of posterior predictive draws (with noise).

post_pool_beta

Matrix (npost * D) × p of pooled coefficient draws.

post_pool_fitted_Y

Matrix (npost * D) × n of pooled predictive draws (with noise).

hat_matrix_proj

Matrix D × n × n of averaged projection hat-matrices. To avoid recalculate for estimating degree of freedom.

h, v

Numeric; the shape and scale hyperparameters used.

Arguments

X

A 3-D array of predictors with dimensions D × n × p.

Y

A matrix of outcomes with dimensions D × n.

intercept

Logical; include an intercept? Default TRUE.

h

Numeric; shape parameter of the Gamma prior on rho. Default 2.

v

Numeric or NULL; scale parameter of the Gamma prior on rho. If NULL, defaults to (D+1)/(D*(h-1)).

nburn

Integer; number of burn-in iterations. Default 4000.

npost

Integer; number of post-burn-in samples to store. Default 4000.

seed

Integer or NULL; random seed for reproducibility. Default NULL.

verbose

Logical; print progress messages? Default TRUE.

printevery

Integer; print progress every this many iterations. Default 1000.

chain_index

Integer; index of this MCMC chain (for messages). Default 1.

Examples

Run this code
sim <- sim_B(n = 100, p = 20, type = "MAR", SNP = 1.5, corr = 0.5, low_missing = TRUE,
n_imp = 5, seed = 123)
X <- sim$data_MI$X
Y <- sim$data_MI$Y
fit <- multi_laplace_mcmc(X, Y, intercept = TRUE, nburn = 100, npost = 100)

Run the code above in your browser using DataLab