Calculate hazard ratio from control and treatment medians, p-value from HR and 95% CI, or NNT from HR and control risk for survival data.

Hazard Ratio Calculator

From medians
p-value from CI
NNT from HR

Hazard Ratio Formula

The hazard ratio (HR) compares the instantaneous event rate (hazard) between two groups at time t. In practice, HR is typically estimated from time-to-event (survival) data (for example, via a Cox proportional hazards model).

\begin{aligned}
HR &= \frac{h_T(t)}{h_C(t)}\\[6pt]
\text{(Approx. from risks at same }t\text{)}\quad HR &\approx \frac{\ln\!\big(1-P_T(t)\big)}{\ln\!\big(1-P_C(t)\big)}
\end{aligned}
  • Where HR is the hazard ratio (unitless)
  • hT(t) is the hazard in the treatment group at time t
  • hC(t) is the hazard in the control group at time t
  • PT(t) and PC(t) are event probabilities (cumulative risks) by the same time horizon t (used only for the approximation shown)

Important: dividing event probabilities PT/PC gives a risk ratio (relative risk), not a hazard ratio. If you only have event probabilities at a single time horizon, you can approximate HR under proportional-hazards assumptions using the log-survival relationship shown above.

How to Calculate Hazard Ratio?

The following example problems outline how to calculate an approximate hazard ratio from event probabilities measured at the same time horizon.

Example Problem #1:

  1. First, determine the event probability (risk) in the treatment group at the chosen time horizon.
    • The treatment-group event probability is given as: 0.30.
  2. Next, determine the event probability (risk) in the control group at the same time horizon.
    • The control-group event probability is provided as: 0.40.
  3. Finally, calculate the approximate hazard ratio using the equation above.

HR ≈ ln(1 − PT) / ln(1 − PC)

The values given above are inserted into the equation below and the solution is calculated:

HR ≈ ln(1 − 0.30) / ln(1 − 0.40) = ln(0.70) / ln(0.60) ≈ 0.70


Example Problem #2: 

For this problem, the variables required are provided below:

probability of events in the treatment group = 0.18

probability of events in the control group = 0.24

Test your knowledge using the equation and check your answer with the calculator above.

HR ≈ ln(1 − PT) / ln(1 − PC) = ?