cvfunction {NPHazardRate} | R Documentation |
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
.
cvfunction(h, xin, xout, cens)
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. |
The least square cross validation criterion, defined in (12), Patil and Bagkavos (2012) is
CV (h) = \frac{1}{h}\sum_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
.
Returns the optimal number of bins.
Patil and Bagkavos (2012), Histogram for hazard rate estimation, pp. 286-301, Sankhya, B.