Sample Size for Diagnostic Accuracy and Survival Studies: Sensitivity, Specificity and Log-Rank (Schoenfeld, Freedman)
Plan the size of a diagnostic accuracy study or a time-to-event trial. For diagnostic studies, get the number of people needed to estimate sensitivity and specificity with a chosen precision (Buderer’s method), or to show that they exceed a minimum acceptable value. For survival studies, get the number of events needed to detect a hazard ratio with the log-rank test (Schoenfeld or Freedman), and the total sample size from accrual, follow-up, median survival and dropout.
- PriceFree, no login or sign-up needed
- Your dataProcessed in your browser, never uploaded
- Works onPhone, tablet or computer, any modern browser
- Made byDr. Muhammad Aammar Tufail, Codanics
- Published17 November 2026
- Last updated16 November 2026
📚 How to cite this tool
This tool is free. If it helped your thesis, paper, report or assignment, please cite it. It keeps the tools free and helps other students find them.
Tufail, M. A. (2026). Sample size for diagnostic accuracy and survival studies: sensitivity, specificity and log-rank [Online tool]. Codanics. Retrieved 16 November 2026, from https://codanics.com/tools/sample-size-diagnostic-survival/
In-text citation: (Tufail, 2026) · Narrative: Tufail (2026)
The access date is today’s date, filled in automatically. Author: Muhammad Aammar Tufail. Published 17 November 2026.
How to use the sample size calculator for diagnostic and survival studies
- Pick the tab that matches your study: estimating sensitivity and specificity with a given precision, testing them against a minimum acceptable value, or comparing survival between two groups.
- For diagnostic studies, enter the expected sensitivity and specificity (from a pilot study or the literature), the prevalence of the condition among the people you will recruit, and the margin of error or the minimum acceptable value.
- For survival studies, enter the hazard ratio you want to detect, α, power and the allocation ratio. Then give either the median survival in the control group with the accrual and follow-up periods, or the overall probability of an event.
- Add the expected dropout, read the number of events and participants, and copy the methods paragraph into your protocol or grant application.
Diagnostic accuracy: Buderer’s method
Sensitivity is estimated only from people who have the condition, and specificity only from people who do not. So the number of people you must recruit depends on the prevalence in your study sample. Buderer (1996) calculates how many diseased and non-diseased people are needed for the desired precision, then divides by the prevalence:
For example, sensitivity 90% ± 5% with 95% confidence needs 139 people with the disease. If only 20% of those recruited have it, you must recruit 695 people. Rare conditions therefore need large studies, or a case-control (two-gate) design, which is cheaper but can overestimate accuracy.
Testing sensitivity or specificity against a minimum value
Regulatory and validation studies often need to show that sensitivity is at least a certain value, such as 80%. This is a one-sided test of a single proportion. The normal-approximation formula is shown with the exact binomial answer, which is preferred for proportions close to 100%:
Survival studies: events drive power
In a time-to-event trial, statistical power depends on the number of events, not on the number of participants. A trial of 1,000 people with 50 deaths has little power. You first calculate the events needed, then the number of people who must be followed to observe that many events.
Schoenfeld’s formula is the most widely used and is derived from the Cox model; Freedman’s gives slightly larger numbers. For HR = 0.7, α = 0.05 (two-sided) and 80% power with equal allocation, Schoenfeld gives 247 events and Freedman 253.
powerSurvEpi::ssizeCT.default() for the same event probabilities (within one or two participants, because this tool rounds the number of events up first), the Schoenfeld number of events matches the formula coded in R, and the exact binomial critical values, α and power match pbinom(). For the general sample size for means and proportions, use the sample size calculator.References: Buderer NM (1996) Acad Emerg Med 3:895–900 · Flahault A, Cadilhac M, Thomas G (2005) J Clin Epidemiol 58:859–862 · Schoenfeld DA (1983) Biometrics 39:499–503 · Freedman LS (1982) Stat Med 1:121–129 · Collett D (2015) Modelling Survival Data in Medical Research, 3rd ed.
Frequently asked questions
How do I calculate the sample size for a diagnostic accuracy study?
Decide the expected sensitivity and specificity, the precision you want (for example ± 5%) and the prevalence in your sample. The number of diseased people needed is z²·Se(1−Se)/d², divided by the prevalence to get the total. The same is done for specificity, and the larger total is used (Buderer’s method).
Why does prevalence matter so much?
Sensitivity is estimated only from people with the condition. If only 5% of recruits have it, you need 20 recruits for each diseased person, so the total grows quickly when the condition is rare.
How many events do I need for a survival study?
With equal groups, α = 0.05 and 80% power, Schoenfeld’s formula gives about 247 events for HR = 0.7, 88 for HR = 0.55 and 631 for HR = 0.8. The number of participants is then the events divided by the probability that a participant has an event during the study.
Should I use Schoenfeld or Freedman?
Both are accepted. Schoenfeld is the most common in protocols and is based on the Cox model. Freedman gives slightly more events. Report which one you used.
What hazard ratio should I plan for?
Use the smallest effect that would change practice, informed by previous trials or pilot data. Overly optimistic hazard ratios are a common reason why trials fail to show a difference.
Does this tool handle non-inferiority or cluster trials?
No. It covers superiority log-rank comparisons and single-proportion diagnostic designs. Non-inferiority, cluster and comparative diagnostic designs need further adjustments.
Do I need to log in or create an account to use the sample size calculator for diagnostic and survival studies?
No. There is no login, no sign-up and no email required. Open the page and start using it straight away, for free, on any device.
How do I cite this tool in my thesis or paper?
Use the citation box on this page. In APA 7th edition: Tufail, M. A. (2026). Sample size for diagnostic accuracy and survival studies: sensitivity, specificity and log-rank [Online tool]. Codanics. Retrieved [date you used it], from https://codanics.com/tools/sample-size-diagnostic-survival/. BibTeX, RIS (EndNote, Mendeley, Zotero), MLA, Harvard, Chicago and Vancouver formats are also available.
Free guides and courses from Codanics
More free tools
See all free Codanics tools → · Codanics on YouTube · WhatsApp channel

