densityDT {DTDA}R Documentation

Estimation of a kernel density function under random double truncation

Description

This function provides the nonparametric kernel density estimation of a doubly truncated random variable.

Usage

densityDT(X, U, V, bw = "DPI2", from, to, n, wg = NA)

Arguments

X

numeric vector with the values of the target variable.

U

numeric vector with the values of the left truncation variable.

V

numeric vector with the values of the rigth truncation variable.

bw

The smoothing bandwidth to be used, but can also be a character string giving a rule to choose the bandwidth. This must be one of "NR", "DPI1", "DPI2", "LSCV" or "SBoot" with default "DPI2".

from

the left point of the grid at which the density is to be estimated. The default is min(X)+1e-04.

to

the rigth point of the grid at which the density is to be estimated. The default is max(X)-1e-04.

n

number of evaluation points on a equally spaced grid.

wg

Numeric vector of random weights to correct for double truncation. Default weights correspond to the Efron-Petrosian NPMLE.

Details

The nonparametric kernel density estimation for a variable which is observed under random double truncation is computed as proposed in Moreira and de Uña-Álvarez (2012). As usual in kernel smoothing, the estimator is obtained as a convolution between a kernel function and an appropriate estimator of the cumulative df. Gaussian kernel is used. The automatic bandwidth selection procedures for the kernel density estimator are those proposed in Moreira and Van Keilegom (2013). The automatic bandwidth selection alternatives are appropriate modifications, i.e, taking into account the double truncation issue, of the normal reference rule, two types of plug-in procedures, the least squares cross-validation and a bootstrap based method proposed in Cao et al. (1994) and Sheater and Jones (1991) for the complete data.

Value

A list containing the following values:

x

the n coordinates of the points where the density is estimated.

y

the estimated density values.

bw

the bandwidth used.

Author(s)

Carla Moreira, de Uña-Álvarez and Rosa Crujeiras

References

Cao R, Cuevas A and González-Manteiga W (1994). A comparative study of several smoothing methods in density estimation. Computational Statistics and Data Analysis 17, 153-176.

Moreira C and de Uña-Álvarez J (2012) Kernel density estimation with doubly truncated data. Electronic Journal of Statistics 6, 501-521.

Moreira C and Van Keilegom I (2013) Bandwidth selection for kernel density estimation with doubly truncated data. Computational Statistics and Data Analysis 61, 107-123.

Sheather S and Jones M (1991) A reliable data-based bandwidth selection method for kernel density estimation. Journal of the Royal Statistical Society: Series B 53, 683-690.

Silverman BW (1986) Density Estimation. London: Chapman and Hall.

See Also

hazardDT

Examples


set.seed(4321)

n<-50
X <- runif(n, 0, 1)
U <- runif(n,-1/3, 1)
V <- U + 1/3
for (i in 1:n){

	while (U[i] > X[i] | V[i] < X[i]){
	X[i] <- runif(1, 0, 1)
  U[i] <- runif(1, -1/3, 1)
	V[i] <- U[i] + 1/3
	}

}


vxDens1<-densityDT(X,U,V,bw="DPI1",0,1,500)
plot(vxDens1, type = "l")
vxDens2<-densityDT(X,U,V,bw="DPI2",0,1,500)
vxDens3<-densityDT(X,U,V, bw=0.5,0,1,500)
vxDens4<-densityDT(X,U,V,bw="LSCV",0,1,500)


data(Quasars)
densityDT(Quasars[,1],Quasars[,2],Quasars[,3],bw="DPI1",-2.5,2.2,500)
densityDT(Quasars[,1],Quasars[,2],Quasars[,3], bw=0.5,500)


[Package DTDA version 3.0.1 Index]