# Kaplan-Meier multiple group comparisons

Let's say I have the following data frame

library(survival)
library(multcomp)
data(cml)
cml$group<-sample(1:5, 507, replace=T) plot(survfit(Surv(time=cml$time, cml$status)~factor(cml$group)))
(survdiff(Surv(time=cml$time, cml$status)~factor(cml\$group)))


I want to perform multiple comparison test comparing (logrank) for example group0 vs. all other groups or even every group with each other?

Is it necessary to correct for multiple comparisons? If yes, is there a nice way of plotting these multiple comparisons (as for example in plot.TukeyHSD() in aov())?

I have posted the same question in https://stackoverflow.com/questions/11176762/kaplan-meier-multiple-group-comparisons, but the answer presents multiple comparison test with parametric survival not with non parametric (as in my case).

• You can just use coxph (non-parametric baseline) instead of survreg (parametric baseline), as shown here for example: stackoverflow.com/questions/55460095/…. However, this assumes PH for the different groups. – adibender Jun 6 '19 at 17:21

One of the issues of inference that arises in event history models is that hazard functions and survival functions in different groups can cross each other at different points in time. For example both the following conditions can be true:

1. Those individuals in group A who experience the event (i.e. who "do not survive") may do so relatively quickly, while individuals in group B who experience the event take longer to do so.
2. The overall survival in group A may be higher than in group B.

So when you ask about wanting to make comparisons among groups what specifically do you want to compare? Median survival time? The hazard at time t? The survival at time t? The time until survival "flattens" (for some meaning of "flatten")? Something else?

Once you have a well-formulated question about what you would like to compare, multiple comparisons adjustments make sense. Some cases (comparisons at each point in time t, for example) might make the definition of family in the FWER multiple comparison adjustment methods problematic, which might incline one towards the FDR methods, since they scale/do not rely on a definition of family.

• Non-proportional hazards affect the power of the log rank test, but the log rank test is still valid, it is just a test of the time-averaged hazard ratio (better when using robust variance estimates). This is a well defined parameter. The other measures of survival which you alluded to are also valid, but not explicitly assessed by the log rank test. Nonetheless, significance of the log-rank test leads to inference that the survival curves between groups are different. So OP's question is well phrased. Given that there is a modeling analogue using Cox models, how would you recommend... – AdamO Sep 13 '14 at 17:07
• .. handling multiple comparisons? – AdamO Sep 13 '14 at 17:09
• I would go with FDR for all comparisons from a specific model (including ones not appearing in the final model, such as during model building). – Alexis Sep 13 '14 at 17:16
• @AdamO "Nonetheless, significance of the log-rank test leads to inference that the survival curves between groups are different." Under the assumption that true hazard curves do not cross and re-cross? – Alexis Sep 13 '14 at 17:18
• Crossing survival curves necessarily implies that survival is different. It is only a "bad" thing insofar as it limits the power of the test to actually determine there's a difference. (the HR is positive half the time, negative the other half, so the time-averaged hazard ratio is 0, and there goes all your power to detect a difference). So crossing survival curves will not falsely inflate type I error rate which is good. – AdamO Sep 13 '14 at 17:52

Coincidentally, you can indeed think of this much like a Pearson Chi-square test for homogeneity. If the groups you have defined are measured on a similar time scale and are being measured then it makes sense to actually compare survival curves.

A little known fact is that the logrank test is actually a score test for the partial likelihood equations produced by the Cox proportional hazards model. So, if your goal is creating a global test of hazards, you can fit a Cox model with an indicator for groups and conduct a multivariate partial likelihood ratio test.

Nonproportional survival curves are a sensitivity in that they reduce power for both the Cox model and the log rank test, with all the same sensitivities and assumptions. But the obvious solution of presenting model results alongside Kaplan Meier estimates of survivor functions should quickly assess this and explicate all the sensitivities therein.