groupSS: MCMC algorithm for the estimation of the Bayesian model

Description Usage Arguments Value Examples

View source: R/groupSS.R

Description

Gibbs sampling algorithm for the estiamtion of the model with group spike-and-slab prior

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
groupSS(
  y,
  X,
  g_id,
  beta_init = NULL,
  zeta_init = NULL,
  w_init = NULL,
  nusq_init = NULL,
  sigsq_init = 1,
  v0 = 0.005,
  a1 = 0.001,
  a2 = 0.001,
  c1 = 0.001,
  c2 = 0.001,
  Nmcmc = 5000,
  ind = 1:Nmcmc
)

Arguments

y

response for n subjects

X

predictors - dimension n subjects x L predictors

g_id

numeric vector indicating group membership in the predictors. Contains values 1,…,g if the predictors belong to g groups

beta_init

initial values for β. Defaults to 0.

zeta_init

initial values for ζ. Defaults to random generation from Ber(0.5).

w_init

initial value for w - the complexity parameter. Defaults to proportion of 1s in zeta_init.

nusq_init

initial values for ν^2. Defaults to 1.

sigsq_init

initial values for \sig^2. Defaults to 1.

v0

hyperparameter v0. Defaults to 0.005.

a1

hyperparameter a1. Defaults to 0.001.

a2

hyperparameter a2. Defaults to 0.001.

c1

hyperparameter c1. Defaults to 0.001.

c2

hyperparameter c2. Defaults to 0.001.

Nmcmc

number of MCMC samples to generate. Defaults to 5000.

ind

indices of MCMC samples to use after burnin and thinning. Defaults to 1 to Nmcmc.

Value

zeta: MCMC samples of ζ - dimension N samples x g groups

b: MCMC samples of β - dimension N samples x L predictors

x_cnames: column names from the predictor matrix

Examples

1
2
3
4
5
6
7
p = 10
n = 100
beta = rep(c(2,0), c(p/2,p/2))
g_id = rep(c(1,2), c(p/2,p/2))
X = matrix(rnorm(n*p), nrow = n)
y = rnorm(n, mean = X%*%beta, sd = 0.01)
groupSS(y, X, g_id, Nmcmc = 50)

shariq-mohammed/RADIOHEAD documentation built on Dec. 10, 2020, 10:19 a.m.