Description Usage Arguments Details Value Examples
Tunes the normal proposal distribution standard deviation for Metropolis Hastings MCMC for the SSVS variable selection method in a Logistic Regression model.
1 | SSVS.Tuning(Y0, X0, c0, tau0, nMC = 1000, b = 50, seed = 1)
|
Y0 |
vector of responses |
X0 |
covariate matrix without intercept |
c0 |
parameter for spike and slab prior of beta |
tau0 |
parameter for spike and slab prior of beta |
nMC |
number of MCMC samples |
b |
batch size |
seed |
set seed for random number generation |
Runs nMc/b number of batches of size b. In each batch the algorithm calculates the Metropolis acceptance rate and adjusts the proposal standard deviation accordingly. As such, nMC must be a multiple of b.
A nested list of gamma samples, beta samples, beta acceptance rates for each batch, and the proposal standard deviations at the final batch.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## simulate data;
set.seed(1);
N = 100;
p = 10;
X = matrix(data = rnorm(N*p), nrow=N, ncol=p)
beta_true = c(rep(1,p/2),rep(0,p/2))
eta = X %*% beta_true
pi = exp(eta) / (1 + exp(eta))
Y = rbinom(N,1,pi)
## fit model;
test1 <- G3proj::SSVS.Tuning(Y0 = Y, X0 = X, c0 = 10,
tau0 = 0.4, nMC = 1000, b = 50)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.