SSVS.Tuning: MH Random Walk Proposal Tuning for SSVS under Logistic...

Description Usage Arguments Details Value Examples

View source: R/RcppWrapper.R

Description

Tunes the normal proposal distribution standard deviation for Metropolis Hastings MCMC for the SSVS variable selection method in a Logistic Regression model.

Usage

1
SSVS.Tuning(Y0, X0, c0, tau0, nMC = 1000, b = 50, seed = 1)

Arguments

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

Details

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.

Value

A nested list of gamma samples, beta samples, beta acceptance rates for each batch, and the proposal standard deviations at the final batch.

Examples

 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)

lcw68/G3proj documentation built on Dec. 21, 2021, 9:46 a.m.