# Confidence interval of survival data when only time and survival are available

Hi,

I have a data frame with the Time and Survival variables. I am wondering how I can calculate the 95% confidence interval of the Survival probabilities. I found this in Excel ( http://www.real-statistics.com/survival-analysis/kaplan-meier-procedure/confidence-interval-for-the-survival-function/), but I am curious if it can be done with R in an easier way?

My data frame looks like this:

Time Survival
0 1
1 0.99212
2 0.93231
3 0.91655
4 0.96456
...

Thanks,
gib

I didn't work with this type of data, but there is a CRAN task view about survival analysis: https://cran.r-project.org/web/views/Survival.html

Please provide a minimal self-contained example (`reprex`) so that we can better help you.

Here is the data what I have:

time <-c(0,
0.25,
0.5,
0.75,
1,
1.25,
1.5,
1.75,
2,
2.25,
2.5,
2.75,
3,
3.25,
3.5,
3.75,
4,
4.25,
4.5,
4.75,
5,
5.25,
5.5,
5.75,
6,
6.25,
6.5,
6.75,
7
)

survival<- c(1,
0.985517,
0.982847,
0.973423,
0.968911,
0.961524,
0.957839,
0.933874,
0.921184,
0.897022,
0.869381,
0.853798,
0.846216,
0.841908,
0.839648,
0.83228,
0.827154,
0.798489,
0.78272,
0.781892,
0.781892,
0.778198,
0.776338,
0.772644,
0.767109,
0.752567,
0.74212,
0.736594,
0.723689
)
example<-data.frame(survival, time)