OSCV_Gauss_dens: The OSCV function based on L_G, the one-sided Gaussian...

Description Usage Arguments Details Value References See Also Examples

View source: R/OSCV_density.R

Description

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

Usage

1
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.

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,

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.

Value

The vector of values of the OSCV function for the correponsing vector of h values.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)

## End(Not run)

Example output

Loading required package: mc2d
Loading required package: mvtnorm

Attaching package: 'mc2d'

The following objects are masked from 'package:base':

    pmax, pmin

OSCV documentation built on May 2, 2019, 6:44 a.m.

Related to OSCV_Gauss_dens in OSCV...