# Cox proportional hazard (non-inferiority hypothesis testing) in R

I have researched this question for hours. Any help is appreciated.

I am using the "survival package" in R with coxph function. I will illustrate with this example

coxph(Surv(time, event==1) ~ age + arm
, data =  survival_data)

Results:
n= 365, number of events= 357
(58 observations deleted due to missingness)

coef exp(coef)  se(coef)      z     Pr(>|z|)
age                                -0.013244  0.986844  0.005087 -2.603      0.00923 **
arm                                 0.670310  1.754843  0.121237  5.529 0.0000000322 ***

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

exp(coef) exp(-coef) lower .95 upper .95
age                                   0.9868     1.0133    0.9771    0.9967
arm(intervention)                                     1.7548     0.5115    1.5414    2.4792


So, the results gives you p value with using wald statistics. I am assuming this a test for HR0=1 (as null) and HRa ≠ 1 (alternative)

How do I test for superiority or non-inferiority (obtaining P values) using a margin like HR=1.3 (for non-inferiority) as an example

To get the idea of what I am trying to do , you can see these articles

Your input is appreciated (using R software)

Non-inferiority for a test treatment is documented if the confidence interval for the outcome difference between the control treatment and the test treatment is beyond (and on the superior side of) the pre-established margin of inferiority. This page has a figure with examples of possible results and how they would be interpreted. Figure 2 of the FDA guidance has a similar display, and a lot more detail in the text.

For superiority, it's just the standard test of whether the difference between the arms is significant, and again in the correct direction. According to the FDA guidance, proper practice would start with the non-inferiority test then proceed to the superiority test.

From your example, it's not clear which arm is the control (prior established) treatment and which is the test (newly being evaluated) treatment. The above principles, however, are easy to apply in either case. If the control treatment is the reference, the outcome event is undesirable, and the HR of 1.3 was the pre-established margin of inferiority, then the 95% confidence interval you show for the test/control HR (1.54,2.48) is completely on the wrong side of the margin of inferiority. In that case, the test treatment is also clearly inferior to the control treatment, as the estimate of the HR is significantly different from 1 and the test treatment has the higher hazard estimate.

• Thank you for the elaboration. I fixed the output per your comment. That's true. The HR for the intervention is completely on the wrong side. So, my question is how to do this in R ( I mean how to specify the margin for superiority or non-inferiority for the test). This will allow me to obtain p values that I can report in my results. Some readers will like p values to to help them interpret the significance of these HR for either (superiority or non-inferiority. I can report that alongside with the 95%HR 95CI intervals. Oct 14 '20 at 21:37
• There is nothing specific to R here. For "superiority" (or lack thereof) you report the p-value for arm. For non-inferiority, if your 95% confidence interval is completely on the correct side of the margin of inferiority, you say p < 0.05. If you want a more specific p-value, recognize that the Wald test is a z-test on the coef value. Take the log of your margin of inferiority on the HR scale (1.3) to get the corresponding coef value (0.26), and do a z-test for the difference between that and the coef found for arm (0.67), using the SE found for arm (0.121).
– EdM
Oct 14 '20 at 21:57
• That's answer my question very well! Thank you. One little thing, do you have a website/excel sheet that I can use to do this calculation? Oct 15 '20 at 21:30
• @AAAA just calculate the z-score (difference between the coef you found and the coef corresponding to the margin of inferiority, divided by the standard error) and check against a standard normal distribution. See this page for an example.
– EdM
Oct 16 '20 at 13:15
• Thank you for this. Oct 17 '20 at 3:16