Learn R Programming

OSCV (version 1.0)

OSCV_Gauss_dens: The OSCV function based on

Description

Computing the values of the \(L_G\)-based OSCV function in the density estimation context. See Savchuk (2017).

Usage

OSCV_Gauss_dens(h, dat, stype)

Arguments

h
numerical vector of bandwidth values,
dat
numerical vecror of data values,
stype
specifies (anticipated) smoothness of the density function. Thus, \(stype=0\) corresponds to the smooth density, whereas \(stype=1\) corresponds to the nonsmooth density.

Value

The vector of values of the OSCV function for the correponsing vector of \(h\) values.

Details

Computing the values of the OSCV function for the given bandwidth vector \(h\) and data vector \(dat\). The function is based on the one-sided Gaussian kernel \(L_G\). The (anticipated) smoothness of the underlying density function is to be specified. Thus,
  • \(stype=1\) corresponds to the nonsmooth density.
It is usually assumed that the density is smooth if no preliminary information about its nonsmoothness is available. The function's minimizer h_OSCV_dens is to be used without additional rescaling to compute the ultimate Gaussian density estimate.

References

Savchuk, O.Y. (2017). One-sided cross-validation for nonsmooth densty functions, arXiv:1703.05157.

See Also

h_OSCV_dens, OSCV_Epan_dens, OSCV_LI_dens, C_smooth.

Examples

Run this code
## Not run: ------------------------------------
# dat_norm=rnorm(300)   #generating random sample of size n=300 from the standard normal density.
# h_oscv=round(h_OSCV_dens(dat_norm,0),digits=4)
# y=density(dat_norm,bw=h_oscv)
# dev.new()
# plot(y,lwd=3,cex.lab=1.7,cex.axis=1.7,cex.main=1.7,xlab=paste("n=100, h_OSCV=",h_oscv),
# main="Standard normal density estimate by OSCV",ylim=c(0,0.45),xlim=c(-4.5,4.5))
# u=seq(-5,5,len=1000)
# lines(u,dnorm(u),lwd=3,lty="dashed",col="blue")
# legend(0.75,0.4,legend=c("OSCV estimate","N(0,1) density"),lwd=c(3,3),lty=c("solid","dashed"),
# col=c("black","blue"),bty="n",cex=1.25)
## ---------------------------------------------

Run the code above in your browser using DataLab