| Title: | Kernel Density Estimation with a Markov Chain Monte Carlo Sample |
|---|---|
| Description: | Provides methods for selecting the optimal bandwidth in kernel density estimation for dependent samples, such as those generated by Markov chain Monte Carlo (MCMC). Implements a modified biased cross-validation (mBCV) approach that accounts for sample dependence, improving the accuracy of estimated density functions. |
| Authors: | Juhee Lee [aut, cre], Hang J. Kim [aut], Young-Min Kim [aut] |
| Maintainer: | Juhee Lee <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.0.2 |
| Built: | 2026-05-20 09:24:35 UTC |
| Source: | https://github.com/cran/KDEmcmc |
Calculate the optimal bandwidth estimate for the kernel density estimator with a Markov chain Monte Carlo sample using modified biased cross-validation method.
mBCV(Y_in) ## S3 method for class 'mBCV_obj' print(x, ...)mBCV(Y_in) ## S3 method for class 'mBCV_obj' print(x, ...)
Y_in |
data from which the estimate is to be computed. |
x |
object of class |
... |
further arguments passed to or from other methods. |
mBCV returns a list of the following conmponents:
bw |
optimal bandwidth. |
IACT |
intergrated autocorrelation time. |
Y_in |
input data. |
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)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)
mBCV_obj
draw a histogram and density curve of the results.
## S3 method for class 'mBCV_obj' plot(x, main=NULL, xlab="", ...)## S3 method for class 'mBCV_obj' plot(x, main=NULL, xlab="", ...)
x |
|
main |
title of plot. |
xlab |
title for the x axis. |
... |
arguments to be paseed to methods. |
No return value. Called for its side effects (generates a plot).
a simulated data from the Gibbs sampler.
data("simMCMC")data("simMCMC")
a numeric vector of length 1000.
data(simMCMC)data(simMCMC)