# HazardRateEst: Kernel Hazard Rate Estimation In NPHazardRate: Nonparametric Hazard Rate Estimation

## Description

Implements the (classical) kernel hazard rate estimator for right censored data defined in Tanner and Wong (1983).

## Usage

 `1` ```HazardRateEst(xin, xout, kfun, h, ci) ```

## Arguments

 `xin` A vector of data points. Missing values not allowed. `xout` A vector of grid points at which the estimate will be calculated. `kfun` Kernel function to use. Supported kernels: Epanechnikov, Biweight, Gaussian, Rectangular, Triangular, HigherOrder. `h` A scalar, the bandwidth to use in the estimate. `ci` A vector of censoring indicators: 1's indicate uncensored observations, 0's correspond to censored obs.

## Details

The kernel hazard rate estimator of Tanner and Wong (1983) is given by

λ(x;h) = sum(K_h(x-X_i)*δ_i*(n-i+1)^{-1})

h is determined by a bandwidth rule such as `PlugInBand`. `HazardRateEst` is also used as a pilot estimate in the implementation of both the variable bandwidth estimate `VarBandHazEst` and the transformed hazard rate estimate `TransHazRateEst`.

## Value

A vector with the hazard rate estimates at the designated points xout.

## References

`VarBandHazEst, TransHazRateEst, PlugInBand`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```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 ti<- rweibull(SampleSize, .6, 1) #draw a random sample from the actual distribution ui<-rexp(SampleSize, .2) #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 huse<-PlugInBand(x1, x, cen, Biweight) arg2<-HazardRateEst(x1, x, Epanechnikov, huse, cen) #Calculate the estimate lines(x, arg2, lty=2) #draw the result on the graphics device. ```