Learn R Programming

KDEmcmc (version 0.0.2)

mBCV: Calculate Optimal Bandwidth in Kernel Density Estimation

Description

Calculate the optimal bandwidth estimate for the kernel density estimator with a Markov chain Monte Carlo sample using modified biased cross-validation method.

Usage

mBCV(Y_in)

# S3 method for mBCV_obj print(x, ...)

Value

mBCV returns a list of the following conmponents:

bw

optimal bandwidth.

IACT

intergrated autocorrelation time.

Y_in

input data.

Arguments

Y_in

data from which the estimate is to be computed.

x

object of class mBCV_obj; result of a call to mBCV().

...

further arguments passed to or from other methods.

Examples

Run this code
res = mBCV(simMCMC)
den = density(res$Y_in, bw=res$bw)
hist(res$Y_in, xlim=range(den$x), freq=FALSE, 
      main="Histogram and Density Estimates", xlab="")
lines(den$x, den$y, col='blue', lwd=2)

Run the code above in your browser using DataLab