Displaying 1 result from an estimated 1 matches for "histx".
Did you mean:
hist
2001 Oct 18
0
Numerical precision of hist densities or cumsum?
...o see the
hazard rates they imply. So I eventually ended up with this, which uses
the hist object's handy $density and the cumsum function in R:
x <- c(rweibull(21000,0.5,0.7))
#create "breaks" vector to go into histogram
#need last break bigger than max(x)
y <- seq(0,max(x)+2)
histx <- hist(x,freq=FALSE,breaks=y)
cumProb<- cumsum(histx$density)
survival <- 1-cumProb
survival<- c(1,survival)
survival <- survival[1:length(histx$density)]
hazard <- histx$density / survival
plot(hazard,type="l")
par(ask=TRUE)
retention<- 1-hazard
plot(retention,typ...