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.
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
)A named list with components:
post_rhoNumeric vector length npost, sampled global scale \(\rho\).
post_gammaMatrix npost * p of sampled inclusion indicators.
post_thetaMatrix npost * p of sampled Beta parameters \(\theta_j\).
post_alphaMatrix npost * D of sampled intercepts (if used).
post_lambda2Matrix npost * p of sampled local scale parameters \(\lambda_j^2\).
post_sigma2Numeric vector length npost, sampled residual variances.
post_betaArray npost * D * p of sampled regression coefficients.
post_fitted_YArray npost * D * n of posterior predictive draws (including noise).
post_pool_betaMatrix (npost * D) * p of pooled coefficient draws.
post_pool_fitted_YMatrix (npost * D) * n of pooled predictive draws (with noise).
hat_matrix_projMatrix D * n * n of averaged projection hat-matrices. To avoid recalculate for estimating degree of freedom.
a, bNumeric values of the rho hyperparameters used.
A 3-D array of predictors with dimensions D * n * p.
A matrix of outcomes with dimensions D * n.
Logical; include an intercept term? Default TRUE.
Numeric; shape parameter of the Gamma prior. Default 2.
Numeric or NULL; scale parameter of the Gamma prior. If NULL,
defaults to 0.5*(D+1)/(D*(a-1)).
Integer; number of burn-in MCMC iterations. Default 4000.
Integer; number of post-burn-in samples to retain. Default 4000.
Integer or NULL; random seed for reproducibility. Default NULL.
Logical; print progress messages? Default TRUE.
Integer; print progress every this many iterations. Default 1000.
Integer; index of this MCMC chain (for labeling messages). Default 1.
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)
Run the code above in your browser using DataLab