PredCVBFIndepMHbw: Draw bandwidths from CVBF predictive posterior by independent...

View source: R/CVBFFunctions.R

PredCVBFIndepMHbwR Documentation

Draw bandwidths from CVBF predictive posterior by independent Metropolis Hasting sampling

Description

Draw bandwidths from CVBF predictive posterior by independent Metropolis Hasting sampling

Usage

PredCVBFIndepMHbw(
  ndraw = 100,
  propsd = NULL,
  maxIter = 10000,
  XT1,
  XV1,
  startingbw = NULL
)

Arguments

ndraw

Number of unique draws desired for the bandwidth parameter from the posterior.

propsd

A tuning parameter, corresponds to what proposal standard deviation should be for when using MH to traverse the posterior. We give a decent theoretical default. May need to be altered if performance is bad.

maxIter

The max number of MH iterations to try. Do not set to be too large. It will kick the code out if acceptance rates for MH are small.

XT1

Training set for a data set

XV1

Validation set for a data set

startingbw

A value to start the MH chain at. If not provided, starts at posterior mode. All proposals will be drawn from a distribution whose center is startingbw. This is normally a bad idea, but the posterior is some type of unimodal distribution, so this is actually effective.

Value

A list of bandwidths that come from the posterior distribution. This will be larger than ndraw, as some draws will be repeats.

Examples

set.seed(500)
datasetsample1 = rnorm(600)
trainingindices1 = sample(1:600, size = 300)
XT1 = datasetsample1[trainingindices1]
XV1 = datasetsample1[-trainingindices1]
predbwvec1 = PredCVBFIndepMHbw(ndraw = 500, maxIter = 5000, XT1 = XT1, XV1 = XV1)


naveedmerchant/BayesScreening documentation built on June 13, 2024, 7:56 a.m.