search for: cumprob

Displaying 1 result from an estimated 1 matches for "cumprob".

Did you mean: cumprod
2001 Oct 18
0
Numerical precision of hist densities or cumsum?
...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,type="l",xlim=c(0,95)) This works...