Cox proportional models have been done with this result.
The two groups (C, B) had overlapping confidence intervals, while the p-value was significant at p<0.001. I have used this code to get the result :
coxph.fit<-coxph(Surv(time_mu , event)~group, data=df)
My goal is to find out if there is a significant difference between C and B with a significant p-value. I have found a method in R in this link Overlapping confidence intervals doesn’t mean non-significant difference, but I do not know how to get all CIs. What is the best way to deal with overlappaing CIs in Cox models?
Best Answer
This is no different from any comparison of regression coefficients in a model. See for example this page in the context of logistic regression. It's straightforward here, as
group
isn't involved in interactions with other predictors. Otherwise you would have to specify values for its interacting predictors.Work in the original regression coefficient log-hazard scale rather than the hazard-ratio scale that you show here. Your null hypothesis is $\beta_B =\beta_C$, where each $\beta$ is the coefficient describing the difference in log-hazard of each group from the reference level of
group
.You also need the coefficient variance-covariance matrix, which provides the estimates both for the variances of individual coefficients (diagonal terms) and for the covariances between the estimates (off-diagonal terms). Then you apply the formula for the variance of a sum of correlated variables to get the variance of $\beta_B -\beta_C$. The coefficient estimates in the log-hazard scale are taken to be distributed normally, so a z-test provides your test of whether the null hypothesis, $\beta_B -\beta_C=0$, is tenable.
Software typically provides helper functions to do this for you. With R, for example, the
contrast()
function in therms
package and the tools in theemmeans
package can perform such calculations for many types of models and scenarios.