Method document
Sample size for a log-rank test
How many events, and then participants, are needed to show that survival differs between two groups, from the hazard ratio and the survival expected in the control group. Covers unequal allocation, accrual and follow-up, losses to follow-up and dropout.
https://statwisely.com/methods/survival-logrank/
When to use it
- A trial or cohort comparing time to an event, such as death or relapse, between two groups.
Not for
- Showing that a new treatment is not worse. Use the non-inferiority log-rank test.
- Hazards expected to cross or diverge over time, where a constant hazard ratio does not hold.
Notation
- Number of events required
- Number of participants
- Hazard ratio, treatment against control
- Allocation ratio, treatment to control
- Shares of participants in control and treatment, 1/(1 + k) and k/(1 + k)
- Survival in the control group at the end of the study
- Probability that a participant has the event during the study
- Accrual period and additional follow-up after it
- Event hazard and loss-to-follow-up hazard
- Chance of a competing event by the end of the study, and its hazard
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Expected dropout
Formulas
Events: Schoenfeld’s formula
The log-rank test’s power depends on the number of events. With equal groups p₁p₂ = 1/4, so D = 4(z₁₋α/₂ + z₁₋β)² / (ln HR)² [1].
From events to participants
A survival analysis draws its power from events, not from participants, so the number to recruit is the events divided by the chance that a participant has one. Without accrual and follow-up times, S_c is taken as the control survival over the whole study.
With accrual, follow-up and losses
With participants entering uniformly over the accrual period and followed for at least f afterwards, each has a different time at risk. Survival is exponential, and losses to follow-up are a competing exponential risk that removes the chance of observing the event [2].
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 [4]. A subdistribution (Fine–Gray) hazard ratio is a different estimand.
Dropout
Applied last, to the participants actually recruited.
Parameters
Hazard ratio to detect
Values: Above 0, not 1
The smallest effect worth detecting; 0.7 means a 30% lower hazard on treatment. Published trials of similar treatments are the best source.
Control survival
Values: Between 0 and 1
The proportion of the control group expected to be event-free at the end of the study, from registries or previous trials. Fewer events per participant need more participants.
Allocation ratioOptional
Values: Above 0; 1 for equal groups
Treatment participants per control participant. Equal allocation needs the fewest events.
Accrual and follow-up timesOptional
Values: Both 0 or more, in the same units, not both 0
How long recruitment lasts, and how long the study continues after the last participant enters. Given together.
Loss-to-follow-up hazardOptional
Values: 0 or more, per the same time unit; needs accrual and follow-up
The rate at which participants are lost before their event can be seen; 0.05 per year loses about 5% a year.
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
- Proportional hazards: the hazard ratio is constant over time; check it in the analysis [3].
- With accrual and follow-up given, entry is uniform and survival exponential in both groups.
- Censoring is unrelated to the outcome.
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
A 30% lower hazard
HR = 0.7, half the control group event-free at the end, equal groups, α = 0.05 two-sided, 80% power: 247 events. The event probability is 0.5 in control and 1 − 0.5^0.7 = 0.384 on treatment, 0.442 on average, so N = 247 / 0.442 = 559.
Events: 247 · Group 1: 280 · Group 2: 279 · Total: 559
Open this example in the calculatorProtocol statement
To detect a hazard ratio of 0.7 with 80% power at a two-sided significance level of 0.05, using a log-rank test, and assuming 50% of the control group event-free at the end of the study, 247 events are required; with an expected event probability of 44.22%, the required sample size is 280 in the first group and 279 in the second group (559 in total). Calculated with StatWisely (statwisely.com) using: Events = [z_(1-α/2)+z_(1-β)]²/[p₁p₂(log(HR))²]. These are planning estimates; confirm the final design with a qualified statistician.
Two years of accrual, three of follow-up
With staggered entry, participants recruited late are followed for less time, so fewer have the event: the average event probability falls to 0.372 and N = 664 for the same 247 events.
Events: 247 · Group 1: 332 · Group 2: 332 · Total: 664
Open this example in the calculatorAllowing for losses to follow-up
With losses at a hazard of 0.05 a year as well: event probability 0.340, N = 728.
Events: 247 · Group 1: 364 · Group 2: 364 · Total: 728
Open this example in the calculatorTwo treated per control
With k = 2, p₁p₂ = 2/9 instead of 1/4, so 278 events are needed: 220 in control and 438 on treatment.
Events: 278 · Group 1: 220 · Group 2: 438 · Total: 658
Open this example in the calculatorAllowing for dropout
Expecting 10% to withdraw before contributing any follow-up: 312 and 310 are recruited.
Events: 247 · Group 1: 280 · Group 2: 279 · Total: 559 · To recruit: 312 and 310
Open this example in the calculatorProtocol statement
To detect a hazard ratio of 0.7 with 80% power at a two-sided significance level of 0.05, using a log-rank test, and assuming 50% of the control group event-free at the end of the study, 247 events are required; with an expected event probability of 44.22%, the required sample size is 280 in the first group and 279 in the second group (559 in total). Allowing for 10% dropout, 312 in the first group and 310 in the second group (622 in total) should be recruited. Calculated with StatWisely (statwisely.com) using: Events = [z_(1-α/2)+z_(1-β)]²/[p₁p₂(log(HR))²]. These are planning estimates; confirm the final design with a qualified statistician.
A competing cause of death
With a 0.2 chance of dying from another cause first, treated as censoring: the same 247 events, but the event probability falls to 0.401, so N = 617.
Events: 247 · Group 1: 309 · Group 2: 308 · Total: 617
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.
- The events agree with the closed form: 4 × (1.960 + 0.842)² / (ln 0.7)² = 246.8, rounded up to 247.
- Checked by simulating the log-rank test in R (survival::survdiff), planned for 80% power at hazard ratios of 0.5, 0.7 and 0.8. With equal groups Schoenfeld’s events delivered 80%, also with staggered entry and losses. With unequal groups the approximation drifts: twice as many on treatment, the arm with the lower hazard, gave 83–84%, more than planned, while twice as many controls gave about 78% at a hazard ratio of 0.7. When the larger arm is the one with the higher hazard, plan for a little more power, or compare Freedman’s method, which gave 83% there.
How to cite
StatWisely. Sample size for a log-rank test. Method document, engine version 1.0.0, reviewed 2026-10-01. https://statwisely.com/methods/survival-logrank/
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.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.Collett D. Modelling Survival Data in Medical Research. 3rd ed. Boca Raton: CRC Press; 2015.
- 4.Pintilie M. Dealing with competing risks: testing covariates and calculating sample size. Statistics in Medicine. 2002;21(22):3317–3324.