1

I'm trying to compute a log-rank test that would compare the Kaplan-Meier and the Nelson-Aalen curves. I have the following formulas:

f1_km <- survfit(Surv(futime, fustat) ~ 1, data = data_surv) #Kaplan-Meier

f2_na <- survfit(Surv(futime, fustat) ~ 1, stype=2, ctype=1, data = data_surv) #Nelson-Aalen

My issue is that I need to compute a survdiff formula but now I have two separate datasets. My data is not grouped, in other words there is no stratifying variable but two separate results.

How can I combine the two survival resulting datasets in order to compute a survdiff formula? Thank you for your help.

  • Of course you can. You should even have it combined in one `tibble`. In general, the routine should be `tibble%>% group_by%>% nest%>% map%>% unnest`. Provide sample data and we will try to deal with it. Possibly analyze carefully something I have done here https://stackoverflow.com/questions/69035923/sf-dplyr-grouped-mean-by-same-coordinates-doesnt-work/69041949#69041949 – Marek Fiołka Sep 06 '21 at 19:51
  • Nope. You cannot do it with `survdiff` since the function requires raw data in the form of times and event counts. For those two survfit objects the times and the events are exactly the same. You would need to come up with a function that takes survival estimates as the input. Marek apparently does not understand how the `survdiff` function works. – IRTFM Sep 13 '21 at 18:58

0 Answers0