Description Usage Arguments Details Value References Examples
Implements the histogram hazard rate estimator of Patil and Bagkavos (2012)
1 | HazardHistogram(xin, xout, cens, bin)
|
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. |
bin |
Number of bins to use in construction of the histogram. |
The histogram hazard rate estimator is defined in (1), Patil and Bagkavos (2012) by
\hat λ (x) = h_n^{-1} C_{i_{(x)}} = h_n^{-1}f_{i_{(x)}}^0(\bar F_{i_{(x)}}+1)^{-1}.
A vector with the values of the histogram estimate at each bin.
Patil and Bagkavos (2012), Histogram for hazard rate estimation, pp. 286-301, Sankhya, B.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | SampleSize <-400
ti<-rweibull(SampleSize,0.5,0.8)
xout<-seq(0.02, 3.5, length=80)
true.hazard<-dweibull(xout,0.5, 0.8)/(1-pweibull(xout, 0.5, 0.8))
cen<-rep.int(1, SampleSize)
cen[sample(1:SampleSize, SampleSize/10)]<-0
band<-nlminb(start= 2, obj=cvfunction, control = list(iter.max = 100, x.tol = .001)
,xin=ti, xout= xout, cens = cen, lower=.01, upper=max(xout))
bin<- 3.49 * sd(ti)^2 * SampleSize^(-1/3) /50 #Scott 1979 Biometrika default rule
bin<-unlist(band[1])
histest<- HazardHistogram(ti,xout, cen, bin+0.013 )
plot(xout, true.hazard, type="l")
lines(histest[,1], histest[,2], col=2, type="s")
barplot( histest[,2], rep(bin, times=length(histest[,2])))
lines(xout, true.hazard, type="l", lwd=2, col=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.