I am fairly new to survival analysis and am playing around in R. I have a fairly simple Cox model
library(survival)
data(kidney)
cox<-coxph(Surv(time, type)~delta, data=kidney)
baseline <- basehaz(cox , centered=FALSE)
cox.survfit<- survfit(cox)
plot(cox.survfit)
My question is how do i calculate the survival rates myself without calling the survfit function. I tried to look at this stackoverflow post which i kind of understand but am not exactly able to turn it into code.
I have the h0 from basehaz but I am not sure about the rest of the calculations. Any ideas?
EDIT:- Added the kidney dataset in csv format(in case you don't have the same columns in your kidney datset ) :-
"time","delta","type"
1.5,1,1
3.5,1,1
4.5,1,1
4.5,1,1
5.5,1,1
8.5,1,1
8.5,1,1
9.5,1,1
10.5,1,1
11.5,1,1
15.5,1,1
16.5,1,1
18.5,1,1
23.5,1,1
26.5,1,1
2.5,0,1
2.5,0,1
3.5,0,1
3.5,0,1
3.5,0,1
4.5,0,1
5.5,0,1
6.5,0,1
6.5,0,1
7.5,0,1
7.5,0,1
7.5,0,1
7.5,0,1
8.5,0,1
9.5,0,1
10.5,0,1
11.5,0,1
12.5,0,1
12.5,0,1
13.5,0,1
14.5,0,1
14.5,0,1
21.5,0,1
21.5,0,1
22.5,0,1
22.5,0,1
25.5,0,1
27.5,0,1
0.5,1,2
0.5,1,2
0.5,1,2
0.5,1,2
0.5,1,2
0.5,1,2
2.5,1,2
2.5,1,2
3.5,1,2
6.5,1,2
15.5,1,2
0.5,0,2
0.5,0,2
0.5,0,2
0.5,0,2
0.5,0,2
0.5,0,2
0.5,0,2
0.5,0,2
0.5,0,2
0.5,0,2
1.5,0,2
1.5,0,2
1.5,0,2
1.5,0,2
2.5,0,2
2.5,0,2
2.5,0,2
2.5,0,2
2.5,0,2
3.5,0,2
3.5,0,2
3.5,0,2
3.5,0,2
3.5,0,2
4.5,0,2
4.5,0,2
4.5,0,2
5.5,0,2
5.5,0,2
5.5,0,2
5.5,0,2
5.5,0,2
6.5,0,2
7.5,0,2
7.5,0,2
7.5,0,2
8.5,0,2
8.5,0,2
8.5,0,2
9.5,0,2
9.5,0,2
10.5,0,2
10.5,0,2
10.5,0,2
11.5,0,2
11.5,0,2
12.5,0,2
12.5,0,2
12.5,0,2
12.5,0,2
14.5,0,2
14.5,0,2
16.5,0,2
16.5,0,2
18.5,0,2
19.5,0,2
19.5,0,2
19.5,0,2
20.5,0,2
22.5,0,2
24.5,0,2
25.5,0,2
26.5,0,2
26.5,0,2
28.5,0,2
type
anddelta
are not in thekidney
data set I get from survival $\endgroup$