I can understand that it is possible to estimate survival curves directly from the results of a Cox regression.
The way it can be done, mathematically, is furthermore very nicely explained in this video: https://www.coursera.org/lecture/simple-regression-analysis-public-health/estimating-survival-curves-from-cox-regression-results-iQRtN
I am currently trying to learn how to do this manually in R, but I have not been able to make it work so far. I was therefore hoping that some of you might be able to understand the mathemathics involved as well as being able to translate the proces into R code. I have tried different approaches but without any luck, so any help or input is greatly appreciated.
I am aware that there exist questions on here which share some similarities with this one, but they do not follow the approach in the video, and I do not believe that they answer the problem presented here, which is why I created this question.
As an example, I have created this Cox model
library(survival) data("nwtco") subcoh <- nwtco$in.subcohort selccoh <- with(nwtco, rel==1|subcoh==1) ccoh.data <- nwtco[selccoh,] ccoh.data$subcohort <- subcoh[selccoh] ## central-lab histology ccoh.data$histol <- factor(ccoh.data$histol,labels=c("FH","UH")) ## tumour stage ccoh.data$stage <- factor(ccoh.data$stage,labels=c("I","II","III","IV")) ccoh.data$age <- ccoh.data$age/12 # Age in years fit.ccSP <- cch(Surv(edrel, rel) ~ stage + histol + age, data =ccoh.data, subcoh = ~subcohort, id=~seqno, cohort.size=4028, method="LinYing")
from which I get the following results
> summary(fit.ccSP) Case-cohort analysis,x$method, LinYing with subcohort of 668 from cohort of 4028 Call: cch(formula = Surv(edrel, rel) ~ stage + histol + age, data = ccoh.data, subcoh = ~subcohort, id = ~seqno, cohort.size = 4028, method = "LinYing") Coefficients: Coef HR (95% CI) p stageII 0.693 1.999 1.453 2.751 0.000 stageIII 0.627 1.872 1.348 2.599 0.000 stageIV 1.300 3.668 2.529 5.320 0.000 histolUH 1.458 4.299 3.240 5.704 0.000 age 0.046 1.047 1.002 1.094 0.039
Based on these results, I am trying - as shown in the video - to estimate the survival curves for the different stages, i.e. "stageII", "stageIII" and "stageIV", but, as mentioned, I have not been able to make it work.