Displaying 1 result from an estimated 1 matches for "surv2haz".
2007 Jan 19
1
Error in basehaz function ?
...:
hazard probability is computed as :
H <- -log(surv)
but it seems to me that hazard probabilities is rather an instantaneous
survival rate that could be computed this way :
H[i] <- 1 - surv[i] / surv[i-1]
Using this rule I achieve satisfiable results with the two following
functions :
surv2haz <- function(surv) {
haz <- surv
haz[1] <- 1 - surv[1]
for(i in c(2:length(surv)))
{
haz[i] <- 1 - surv[i] / surv[i - 1]
}
return(haz)
}
haz2surv <- function(haz) {
surv <- haz
surv[1] <- 1 - haz[1]
for(i in c(2:length(haz)))
{
s...