Package 'KDEmcmc'

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

Help Index


RCPP Implementation of the Library

Description

Rcpp_cKDE-class

Value

No return value


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 class 'mBCV_obj'
print(x, ...)

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.

Value

mBCV returns a list of the following conmponents:

bw

optimal bandwidth.

IACT

intergrated autocorrelation time.

Y_in

input data.

Examples

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)

Plot Kernel Density Result from mBCV_obj

Description

draw a histogram and density curve of the results.

Usage

## S3 method for class 'mBCV_obj'
plot(x, main=NULL, xlab="", ...)

Arguments

x

mBCV_obj object.

main

title of plot.

xlab

title for the x axis.

...

arguments to be paseed to methods.

Value

No return value. Called for its side effects (generates a plot).


Simulated Markov Chain Monte Carlo Sample

Description

a simulated data from the Gibbs sampler.

Usage

data("simMCMC")

Format

a numeric vector of length 1000.

Examples

data(simMCMC)