Search code examples
rdplyrsurvival-analysisconfidence-intervalcox

Create a column includes all confidence intervals


I have a code like that :

library("survival")
library("survminer")

data("lung")

res.cox <- coxph(Surv(time, status) ~ sex, data = lung)

x<-confint(res.cox)

I am looking to get all the confidence intervals, not only the upper and lower bands. So I will have a confidence interval for each participant (N=228). Actually, I need to plot the confidence intervals with their distributions.


Solution

  • If you want it to assign it to the data is :

    
    lung$CI<- predict(res.cox)