Calculate a hazard ratio from the event risks in two groups, from a Cox coefficient and standard error, or from events and person-time.

Uses event probabilities by the same time point, e.g. 0.30 vs 0.40, and assumes proportional hazards.

Optional settings

Calculator Functions

FunctionWhat it doesWhat it requires
Hazard ratio from two event risks (estimate)Estimates a hazard ratio from the share of each group that had the event by the same time point, and shows the risk ratio beside itRequires the event probability in group 1 (treatment) and in the reference (control) group, each between 0 and 1
Cox coefficient and standard errorConverts a Cox model coefficient to a hazard ratio with its confidence interval, z statistic and two-sided p-valueRequires the coefficient β, its standard error and a confidence level of 90%, 95% or 99%
Review a reported HR and intervalRestates a published hazard ratio as a percentage difference in hazard and, on request, recovers the standard error behind its intervalRequires the reported hazard ratio, its lower and upper confidence limits, the confidence level and the interval method
Events and person-time rate ratioFinds the incidence rate ratio between two groups with its confidence interval, z statistic and p-valueRequires the number of events and the person-time in each group, the person-time unit and a confidence level

Group 1 is always compared against group 0, the reference, so a ratio below 1 means a lower rate in group 1. Every function except the first also states the result as a percentage higher or lower rate in group 1.

Hazard Ratio Formulas

HR = ln(1 − P₁) ÷ ln(1 − P₀) [2]
HRHazard ratio: the hazard rate in group 1 divided by the hazard rate in the reference group [3]
P₁Probability of the event in group 1 by a chosen time point (0 to 1)
P₀Probability of the event in the reference group by the same time point (0 to 1)

A hazard is an instantaneous event rate: the chance that the event happens in the next short interval for someone who has not had it yet [3]. It is similar to a risk but not the same thing [1], which is why dividing P₁ by P₀ gives a risk ratio and not a hazard ratio.

Hazard ratio from two event risks (estimate)

When hazards are proportional, the share of group 1 still event-free at a time point equals the reference group’s event-free share raised to the power of the hazard ratio [2]. Taking logarithms of that relationship gives the main formula, with 1 − P as the event-free share. Event probabilities of 0.30 in group 1 and 0.40 in the reference group give ln(0.70) ÷ ln(0.60) = 0.6982, while the risk ratio for the same numbers is 0.30 ÷ 0.40 = 0.75. A probability of exactly 1 is rejected, and a group 1 probability of 0 gives a ratio of 0.

Cox coefficient and standard error

HR = eβ
CI = eβ ± z × SE

β is the coefficient a Cox proportional hazards model reports for the group variable, which is the natural logarithm of the hazard ratio [2], and SE is its standard error. The multiplier z is 1.645 for a 90% interval, 1.960 for 95% and 2.576 for 99%. A coefficient of −0.3567 with a standard error of 0.15 gives HR = 0.7000 with a 95% interval of 0.5217 to 0.9392. The z statistic is β ÷ SE, here −2.378, and the two-sided p-value of 0.0174 comes from the standard normal distribution.

Review a reported HR and interval

SE = (ln U − ln L) ÷ (2 × z) [1]

U and L are the upper and lower confidence limits. For a ratio, the standard error belongs to the logarithm of the ratio, and the divisor 2 × z is 3.92 for a 95% interval, 3.29 for 90% and 5.15 for 99% [1]. A reported HR of 1.00 with a 95% interval of 0.50 to 2.00 gives SE = (ln 2 − ln 0.5) ÷ 3.92 = 0.3537. This step runs only when the interval method is set to the symmetric log-Wald option. The z statistic and p-value are then shown only if the reported HR sits at the midpoint of the two limits on the log scale. Published values are rounded, so most reported intervals miss that midpoint slightly, and the calculator then shows the approximate standard error and leaves z and p out. With the method left as unknown, the calculator restates the reported values and recovers nothing.

Events and person-time rate ratio

IRR = (E₁ ÷ T₁) ÷ (E₀ ÷ T₀) [1]
SE = √(1 ÷ E₁ + 1 ÷ E₀) [1]

E is the number of events and T is the person-time in each group. SE is the standard error of the logarithm of the rate ratio, and the interval is IRR multiplied and divided by ez × SE. With 30 events in 1,000 person-years against 45 events in 1,200 person-years, the rates are 0.03 and 0.0375 per person-year, IRR = 0.8, SE = 0.2357 and the 95% interval is 0.504 to 1.2698. The time unit cancels out of the ratio [1], so it only has to be the same for both groups. This is a rate ratio from totals, which is not the same as a hazard ratio from a fitted Cox model.

Limits of This Estimate

  • The event-risk function depends on proportional hazards, meaning a hazard ratio that stays constant over the follow-up [1]. Two probabilities at one time point cannot show whether that holds, cannot account for people lost to follow-up, and give no confidence interval.
  • A hazard ratio does not say how much sooner or later the event happens. A hazard ratio of 2 does not mean the median time was halved, and the time difference cannot be read from the ratio alone [3].
  • The rate ratio interval is an approximation that becomes unreliable with few events, and both event counts must be above zero.
  • The results describe groups in a study. They are not a prognosis for one person and do not replace the analysis in the study report or advice from a clinician.

Sources

  1. Cochrane Handbook for Systematic Reviews of Interventions, version 6.5, Chapter 6 (last updated August 2023): rate ratio and the standard error of its logarithm, standard errors from confidence intervals, hazard versus risk and the proportional hazards assumption
  2. Tierney and others, Practical methods for incorporating summary time-to-event data into meta-analysis, Trials 8:16 (2007): event-free proportions and the hazard ratio under proportional hazards, and the Cox coefficient as the log hazard ratio
  3. Spruance and others, Hazard Ratio in Clinical Trials, Antimicrobial Agents and Chemotherapy 48(8):2787–2792 (2004): definitions of hazard rate and hazard ratio, and what the ratio does not say about timing