# TransHazRateEst: Transformation Based Hazard Rate Estimator In NPHazardRate: Nonparametric Hazard Rate Estimation

## Description

Implements the transformated kernel hazard rate estimator of Bagkavos (2008). The estimate is expected to have less bias compared to the ordinary kernel estimate HazardRateEst. The estimate results by first transforming the data to a sample from the exponential distribution through the integrated hazard rate function, estimated by iHazardRateEst and uses the result as input to the classical kernel hazard rate estimate HazardRateEst. An inverse transform turn the estimate to a hazard rate estimate of the original sample. See section "Details" below.

## Usage

 1 TransHazRateEst(xin, xout, kfun, ikfun, h1, h2, ci) 

## Arguments

 xin A vector of data points. Missing values not allowed. xout A vector of points at which the hazard rate function will be estimated. kfun Kernel function to use. Supported kernels: Epanechnikov, Biweight, Gaussian, Rectangular, Triangular, HigherOrder. ikfun An integrated kernel function to use. Supported kernels: Epanechnikov, Biweight, Gaussian, Rectangular, Triangular, HigherOrder. h1 A scalar, pilot bandwidth. h2 A scalar, transformed kernel bandwidth. ci A vector of censoring indicators: 1's indicate uncensored observations, 0's correspond to censored obs.

## Details

The transformed kernel hazard rate estimate of Bagkavos (2008) is given by

λ_t(x;h_1, h_2).

The estimate uses the classical kernel hazard rate estimate λ(x; h_1) implemented in HazardRateEst and its integrated version

Λ(x; h_1) = \int_{-∞}^x λ(t;h_1)dt

where k(x) = \int_{-∞}^x K(y)\,dy implemented in iHazardRateEst. The pilot bandwidth h_1 is determined by an optimal bandwidth rule such as PlugInBand.

• TO DO: Insert a rule for the adaptive bandwidth h_2.

## Value

A vector with the values of the function at the designated points xout.

## References

VarBandHazEst, HazardRateEst, PlugInBand
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 x<-seq(0, 5,length=100) #design points where the estimate will be calculated plot(x, HazardRate(x, "weibull", .6, 1), type="l", xlab = "x", ylab="Hazard rate") #plot true hazard rate function SampleSize <- 100 mat<-matrix(nrow=SampleSize, ncol=20) for(i in 1:20) { #Calculate the average of 20 estimates and draw on the screen ti<- rweibull(SampleSize, .6, 1) #draw a random sample from the actual distribution ui<-rexp(SampleSize, .05) #draw a random sample from the censoring distribution cat("\n AMOUNT OF CENSORING: ", length(which(ti>ui))/length(ti)*100, "\n") x1<-pmin(ti,ui) #this is the observed sample cen<-rep.int(1, SampleSize) #censoring indicators cen[which(ti>ui)]<-0 #censored values correspond to zero h2<-DefVarBandRule(ti, cen) #Deafult Band. Rule - Weibull Reference huse1<- PlugInBand(x1, x, cen, Biweight) # mat[,i]<-TransHazRateEst(x1,x,Epanechnikov,IntEpanechnikov,huse1,h2,cen) } lines(x, rowMeans(mat) , lty=2) #draw the average transformed estimate