library(cmprsk)
library(MASS)
data(Melanoma)
Melanoma$event <- NA
Melanoma$event[Melanoma$status == 2] <- 0
Melanoma$event[Melanoma$status == 1] <- 1
Melanoma$event[Melanoma$status == 3] <- 2
cif=cuminc(ftime=Melanoma$time, fstatus=Melanoma$event,cencode=0)
cifd <- data.frame(
cause = factor(rep(c(2, 1),c(length(cif[[1]]$time), length(cif[[2]]$time)))),
time = c(cif[[1]]$time, cif[[2]]$time),
cif = c(cif[[1]]$est, cif[[2]]$est))
this above sample code estimates cumulative incidence for competing risk (cif) and then makes a data frame (cifd) to house cumulative incidence values.
my questions are-
1, Is the risk over the complete study of event 1 = 0.3387175 in the presence of competing event 2 ? As indicated by cif?
2, Why is it that the cif duplicates each time in the list cif[[1]]$time
for event 1 and event 2 in cif[[2]]$time
?