SSVS.Logistic: Stochastic Search Variable Selection (SSVS) for Logistic...

Description Usage Arguments Value Examples

View source: R/RcppWrapper.R

Description

Performs SSVS for a logistic regression model with user specified parameters and data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
SSVS.Logistic(
  Y0,
  X0,
  propSD0,
  c0,
  tau0,
  nMC = 1000L,
  nBI = 250L,
  thin = 5L,
  seed = 1L
)

Arguments

Y0

vector of responses

X0

covariate matrix without intercept

propSD0

vector of standard deviations for normal proposal density

c0

parameter for spike and slab prior of beta

tau0

parameter for spike and slab prior of beta

nMC

number of MCMC samples

nBI

number of burn-in samples

thin

number of samples to skip over in thinning

seed

set seed for random number generation

Value

a nested list of gamma samples, beta samples, and beta acceptance rates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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)
propSD0 = rep(.5,p)

## fit model;
test1 <- G3proj::SSVS.Logistic(Y0 = Y, X0 = X, propSD0, c0 = 10,
                               tau0 = 0.4, nMC = 1000, nBI = 100, thin=1, seed=1)

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