Method document
Sample size for a one-sample t-test
How many participants are needed to show that a population mean differs from a reference value, with chosen significance and power. Covers one- and two-sided tests, a baseline covariate, clustering and dropout.
https://statwisely.com/methods/means-one-sample/
When to use it
- Comparing a group’s mean with a fixed reference value, such as a target level, a guideline threshold or a published norm.
Not for
- Comparing two groups. Use the two-sample t-test.
- Before-and-after measurements on the same people. Use the paired t-test.
- Estimating the mean rather than testing it. Use the mean under “Estimate precisely”.
Notation
- Number of participants
- Difference between the true mean and the reference value
- Standard deviation of the measurement
- Standardised effect, Δ / σ
- Noncentrality of the t distribution
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Number of tails: 2 for a two-sided test, 1 for one-sided
- Correlation between the outcome and a baseline covariate
- Intracluster correlation coefficient (ICC)
- Average number of participants per cluster
- Coefficient of variation of cluster size
- Clusters per group
- Expected loss of whole clusters
- Expected dropout
Formulas
The smallest n with enough power
The test statistic follows a noncentral t distribution with n − 1 degrees of freedom when the effect is real, and n is the smallest whole number whose power reaches the target. For a two-sided test the lower rejection region is included too [1].
For intuition: the normal approximation
Not what the calculator uses, but it shows the shape of the answer: halving the effect quadruples the sample. The exact t calculation adds a couple of participants, because σ is estimated from the data.
Adjusting for a baseline covariate
Analysing with a baseline measurement as a covariate (ANCOVA) removes the share r_b² of the outcome’s variance the test would otherwise have to overcome. One participant per group is added back for the degree of freedom the covariate uses [3].
Clustering
When participants are recruited or randomised in clusters, observations within a cluster repeat information, and the sample is multiplied by the design effect. With equal clusters (CV = 0) this is 1 + (m − 1)ρ [4, 5].
Few clusters
Optional. A cluster trial is analysed on cluster-level summaries, so its critical values come from t on 2(C − 1) degrees of freedom rather than the normal distribution. With few clusters this costs participants; because C depends on the sample, it is iterated until it settles [6].
All adjustments together
The adjustments multiply, in this order, and the result is rounded up once. Any adjustment not used contributes a factor of 1.
Dropout
Applied last, to the participants actually recruited.
Clusters to recruit
Per group. Losing a whole cluster loses every participant in it, so an expected loss of clusters inflates the clusters recruited rather than the participants.
Parameters
Difference to detect
Values: Not zero, in the measurement’s units
The smallest difference that would matter, clinically or practically. Not the difference you hope for: a study sized for an optimistic effect is underpowered for a real but smaller one.
Standard deviation
Values: Above 0, in the measurement’s units
From a comparable published study, a pooled SD from several studies, or pilot data. The sample size grows with its square, so check a larger value too.
Cohen’s d, instead of the two aboveOptional
Values: Above 0
The difference in standard-deviation units. Cohen’s benchmarks of 0.2, 0.5 and 0.8 for small, medium and large are a last resort; a difference and SD from your own field are better [1].
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.
One- or two-sided
Values: 2 (two-sided) or 1 (one-sided)
Two-sided is the default. A one-sided test is justified only when an effect in the other direction would be treated exactly as no effect, and should be stated in advance.
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.
Baseline correlationOptional
Values: Between −1 and 1
The correlation between the outcome and its baseline measurement, from previous data. Only use it if the analysis will adjust for the baseline.
Intracluster correlation (ICC)Optional
Values: From 0 to 1
For clustered designs only. Published ICCs for health outcomes in primary-care and community clusters are mostly small, often below 0.05 [7]; prefer an estimate from a comparable trial.
Average cluster sizeOptional
Values: At least 1
The average number of participants per cluster. Given with the ICC.
Variation in cluster sizeOptional
Values: 0 or more; 0 for equal clusters
The SD of cluster sizes divided by their mean. Unequal clusters cost power on their own account [5].
Expected loss of whole clustersOptional
Values: 0% up to, but not including, 100%
Clusters, such as practices or schools, expected to withdraw entirely.
Correction for few clustersOptional
Values: On or off
Worth applying when there are few clusters per group, roughly fewer than 15–20.
Assumptions
- Participants are a random sample, independent of one another apart from any clustering specified.
- The measurement is roughly normal, or the sample is large enough for its mean to be.
- The reference value is fixed and known, not itself estimated from data.
- With clustering: clusters are independent, with the same ICC throughout, and the analysis accounts for the clustering, for example with a mixed model or cluster-level summaries [4].
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
A medium effect
Difference 5, SD 10, so d = 0.5; α = 0.05 two-sided, 80% power. The normal approximation gives (2.80 / 0.5)² = 31.4; the exact t calculation gives 34.
Sample size: 34
Open this example in the calculatorProtocol statement
To detect a difference of 5 from the reference value with 80% power at a two-sided significance level of 0.05, using a one-sample t-test, and assuming a standard deviation of 10, the required sample size is 34 participants. Calculated with StatWisely (statwisely.com) using: n: solve noncentral-t power for d, α, and 1-β. These are planning estimates; confirm the final design with a qualified statistician.
One-sided
The same effect tested in one direction only needs 27.
Sample size: 27
Open this example in the calculatorAllowing for dropout
Expecting 10% to provide no outcome: 34 / (1 − 0.10) = 37.8, so 38 are recruited.
Needed for analysis: 34 · To recruit: 38
Open this example in the calculatorProtocol statement
To detect a difference of 5 from the reference value with 80% power at a two-sided significance level of 0.05, using a one-sample t-test, and assuming a standard deviation of 10, the required sample size is 34 participants. Allowing for 10% dropout, 38 participants should be recruited. Calculated with StatWisely (statwisely.com) using: n: solve noncentral-t power for d, α, and 1-β. These are planning estimates; confirm the final design with a qualified statistician.
Validation
- 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 results agree with G*Power’s one-sample t-test: 34 two-sided and 27 one-sided for d = 0.5, α = 0.05 and 80% power [2].
How to cite
StatWisely. Sample size for a one-sample t-test. Method document, engine version 1.0.0, reviewed 2026-10-01. https://statwisely.com/methods/means-one-sample/
Cite the original references for the formulas your design uses as well.
References
- 1.Cohen J. Statistical Power Analysis for the Behavioral Sciences. 2nd ed. Hillsdale, NJ: Lawrence Erlbaum Associates; 1988.
- 2.Faul F, Erdfelder E, Lang AG, Buchner A. G*Power 3: a flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behavior Research Methods. 2007;39(2):175–191.
- 3.Borm GF, Fransen J, Lemmens WAJG. A simple sample size formula for analysis of covariance in randomized clinical trials. Journal of Clinical Epidemiology. 2007;60(12):1234–1238.
- 4.Donner A, Klar N. Design and Analysis of Cluster Randomization Trials in Health Research. London: Arnold; 2000.
- 5.Eldridge SM, Ashby D, Kerry S. Sample size for cluster randomized trials: effect of coefficient of variation of cluster size and analysis method. International Journal of Epidemiology. 2006;35(5):1292–1300. doi:10.1093/ije/dyl129
- 6.Hayes RJ, Moulton LH. Cluster Randomised Trials. 2nd ed. Boca Raton: CRC Press; 2017.
- 7.Adams G, Gulliford MC, Ukoumunne OC, Eldridge S, Chinn S, Campbell MJ. Patterns of intra-cluster correlation from primary care research to inform study design and analysis. Journal of Clinical Epidemiology. 2004;57(8):785–794. doi:10.1016/j.jclinepi.2003.12.013