Hazard ratio calculator for meta-analysis
This hazard ratio calculator gives the log hazard ratio and its standard error from what a trial report gives: an HR with its confidence interval, a log-rank P value with the events, or the log-rank O − E and V. The log HR is (O − E) ÷ V and its variance is 1 ÷ V, following Tierney and colleagues’ 2007 guide.
Updated
Runs in your browser. Nothing you enter is uploaded, stored or sent anywhere.
How the hazard ratio and its SE are worked out
A meta-analysis of a time-to-event outcome pools log hazard ratios, each weighted by its variance. Trial reports often leave those out, so the Cochrane Handbook (section 6.8.2) sends review authors to Tierney and colleagues, who turned the methods of Parmar and colleagues (1998) and Williamson and colleagues (2002) into step-by-step arithmetic. The calculator implements their methods 1 to 9. O − E is the log-rank observed minus expected events on the research arm, V its variance, and V* the variance of ln HR.
| The report gives | Formula |
|---|---|
| O and E in each arm (method 1) | HR = (O_r ÷ E_r) ÷ (O_c ÷ E_c), V = 1 ÷ (1/E_r + 1/E_c) |
| O − E and V (method 2) | ln HR = (O − E) ÷ V, V* = 1 ÷ V |
| HR and its 95% CI (method 3) | V* = [(ln upper − ln lower) ÷ (2 × 1.96)]², then O − E = ln HR × V |
| HR and events in each arm, 1:1 (method 4) | V = O_r × O_c ÷ O |
| HR and total events, 1:1 (method 5) | V = O ÷ 4 |
| HR, total events and numbers analysed (method 6) | V = O × R_r × R_c ÷ (R_r + R_c)² |
| A P value and events (methods 7 to 9) | V as in methods 4 to 6, then O − E = ±√V × Φ⁻¹(1 − P ÷ 2) and ln HR = (O − E) ÷ V |
For a 90% or 99% interval the 1.96 becomes 1.64 or 2.58. Tierney and colleagues rank the methods: the direct ones (1 to 3) make no assumptions and come first, then the indirect ones, and estimates read off Kaplan-Meier curves are “likely to be the least reliable”. They also advise against rounding along the way, which is why the calculator keeps every digit until the end.
Unequal arms and numbers at risk
Methods 4, 5, 7 and 8 assume a 1:1 randomization. For any other ratio, or when people were excluded unequally after randomization, choose “Total events and numbers analysed”: Tierney and colleagues base V on the numbers analysed, “otherwise the precision of the estimate will be exaggerated”. Their methods 10 and 11, which rebuild the HR from a Kaplan-Meier curve with the numbers at risk under it, need the curve read at many time points; their spreadsheet does that, and this calculator doesn’t.
Worked example: Tierney’s bladder cancer trial
The calculator opens on the bladder cancer trial Tierney and colleagues use throughout: 491 people analysed on chemotherapy and 485 on no chemotherapy, 229 and 256 deaths, a reported HR of 0.85 (95% CI 0.71 to 1.02) and a log-rank P of 0.075, in favour of chemotherapy.
Example: From the HR and its confidence interval
V* = [(ln 1.02 − ln 0.71) ÷ 3.92]² = 0.0085, so the SE of ln HR is 0.0924.
V = 1 ÷ 0.008542 = 117.07, and O − E = ln 0.85 × 117.07 = −19.03.
Tierney and colleagues report the same V and O − E.
| Method | V | O − E | HR |
|---|---|---|---|
| 3: HR and 95% CI | 117.07 | −19.03 | 0.85 |
| 4: HR and events in each arm | 120.87 | −19.64 | 0.85 |
| 5: HR and total events | 121.25 | −19.71 (paper −19.70) | 0.85 |
| 6: HR, total events and numbers analysed | 121.25 | −19.70 | 0.85 |
| 7: P = 0.075 and events in each arm | 120.87 | −19.57 | 0.85 |
| 8: P = 0.075 and total events | 121.25 | −19.61 (paper −19.60) | 0.85 |
| 9: P = 0.075, total events and numbers analysed | 121.25 | −19.60 | 0.85 |
Each method on the same trial, against the paper.
3: HR and 95% CI
- V
- 117.07
- O − E
- −19.03
- HR
- 0.85
4: HR and events in each arm
- V
- 120.87
- O − E
- −19.64
- HR
- 0.85
5: HR and total events
- V
- 121.25
- O − E
- −19.71 (paper −19.70)
- HR
- 0.85
6: HR, total events and numbers analysed
- V
- 121.25
- O − E
- −19.70
- HR
- 0.85
7: P = 0.075 and events in each arm
- V
- 120.87
- O − E
- −19.57
- HR
- 0.85
8: P = 0.075 and total events
- V
- 121.25
- O − E
- −19.61 (paper −19.60)
- HR
- 0.85
9: P = 0.075, total events and numbers analysed
- V
- 121.25
- O − E
- −19.60
- HR
- 0.85
The two small differences are rounding in the paper, which works with z = 1.78 for P = 0.075 (it’s 1.7805) and with a rounded ln 0.85. The paper’s ovarian cancer trial checks method 1: with 34 observed and 28.0 expected deaths on the research arm and 24 and 29.9 on control, HR = (34 ÷ 28.0) ÷ (24 ÷ 29.9) = 1.51, V = 14.46 and O − E = 6.00.
Using the result in a meta-analysis
There are two ways to pool the results, both in Tierney and colleagues’ paper:
- Inverse variance. Each trial’s ln HR, weighted by 1 ÷ V*. In RevMan or other software this is the generic inverse-variance method, with the data entered “on the natural log scale” as ln HR and its SE (Cochrane Handbook, 6.3.2). It works for random effects too.
- Peto’s method. For a fixed-effect analysis, the pooled ln HR is the sum of the trials’ O − E divided by the sum of their V.
To see the trials together, put each HR and its 95% CI into the forest plot generator with “Hazard ratio” as the measure. It takes the log of the limits and gets back the same SE. In OtterSR, the Write stage pools hazard ratios you’ve extracted, as a log HR with its SE or an HR with its CI, into a forest plot. It can also convert a trial’s O − E and V, observed and expected events, or a log-rank P value with the events and the arm it favours into a log HR first, following Tierney and colleagues, and records each conversion against the trial. See how OtterSR works.
When to be careful
- Direction. The HR here is research arm over control. If a trial reports control over research, use 1 ÷ HR and swap the limits, as Tierney and colleagues advise. With a P value you choose the direction yourself, from the events, the curves or the text.
- Exact P values. Tierney and colleagues suggest using a P value only when it’s given exactly, to at least two significant figures. A bound such as “P < 0.05” isn’t an exact value.
- Which analysis. Where a report gives an analysis of all randomized patients and one of eligible patients, Tierney and colleagues prefer the analysis of all randomized patients.
- Proportional hazards. A single HR assumes the hazard ratio is constant over follow-up, the simplifying assumption the Handbook describes in 6.8.1.
- Published data only. These methods can’t correct for unpublished trials, selective reporting or analyses that weren’t by intention to treat.
What to report
What to report: Say how each trial’s HR was obtained
For each trial, say whether the HR and its SE were reported, or estimated from a confidence interval, a P value or event counts, and cite Tierney et al. (2007). Note any trial where you assumed 1:1 randomization or chose the direction of a P value yourself.
Frequently asked questions
How do I get the standard error of a hazard ratio from its confidence interval?
Take the natural log of both limits, subtract, and divide by 2 × 1.96 for a 95% interval. For 0.71 to 1.02 that’s (ln 1.02 − ln 0.71) ÷ 3.92 = 0.0924. That’s the SE of ln HR, which is what a meta-analysis uses.
Can I calculate a hazard ratio from a log-rank P value?
Yes, if you also have the number of events. The P value gives a z, V comes from the events, and O − E = √V × z with a sign for the direction. For the bladder trial, P = 0.075 and 229 and 256 deaths give an HR of 0.85, the same as the one reported.
What are O − E and V?
They’re the log-rank statistic for the research arm: observed events minus the number expected if the treatment had no effect, and its variance. Dividing O − E by V gives ln HR, and 1 ÷ V is its variance.
Should I use an odds ratio or risk ratio instead?
Not for a time-to-event outcome, if you can avoid it. Tierney and colleagues point out that an OR or RR ignores when events happen and mixes trials at different stages of follow-up, and that “if there is sufficient data to estimate an OR or RR, there is usually sufficient data to estimate a HR”.
How to cite this tool
OtterSR. Hazard ratio calculator for meta-analysis. https://www.ottersr.com/tools/hazard-ratio-calculator (accessed today’s date).
Please cite the method as well:
Tierney JF, Stewart LA, Ghersi D, Burdett S, Sydes MR. Practical methods for incorporating summary time-to-event data into meta-analysis. Trials 2007;8:16.
Related guides
- How to do a meta-analysis: a step-by-step guideHow to do a meta-analysis: deciding whether to pool, choosing the effect measure, fixed or random effects, heterogeneity, sensitivity analyses and reporting.
- How to design a data extraction formHow to design a data extraction form for a systematic review: which fields to collect, piloting, two extractors, and recording where each value came from.
- How to read a forest plot in a meta-analysisHow to read a forest plot: what the squares, lines, diamond and line of no effect mean, how to spot heterogeneity, and what the I² and P values beneath it say.
Related tools
- Forest plot generatorUse this when you have several studies of the same comparison and want them pooled, with heterogeneity, and drawn as a forest plot.
- Funnel plot generator and Egger’s testUse this when your meta-analysis has 10 or more studies and you need to check the funnel plot for small-study effects or publication bias.
Sources
- Tierney JF, Stewart LA, Ghersi D, Burdett S, Sydes MR. Practical methods for incorporating summary time-to-event data into meta-analysis. Trials 2007;8:16. https://doi.org/10.1186/1745-6215-8-16
- Higgins JP, Li T, Deeks JJ (editors). Chapter 6: Choosing effect measures and computing estimates of effect [last updated August 2023]. In: Higgins JP, Thomas J, Chandler J, et al (editors). Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane, 2024. https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-06