LLHRPlugInBand {NPHazardRate} | R Documentation |
Simple Plug in badnwidth selector
Description
Provides the asymptotic MISE optimal plug-in bandwidth for the local linear hazard rate estimator LocLinEst
, defined in (4), Bagkavos (2011). This is the binned data version of the PlugInBand
AMISE optimal bandwidth rule.
Usage
LLHRPlugInBand(BinCenters, h, kfun, Delta, xin, xout, IntKfun, ci, cens)
Arguments
BinCenters |
A vector of data points, the centers of the bins resulting from the discretization of the data. |
h |
Bandwidth for the estimate of the distribution function. |
kfun |
A kernel function. |
Delta |
A scalar. The length of the bins. |
xin |
A vector of data points |
xout |
The point at which the estimates should be calculated. |
IntKfun |
The integrated kernel function. |
ci |
Crude hazard rate estimates. |
cens |
Censoring Indicators. |
Details
The bandwidth selector requires binned data, i.e. data in the form (x_i, y_i)
where x_i
are the bin centers and y_i
are empirircal hazard rate estimates at each x_i
. This is achieved via the DiscretizeData
function. As it can be seen from (4) in Bagkavos (2011), the bandwidth selector also requires an estimate of the functional
\int \left \{ \lambda^{(2)}(x) \right \}^2 \,dx
which is readily implemented in PlugInBand
. It also requires an estimate of the constant
\int \frac{\lambda(x)}{1-F(x)} \,dx
For this reason additionally the plug in bandwidth rule is also used, as it is implemented in the bw.nrd
distribution function default bandwidth rule of Swanepoel and Van Graan (2005). The constants R(K)
and \mu_2^2(K)
are deterministic and specific to the kernel used in the implementation hence can be claculated precisely.
Value
A scalar with the value of the suggested bandwidth.
References
Bagkavos (2011), Annals of the Institute of Statistical Mathematics, 63(5), 1019-1046.
See Also
Examples
x<-seq(0, 5,length=100) #design points where the estimate will be calculated
SampleSize<-100 #amount of data to be generated
ti<- rweibull(SampleSize, .6, 1) # draw a random sample
ui<-rexp(SampleSize, .2) # censoring sample
cat("\n AMOUNT OF CENSORING: ", length(which(ti>ui))/length(ti)*100, "\n")
x1<-pmin(ti,ui) # observed data
cen<-rep.int(1, SampleSize) # initialize censoring indicators
cen[which(ti>ui)]<-0 # 0's correspond to censored indicators
a.use<-DiscretizeData(ti, x) # discretize the data
BinCenters<-a.use$BinCenters # get the data centers
ci<-a.use$ci # get empircal hazard rate estimates
Delta=a.use$Delta # Binning range
h2<-bw.nrd(ti) # Bandwidth to use in constant est. of the plug in rule
h.use<-h2 # the first element is the band to use
huse1<- LLHRPlugInBand(BinCenters,h.use,Epanechnikov,Delta,ti,x,IntEpanechnikov,ci,cen)
huse1