Method document
Sample size for a log-rank test for trend
How many participants are needed in each of three or more ordered groups, such as doses or stages, to show that the hazard rises or falls across them, from the hazard ratio per step and the first group’s survival. Covers accrual and follow-up, losses to follow-up and dropout.
https://statwisely.com/methods/survival-trend/
When to use it
- A dose–response or exposure-gradient question for survival, analysed with the log-rank test for trend or a Cox model on the group scores.
Not for
- Groups with no natural order. Use the test across several groups.
Notation
- Participants in each group
- Number of groups
- All participants, g n
- Survival in the first (reference) group at the end of the study
- Expected Cox information per participant, a matrix for several log hazard ratios
- Accrual period and additional follow-up after it
- Loss-to-follow-up hazard
- Chance of a competing event by the end of the study, and its hazard
- Hazard ratio per step, or per unit of score
- Score of group j; 0, 1, 2, … unless given
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Expected dropout
Formulas
Participants for the trend
The hazard of group j is h₁ HR^(sⱼ − s₁). Each event contributes the hazard-weighted covariance of the group indicators (or scores) among those still at risk; I integrates that over follow-up, with exponential survival censored at the end of the study and by any losses. At no effect it is the share with an event times the indicators’ multinomial covariance, which is the k-sample log-rank test’s information [1].
Competing risks
Optional. A competing event ends follow-up for the event of interest, so for a cause-specific hazard ratio it acts as one more censoring hazard μ over the study horizon H (the accrual plus follow-up, or one study period). The events of interest needed are unchanged; fewer participants have one, so more are needed [3]. A subdistribution (Fine–Gray) hazard ratio is a different estimand.
Dropout
Applied last, to the participants actually recruited.
Parameters
Hazard ratio per step
Values: Above 0 and not 1
How many times the hazard changes from one group to the next, or per unit of score.
Number of ordered groups
Values: A whole number of at least 3
Each group is planned the same size.
Group scoresOptional
Values: One per group; 0, 1, 2, … by default
The value each group stands for, such as the dose; the hazard ratio is then per unit of score.
Survival in the first group
Values: Between 0 and 1
The share of the first (reference) group expected to be event-free at the end of the study.
Accrual periodOptional
Values: 0 or more, with the follow-up
How long recruitment lasts; entry is taken as uniform over it, as in the log-rank calculation [2].
Follow-up after accrualOptional
Values: 0 or more, with the accrual
How long the study continues after the last participant joins.
Loss-to-follow-up rateOptional
Values: 0 or more, per unit of time; needs accrual and follow-up
Participants lost cannot have the event, so they lower the events.
Chance of a competing eventOptional
Values: At least 0 and below 1; 0 by default
The share expected to have an event that ends follow-up for the event of interest by the end of the study, such as death from another cause.
Significance level
Values: Between 0 and 1; usually 0.05
The false-positive rate you accept. A smaller α, for example to allow for several primary outcomes, needs a larger sample.
Power
Values: Between 0 and 1; usually 0.80 or 0.90
The chance of a significant result if the assumed effect is real. Funders and ethics committees commonly expect at least 0.80.
Expected dropoutOptional
Values: 0% up to, but not including, 100%
The share of participants expected to provide no outcome, from comparable studies. Recruiting more restores the numbers, not the comparability of the groups: if dropout is related to the outcome, the estimate can still be biased.
Assumptions
- The groups are equal in size and independent; hazards are proportional, with exponential survival censored at the end of the study and by any stated losses.
- The log hazard changes linearly with the scores.
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
Three ordered groups
A hazard ratio of 0.8 per step and 0.6 event-free in the first group: I = 0.221, so N = (2.80)² / ((ln 0.8)² × 0.221) = 712.2 and 238 per group.
Events: 242 · 238 per group · Total: 714
Open this example in the calculatorProtocol statement
To detect a hazard ratio of 0.8 per step with 80% power at a two-sided significance level of 0.05, using a log-rank test for trend across 3 ordered groups, and assuming 60% of the first group event-free at the end of the study and group scores of 0, 1, 2, 242 events are required; with an expected event probability of 33.81%, the required sample size is 238 per group (714 in total, across 3 groups). Calculated with StatWisely (statwisely.com) using: N = (z_(1-α/2)+z_(1-β))²/[(ln HR)²·I], I the Cox information per participant about the trend. These are planning estimates; confirm the final design with a qualified statistician.
Unequally spaced doses
Four groups scored 0, 1, 2 and 4 with a hazard ratio of 0.85 per unit of score: 93 per group.
Events: 153 · 93 per group · Total: 372
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.
- An independent implementation in R recomputes this test every night and before each production release, and the results are compared with the engine’s.
- Cox models on the scores, fitted to simulated trials at the planned sizes, gave power of 0.79 to 0.81 against a target of 0.80.
How to cite
StatWisely. Sample size for a log-rank test for trend. Method document, engine version 1.0.0, reviewed 2026-10-10. https://statwisely.com/methods/survival-trend/
Cite the original references for the formulas your design uses as well.
References
- 1.Collett D. Modelling Survival Data in Medical Research. 3rd ed. Boca Raton: CRC Press; 2015.
- 2.Lachin JM, Foulkes MA. Evaluation of sample size and power for analyses of survival with allowance for nonuniform patient entry, losses to follow-up, noncompliance, and stratification. Biometrics. 1986;42(3):507–519.
- 3.Pintilie M. Dealing with competing risks: testing covariates and calculating sample size. Statistics in Medicine. 2002;21(22):3317–3324.