ALbw: Computes the plug-in bandwidth of Altman and Leger.

Description Usage Arguments Details Value Author(s) References Examples

Description

The bandwidth parameter for the distribution function kernel estimator is calculated, using the plug-in method of Altman and Leger (1995). Four possible kernel functions can be used for the kernel estimator: "e" Epanechnikov, "n" Normal, "b" Biweight and "t" Triweight.

Usage

1
ALbw(type_kernel = "n", vec_data)

Arguments

type_kernel

The kernel function. You can use four types: "e" Epanechnikov, "n" Normal, "b" Biweight and "t" Triweight. The Normal kernel is used by default.

vec_data

The data sample.

Details

Altman and Leger (1995) recommend the use of the Epanechnikov kernel, because in this case the rate of convergence for the kernel derivative estimator is improved. For the sake of uniformity along the package, the gaussian kernel is used by default, but the user can obviously choose the Epanechnikov function.

Value

A real value for the bandwidth parameter.

Author(s)

Graciela Estevez Perez graci@udc.es and Alejandro Quintela del Rio aquintela@udc.es

References

Altman, N., Leger, C. (1995) Bandwidth selection for kernel distribution function estimation. Journal of Statistical Planning and Inference 46, pp. 195–214.

Quintela-del-Rio, A. and Estevez-Perez, G. (2012) Nonparametric Kernel Distribution Function Estimation with kerdiest: An R Package for Bandwidth Choice and Applications, Journal of Statistical Software 50(8), pp. 1-21. URL http://www.jstatsoft.org/v50/i08/.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Compute the plug-in bandwidth for a sample of 100 random N(0,1) data
x<-rnorm(100,0,1)
h_AL<- ALbw(type_kernel="e",vec_data=x)
h_AL
## Not run: 
## A Quick plot of a distribution function estimate
x<-rnorm(1000)
h_AL<-ALbw(vec_data=x)
F_AL<-kde(vec_data=x, bw=h_AL)
plot(F_AL$grid,F_AL$Estimated_values,type="l")

## End(Not run)
## Not run: 
##  Plotting the distribution function estimate controling the grid points
# and the kernel function
ss <- quantile(x, c(0.05, 0.95))
# number of points to be used in the representation of estimated distribution 
# function
n_pts <- 100 
y <- seq(ss[1],ss[2],length.out=n_pts)
F_AL <- kde(type_kernel="e", x, y, h_AL)$Estimated_values
##  plot of the theoretical and estimated distribution functions
require(graphics)
plot(y,F_AL, type="l", lty=2)
lines(y, pnorm(y),type="l", lty=1)
legend(-1,0.8,c("real","nonparametric"),lty=1:2)

## End(Not run)

Example output

Loading required package: date
Loading required package: chron
Loading required package: evir
[1] 0.413812

kerdiest documentation built on May 2, 2019, 3:24 a.m.