spike_laplace_partially_mcmc {BMIselect} | R Documentation |
Spike-and-Laplace MCMC Sampler for Multiply-Imputed Regression
Description
Implements Bayesian variable selection using a spike-and-slab prior with a Laplace (double-exponential) slab
on nonzero coefficients. Latent inclusion indicators gamma
follow Bernoulli(theta
), and their probabilities
follow independent Beta(a
, b
) priors.
Usage
spike_laplace_partially_mcmc(
X,
Y,
intercept = TRUE,
a = 2,
b = NULL,
nburn = 4000,
npost = 4000,
seed = NULL,
verbose = TRUE,
printevery = 1000,
chain_index = 1
)
Arguments
X |
A 3-D array of predictors with dimensions |
Y |
A matrix of outcomes with dimensions |
intercept |
Logical; include an intercept term? Default |
a |
Numeric; shape parameter of the Gamma prior. Default |
b |
Numeric or |
nburn |
Integer; number of burn-in MCMC iterations. Default |
npost |
Integer; number of post-burn-in samples to retain. Default |
seed |
Integer or |
verbose |
Logical; print progress messages? Default |
printevery |
Integer; print progress every this many iterations. Default |
chain_index |
Integer; index of this MCMC chain (for labeling messages). Default |
Value
A named list with components:
post_rho
Numeric vector length
npost
, sampled global scale\rho
.post_gamma
Matrix
npost * p
of sampled inclusion indicators.post_theta
Matrix
npost * p
of sampled Beta parameters\theta_j
.post_alpha
Matrix
npost * D
of sampled intercepts (if used).post_lambda2
Matrix
npost * p
of sampled local scale parameters\lambda_j^2
.post_sigma2
Numeric vector length
npost
, sampled residual variances.post_beta
Array
npost * D * p
of sampled regression coefficients.post_fitted_Y
Array
npost * D * n
of posterior predictive draws (including 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.a
,b
Numeric values of the rho hyperparameters used.
Examples
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 <- spike_laplace_partially_mcmc(X, Y, nburn = 10, npost = 10)