Method document
Sample size to estimate a regression slope
How many participants are needed to estimate the slope of a simple linear regression, the change in a numerical outcome per unit of a numerical predictor, within a chosen margin. Planned from the residual spread of the outcome and the spread of the predictor. Covers non-response.
https://statwisely.com/methods/precision-slope/
When to use it
- Estimating how much an outcome changes with a measured predictor, such as blood pressure per year of age, when the effect itself rather than a test is the aim.
Not for
- Showing that the slope differs from zero. Use linear regression under “Detect an effect”.
- A slope adjusted for other predictors, whose precision also depends on how they relate to this one.
- A strength of association on a unit-free scale. Use the correlation.
Notation
- Number of participants
- Margin of error, in outcome units per predictor unit
- Residual standard deviation of the outcome around the line
- Standard deviation of the predictor
- t quantile on n − 2 degrees of freedom
- Standard normal quantile for confidence 1 − α (1.960 for 95%)
- Non-response rate
Formulas
The smallest n whose interval is narrow enough
The standard error of the least-squares slope is σₑ divided by the root of the predictor’s sum of squares, (n − 1)σₓ² [1]. Because the t quantile depends on n, n is found by search rather than in closed form. If only the outcome’s SD σ_y and the correlation ρ are known, σₑ = σ_y√(1 − ρ²).
Non-response
The number to approach 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.
Margin of error
Values: Above 0, in outcome units per predictor unit
Half the width of the interval wanted around the slope.
Residual standard deviation
Values: Above 0
From a previous regression of the same outcome, or σ_y√(1 − ρ²).
Standard deviation of the predictor
Values: Above 0
How widely the predictor will vary in the sample. Recruiting across a wider range of the predictor makes the slope more precise.
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
- The relationship is linear, and the residuals are independent with constant variance, roughly normal for small samples.
- The predictor’s sample SD equals σₓ. With a randomly sampled predictor this holds on average, and simulation shows the typical interval within about 1% of the target.
- Non-response is unrelated to the outcome.
Worked examples
Residual SD 10, predictor SD 5
A margin of 0.5: at n = 65, t₀.₉₇₅,₆₃ × 10 / (5√64) = 1.998 × 0.25 = 0.4996, within the margin, while n = 64 gives 0.504; so n = 65.
Sample size: 65
Open this example in the calculatorDoubling the margin
A margin of 1 needs n = 19: roughly a quarter, plus the small-sample cost of t.
Sample size: 19
Open this example in the calculatorAllowing for non-response
With 10% expected not to respond: 65 / 0.9 = 72.2, so 73 are approached.
Needed for analysis: 65 · To approach: 73
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 same search in R, on qt(0.975, n − 2) × σₑ / (σₓ√(n − 1)), returns 65, 19, 250 and 388 for four test cases, matching the engine. Fitting lm() to 5,000 simulated samples at each size gave median interval half-widths of 0.499, 0.990, 0.250 and 0.0998 against targets of 0.5, 1, 0.25 and 0.1.
How to cite
StatWisely. Sample size to estimate a regression slope. Method document, engine version 1.0.0, reviewed 2026-10-04. https://statwisely.com/methods/precision-slope/
Cite the original references for the formulas your design uses as well.
References
- 1.Draper NR, Smith H. Applied Regression Analysis. 3rd ed. New York: John Wiley & Sons; 1998.