Andreas Leha
2023-Sep-06 10:05 UTC
[R] confidence interval around Aalen-Johansen if no events
Hi all, I'd like to calculate confidence intervals around Aalen-Johansen estimates at given time points. And later I'd like to be able to compare the Aalen-Johansen estimates at given time points between groups. My problem is, that there are no events recorded. So my question is: Does anyone know how to get confidence intervals around Aalen-Johansen estimates in the absence of (or prior to) events? (And ideally also how to compare the Aalen-Johansen estimates at given time points between groups in that situation.) Note that I can do the same thing for Kaplan-Meier estimates (using the bpcp package). Many thanks in advance! Best, Andreas PS: Some code that illustrates my problem: ------------------------- library("dplyr") library("survival") ## read data sdat <- structure(list(time = c(2, 189, 182, 2, 184, 179, 179, 159, 18, 177, 177, 182, 184, 178, 179, 178, 179, 179, 177, 178, 175, 184, 179, 179, 176, 176, 175, 193, 183, 182, 179, 175, 178, 90, 189, 177, 185, 179, 184, 171, 182, 181, 179, 179, 175, 104, 185, 180, 180, 177, 176, 184, 181, 178, 184, 178, 182, 176, 176, 180, 180, 176, 183, 182, 175, 184, 182, 182, 177, 182, 64, 178, 179, 179, 176, 93, 131, 184, 181), event = structure(c(2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L), .Label = c("censored", "competing_event", "event_of_interest"), class = "factor"), group = structure(c(2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 1L), .Label = c("G1", "G2"), class = "factor")), row.names = c(NA, -79L), class = c("tbl_df", "tbl", "data.frame")) sdat ## there are no events of interest: sdat$event %>% table(exclude = NULL) ## fit works fine fit <- survfit(Surv(time, event) ~ group, data = sdat) ## the estimate is at 0 (as expected) fit$pstate[,3] ## but there is no confidence estimate fit$lower[,3] fit$upper[,3] ## cmprsk does not event return estimates for the event of interest library("cmprsk") fit <- cuminc(ftime = sdat$time, fstatus = sdat$event, cencode = "censored", group = sdat$group) fit ## note that I can get confidence intervals from a Kaplan-Meier ## estimator: ## censor competing events: sdat <- sdat %>% mutate(event2 = recode(event, competing_event = "censored")) %>% mutate(event2 = as.numeric(event2) - 1) sdat$event2 %>% table(exclude = NULL) ## fit using the survival package fit <- survfit(Surv(time, event2) ~ 1, data = sdat) fit ## no (meaningful?) confidence intervals fit$lower fit$upper ## but through the bpcp package this is possible library("bpcp") sfit2 <- bpcpfit(Surv(time, event2) ~ 1, data = sdat) sfit2 tidykmciLR(sfit2) ## can further compare between groups: bpcp2samp(sdat$time, sdat$event2, sdat$group, testtime = 150, parmtype = "difference")