Learn R Programming

OSCV (version 1.0)

OSCV_LI_dens: The OSCV function based on the kernel

Description

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

Usage

OSCV_LI_dens(h, dat, alpha, sigma)

Arguments

h
numerical vector of bandwidth values,
dat
numerical vecror of data values,
alpha
first parameter of the kernel \(L_I\),
sigma
second parameter of the kernel \(L_I\).

Value

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

Details

Computing the OSCV function for the given vector of bandwidth values \(h\) and the data vector \(dat\). The function is based on the one-sided kernel L_I that depends on the parameters \(\alpha\) and \(\sigma\). The kernel \(L_I\) is robust in the special case of \(\alpha=16.8954588\) and \(\sigma=1.01\). The other special case is obtained when either of the following holds:
  • \(\sigma=1\) for any \(-\infty<\alpha<\infty\).
In the above cases the kernel \(L_I\) reduces to the one-sided Gaussian kernel \(L_G\). The function's minimizer is to be used without additional rescaling to compute the ultimate Gaussian density estimate under the assumption that the underlying density is smooth.

References

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

See Also

OSCV_Gauss_dens, OSCV_Epan_dens, C_smooth, L_I, H_I.

Examples

Run this code
## Not run: ------------------------------------
# # Example 1 (Old Faithful geyser data)
# dev.new()
# data=faithful[,1]         # Data on n=272 eruption duration of the Old Faithful geyser.
# harray=seq(0.025,0.6,len=50)
# alp=16.8954588
# sig=1.01
# plot(harray,OSCV_LI_dens(harray,data,alpha=alp,sigma=sig),lwd=3,'l',xlab="h",
# ylab="L_I-based OSCV",main="OSCV_LI(h) for eruption duration",cex.main=1.5,cex.lab=1.7,
# cex.axis=1.7)
# h_OSCV_LI=round(optimize(OSCV_LI_dens,c(0.001,0.5),tol=0.001,dat=data,alpha=16.8954588,
# sigma=1.01)$minimum,digits=4)
# legend(0.01,-0.2,legend=c("n=272",paste("h_OSCV_LI=",h_OSCV_LI)),cex=1.8,bty="n")
# legend(0.25,-0.33,legend=c("Parameters of L_I:", paste("alpha=",alp),
# paste("sigma=",sig)),cex=1.7,bty="n")
# 
# # Example 2 (Simulated example)
# dat_norm=rnorm(100)   #generating a random sample of size n=100 from the N(0,1) density
# harray=seq(0.05,1.5,len=100)
# OSCVarray=OSCV_LI_dens(harray,dat=dat_norm,16.8954588,1.01)
# dev.new()
# plot(harray,OSCVarray,lwd=3,'l',xlab="h",ylab="L_I-based OSCV",
# main="OSCV_LI(h) for data generated from N(0,1)",cex.main=1.5,cex.lab=1.7,cex.axis=1.7)
# h_OSCV_LI_norm=round(optimize(OSCV_LI_dens,c(0.001,1),tol=0.001,
# dat=dat_norm,16.8954588,1.01)$minimum,digits=4)
# legend(0,OSCVarray[1],legend=c("n=100",paste("h_OSCV_LI=",h_OSCV_LI_norm),
# "Parameters of the robust kernel L_I:","alpha=16.8954588", "sigma=1.01"),cex=1.5,bty="n")
## ---------------------------------------------

Run the code above in your browser using DataLab