0

I could get the survival rate and it's 95% CI in this way:

library(survival)
library(survminer)

lung
lung$survobj1=with(lung,Surv(time,status==2))
fit1 <- survfit(survobj1 ~ 1, data = lung, conf.type = "log-log")
summary(fit1,times = seq(0, 19) * 56)

As you can see, the summary return the survival rate and its 95% CI: enter image description here

Now I'd like to get the cumulative incidence rate and its 95% CI in the similar way, but I don't know how to get it from the summary.

I also tried to plot the cumulative incidence rate by using:

ggsurvplot(fit1,data=lung,conf.int = TRUE,fun="cumhaz")

But I am not sure if I was doing in the right way.

Robin
  • 325
  • 2
  • 12

1 Answers1

0

Thanks Bora's advice. I further found that package(tidycmprsk) is more convenient for calculating the 95% CI of incidence rate.

library(survival)
library(survminer)
library(tidycmprsk)
library(ggsurvfit)

data(lung)
lung$event="dead"
lung$event[which(lung$status==1)]="censor"
cuminc(Surv(time, factor(event)) ~ 1, lung) %>%
tidy_cuminc(times=seq(0,19)*56) # change to specific time point

Robin
  • 325
  • 2
  • 12