cvfunction: Cross Validation for Histogram Hazard Rate Estimator In NPHazardRate: Nonparametric Hazard Rate Estimation

Description

Implements the cross validation function for determining the optimal number of bins for the histogram hazard rate estimator of Patil and Bagkavos (2012). It is used as input in HazardHistogram.

Usage

 1 cvfunction(h, xin, xout, cens) 

Arguments

 h Target number of bins. xin A vector of data points. Missing values not allowed. xout A vector of grid points at which the histogram will be calculated. cens A vector of 1s and zeros, 1's indicate uncensored observations, 0's correspond to censored obs.

Details

The least square cross validation criterion, defined in (12), Patil and Bagkavos (2012) is

CV (h) = \frac{1}{h}∑_k \big\{(2 f^0_k - f^{0^2}_k)[\bar F_k (\bar F_k +1)]^{-1} - f^{0^2}_k[\bar F_k (\bar F_k +1)^2]^{-1}\big\}.

Optimization of the criterion is done through a nonlinear optimization function such as nlminb as illustrated also in the example of HazardHistogram.

Value

Returns the optimal number of bins.

References

HazardHistogram