BLRM.Tuning: Bayesian Logistic Regression Model (BLRM) Tuning for Proposal...

Description Usage Arguments Details Value Examples

View source: R/RcppWrapper.R

Description

Performs hyper parameter tuning of proposal standard deviation that can be used in Bayesian Logistic Regression Model training with user specified parameters and data

Usage

1
BLRM.Tuning(Y0, X0, PriorVar, nMC = 10000, b = 50, seed = 1)

Arguments

Y0

vector of responses

X0

covariate matrix

PriorVar

variance of prior distribution of beta

nMC

number of MCMC samples, should be the multiple of b

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 beta samples, beta acceptance rates and proposal SD for each 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)

## Compute optimal proposal SD;
test1 <- BLRM.Tuning(Y0 = Y, X0 = X, PriorVar = 1000,
                     nMC = 100, b = 10)

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