View source: R/mcmc_functions.R
spike_slab_probit | R Documentation |
Generates Markov chain targeting the posterior corresponding to Bayesian probit regression with spike and slab priors
spike_slab_probit( chain_length, X, y, tau0, tau1, q, rinit = NULL, verbose = FALSE, burnin = 0, store = TRUE, Xt = NULL, XXt = NULL, tau0_inverse = NULL, tau1_inverse = NULL )
chain_length |
Markov chain length |
X |
matrix of length n by p |
y |
Response |
tau0 |
prior hyperparameter (non-negative real) |
tau1 |
prior hyperparameter (non-negative real) |
q |
prior hyperparameter (strictly between 0 and 1) |
rinit |
initial distribution of Markov chain (default samples from the prior) |
verbose |
print iteration of the Markov chain (boolean) |
burnin |
chain burnin (non-negative integer) |
store |
store chain trajectory (boolean) |
Xt |
Pre-calculated transpose of X |
XXt |
Pre-calculated matrix X*transpose(X) (n by n matrix) |
tau0_inverse |
Pre-calculated matrix inverse(I + tau0^2*XXt) (n by n matrix) |
tau1_inverse |
Pre-calculated matrix inverse(I + tau1^2*XXt) (n by n matrix) |
Output from Markov chain targeting the posterior corresponding to Bayesian logistic regression with spike and slab priors
# Synthetic dataset syn_data <- synthetic_data(n=100,p=200,s0=5,error_std=2,type='probit') X <- syn_data$X Xt <- t(X) y <- syn_data$y # Hyperparamters params <- spike_slab_params(n=nrow(X),p=ncol(X)) # Run S^3 sss_chain <- spike_slab_probit(chain_length=4e3,burnin=1e3,X=X,y=y, tau0=params$tau0,tau1=params$tau1,q=params$q,verbose=FALSE,store=FALSE) # Use posterior probabilities for variable selection sss_chain$z_ergodic_avg[1:10]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.