Method document
Sample size to estimate a hazard ratio
How many participants are needed in each of two groups to estimate a hazard ratio from a Cox model within a chosen factor, from the survival expected at the end of follow-up; or in several groups, each against a reference. Covers unequal groups and non-response.
https://statwisely.com/methods/precision-hazard-ratio/
When to use it
- A cohort or trial whose aim is to report how much an exposure or treatment changes the hazard of an event, with its interval.
Not for
- Showing that the hazard ratio differs from 1. Use the log-rank test under “Detect an effect”.
Notation
- Participants in groups 1 and 2 (group 2 is the reference)
- Survival in the reference group at the end of follow-up
- Expected hazard ratio, group 1 against group 2; 1 if not given
- Allocation ratio n₂ / n₁
- Shares of participants, 1/(1 + r_a) and r_a/(1 + r_a)
- Expected Cox information about the log hazard ratio, per participant
- Precision factor: the interval runs from HR / f to HR × f
- Number of groups, including the reference
- Standard normal quantile for confidence 1 − α (1.960 for 95%)
- Non-response rate
Formulas
Participants from the Cox information
Each event contributes the variance of the covariate among those still at risk, weighted by their hazard; I integrates that over follow-up, with exponential survival censored at its end. At a hazard ratio of 1 it is Var(x) times the share with an event: Schoenfeld’s π₁π₂ for two groups [1] and 1 per SD [2]. With unbalanced events, a real effect leaves less than Schoenfeld’s form: close to d₁d₂/(d₁ + d₂) of each group’s events.
Several groups against a reference
Optional. With g groups, each of the g − 1 others is compared with the same reference group of r_a n₁. I is then the information matrix about the g − 1 log hazard ratios, and the comparison with the largest variance sets the common size. Choosing simultaneous intervals splits α across the comparisons (Bonferroni).
Non-response
The number to approach in each group so that n respond. Applied last, after any clustering.
Parameters
Confidence level
Values: 90%, 95% or 99%
95% is the convention in health research. A higher level widens the interval, so the same margin needs a larger sample.
Precision factor
Values: Above 1; 1.5 means the interval runs from HR / 1.5 to HR × 1.5
A rare event leaves few events to learn from, so it needs many participants for any factor.
Survival in the reference group at the end of follow-up
Values: Between 0 and 1
From routine data or earlier studies of the reference group.
Expected hazard ratioOptional
Values: Above 0; 1 if left blank
It sets how many events group 1 has, and so the information.
Allocation ratioOptional
Values: Above 0; 1 for equal groups
The planned size of group 2 divided by group 1. Equal groups give the most precision for a given total; use another ratio when one group is easier or cheaper to recruit.
Number of groups, including the referenceOptional
Values: A whole number of at least 2; 2 for one comparison
For example, two treatments against a control is g = 3.
Expected hazard ratio of each group against the referenceOptional
Values: g − 1 values above 0; 1 each if left blank
They set how many events each group has.
Simultaneous intervals across comparisonsOptional
Values: On or off
Turn on when the comparisons will be read together.
Expected non-response rateOptional
Values: 0% up to, but not including, 100%
The share of people approached who will not take part; use the response rate of a comparable study. Approaching more people restores the number of respondents, not their representativeness: if non-responders differ, the estimate can still be biased.
Assumptions
- Hazards are proportional; survival is exponential and censored only at the end of a common follow-up period.
- Non-response is unrelated to the outcome.
Worked examples
Two equal groups
0.6 event-free at the end of follow-up, factor 1.5: 40% have an event, so I = 0.25 × 0.40 = 0.10 and n₁ = 1.96² / (2 × 0.10 × (ln 1.5)²) = 116.8, rounded up to 117 per group.
Group 1: 117 · Group 2: 117 · Total: 234
Open this example in the calculatorA lower hazard in a smaller group
Expecting HR = 0.7 with twice as many in group 2: I = 0.0728, below Schoenfeld’s 0.0815, so 107 and 214.
Group 1: 107 · Group 2: 214 · Total: 321
Open this example in the calculatorTwo treatments against a control
Hazard ratios of 0.8 and 0.65 against a control with 0.6 event-free, factor 1.5, read together: 185 in each of the 3 groups.
185 per group · Total: 555
Open this example in the calculatorA rarer event
With 0.9 event-free, only 10% have an event: 468 per group.
Group 1: 468 · Group 2: 468 · Total: 936
Open this example in the calculatorValidation
- Every worked example on this page is recomputed by the StatWisely engine whenever the software is built. If a number or formula here stopped matching the calculator, the release would be stopped until this document was corrected.
- The basic result agrees with Schoenfeld’s form: 4 × 1.96² / (ln 1.5)² = 93.5 events, at 40% with an event. Cox models fitted to simulated samples at the planned sizes gave median interval factors within 0.2% of the target and coverage of 94% to 96%. An independent implementation in R recomputes these sizes and is compared with the engine’s.
How to cite
StatWisely. Sample size to estimate a hazard ratio. Method document, engine version 1.0.0, reviewed 2026-10-09. https://statwisely.com/methods/precision-hazard-ratio/
Cite the original references for the formulas your design uses as well.
References
- 1.Schoenfeld DA. Sample-size formula for the proportional-hazards regression model. Biometrics. 1983;39(2):499–503.
- 2.Hsieh FY, Lavori PW. Sample-size calculations for the Cox proportional hazards regression model with nonbinary covariates. Controlled Clinical Trials. 2000;21(6):552–560.