View source: R/CVBFFunctions.R
PredCVBFIndepMHbw | R Documentation |
Draw bandwidths from CVBF predictive posterior by independent Metropolis Hasting sampling
PredCVBFIndepMHbw(
ndraw = 100,
propsd = NULL,
maxIter = 10000,
XT1,
XV1,
startingbw = NULL
)
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. |
A list of bandwidths that come from the posterior distribution. This will be larger than ndraw, as some draws will be repeats.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.