search for: haz2surv

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

2007 Jan 19
1
Error in basehaz function ?
...<- 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))) { surv[i] <- (1 - haz[i]) * surv[i-1] } return(surv) } If I'm right, wouldn't it be a good idea to change the basehaz function, to avoid misleading the overconfident user...