View source: R/CVBFFunctions.R
PredCVBFMHbw | R Documentation |
Draw bandwidths from CVBF predictive posterior by Metropolis Hasting sampling
PredCVBFMHbw(
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. Should be chosen with care to ensure good mixing. |
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. |
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 = PredCVBFMHbw(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.