hazardDT {DTDA}R Documentation

Estimation of the kernel hazard function under random double truncation

Description

This function provides the nonparametric kernel hazard estimation for a variable which is observed under random double truncation, which is defined as a convolution of a kernel function with the NPMLE of the cumulative hazard. Least square cross validation bandwidth selection procedure is implemented too.

Usage

hazardDT(X, U, V, bw = "LSCV", 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 "LSCV".

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 et al.(2021). As usual in kernel smoothing, the estimator is obtained as a convolution between a kernel function and an appropriate estimator of the cumulative hazard. Gaussian kernel is used. The automatic bandwidth selection procedures for the kernel hazard estimator is the least square cross validation, presented in Moreira et al. (2021).

Value

A list containing the following values:

x

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

y

the estimated hazard values.

bw

the bandwidth used.

Author(s)

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

References

Moreira C, de Uña-Álvarez J, Santos AC and Barros H (2021) Smoothing Methods to estimate the hazard rate under double truncation. https://arxiv.org/abs/2103.14153.

See Also

densityDT

Examples


set.seed(4321)

n<-100
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
	}

}


vxhazard1<-hazardDT(X,U,V,bw=0.3,0,1,500)
vxhazard2<-hazardDT(X,U,V,bw="LSCV",0,1,500)

[Package DTDA version 3.0.1 Index]