What Is Logistic Regression Sample Size?
In logistic regression the information in your data comes from the outcome events, not the total number of subjects. A common rule of thumb asks for at least 10 events per predictor variable, and the total sample is the events needed divided by the rate of the less common outcome.
For a power-based answer, enter the odds ratio you want to detect with your alpha and power. The calculator uses the standard two-proportion formula for a binary predictor and the Hsieh, Bloch and Larsen formula for a continuous predictor, with a correction when the predictor is correlated with others and an allowance for dropout.
These are planning figures. The 10 events per variable rule is a guideline rather than a law, so justify your choice in a study plan and consider specialised software for complex models.
How to Use the Logistic Regression Sample Size Calculator
- Pick a method.
- Enter predictors and event rate, or the odds ratio, alpha and power.
- Add an allowance for dropout and read the total.
Logistic Regression Sample Size Formula
Events per variable
Hsieh (continuous predictor)
Correction for other predictors
Logistic Regression Sample Size Variables Explained
| Symbol | Meaning | Notes |
|---|---|---|
| EPV | Events per variable | 10 is a common minimum |
| OR | Odds ratio to detect | |
| α and power | Significance level and power | e.g. 0.05 and 80% |
| P | Event rate at the mean of the predictor | |
| R² | Correlation of the predictor with other predictors | Inflates n by 1/(1 − R²) |
Logistic Regression Sample Size Worked Example
With the example values loaded in the calculator above, the steps are:
- Events needed = predictors × events per variable = 5 × 10 = 50.
- Sample size = events ÷ rate of the less common outcome = 50 ÷ 0.2 = 250, rounded up to 250.
Result: Total sample size = 250; Events needed (outcome cases) = 50.
Worked example: events per variable
A model with 5 predictors at 10 events per variable needs 50 events. If 20% of subjects have the outcome, the sample size is 50 ÷ 0.20 = 250.
Power calculation for a continuous predictor
To detect an odds ratio of 2 per 1 SD with 20% event rate at the mean, α = 0.05 and 80% power: β* = ln 2 = 0.6931, and n = (1.96 + 0.8416)² ÷ (0.2 × 0.8 × 0.4805) = 7.849 ÷ 0.07688 = 102.1, which rounds up to 103.
This follows the formula by Hsieh, Bloch and Larsen for a normally distributed predictor. It is an approximation for small effects.
Limits of the rule of thumb
The 10 events per variable rule is a guideline from simulation work, not a law. Some studies need more, particularly with rare predictors or when the model will be used for prediction. Treat the result as a minimum and justify your choice in your study plan.
Where Logistic Regression Sample Size Is Used
Study protocols
Justify the sample size for a prediction or risk model.
Grant applications
Show a power-based sample size for a target odds ratio.
Checking feasibility
See how many events you need given the outcome rate.
Common Logistic Regression Sample Size Mistakes to Avoid
- Count predictor parameters, not variables: a categorical variable with 4 levels uses 3 parameters.
- Plan for dropout and missing data on top of the calculated size.
Logistic Regression Sample Size Terms and Definitions
- Events per variable (EPV)
- The number of outcome events divided by the number of predictor parameters in the model.
- Odds ratio
- The multiplicative change in the odds of the outcome for a one-unit change in the predictor.
Logistic Regression Sample Size FAQs
How many events per variable do I need in logistic regression?
A common minimum is 10 events per variable, though some work suggests more for stable estimates.
Is the sample size based on events or total subjects?
Events. Divide the events needed by the event rate to get the total sample.
How do I choose the odds ratio to detect?
Use the smallest effect that would matter in practice, not the effect you hope to see.
Does this work for several predictors?
The power formulas target one predictor of interest. Use the EPV rule, or specialised software, for many predictors.
What does R² with other predictors do?
If the predictor of interest is correlated with others, you need more subjects. The sample size is divided by (1 − R²).
How do I allow for dropout?
Divide the sample size by 1 minus the expected dropout proportion.