horseshoe_mcmc | R Documentation |
Implements Bayesian variable selection using the hierarchical Horseshoe prior
across multiply-imputed datasets. This model applies global–local shrinkage
to regression coefficients via a global scale (tau2
), local scales
(lambda2
), and auxiliary hyperpriors (kappa
, eta
).
horseshoe_mcmc(
X,
Y,
intercept = TRUE,
nburn = 4000,
npost = 4000,
seed = NULL,
verbose = TRUE,
printevery = 1000,
chain_index = 1
)
X |
A 3-D array of predictors with dimensions |
Y |
A matrix of outcomes with dimensions |
intercept |
Logical; include an intercept term? Default |
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 prints). Default |
A named list with components:
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 local shrinkage parameters \lambda_j^2
.
post_kappa
Matrix npost × p
of auxiliary local hyperparameters \kappa_j
.
post_tau2
Numeric vector of length npost
, sampled global scale \tau^2
.
post_eta
Numeric vector of length npost
, sampled auxiliary global hyperparameter \eta
.
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.
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 <- horseshoe_mcmc(X, Y, nburn = 100, npost = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.