Opens in a new tab

CALCULATOR · SAMPLE SIZE & POWER

Sample Size Calculator for Logistic Regression Events per Variable and Prediction-Model Criteria

Sample size for logistic regression starts with the question: are you developing a prediction model, or estimating an association (an adjusted odds ratio)? Enter the number of candidate predictors and the event proportion, and read the sample size as you type. Nothing you enter leaves your browser.

Runs in your browser. No data is sent or stored.

Method reviewed by an in-house statistician · Last checked November 2026

In Short

Sample size for logistic regression depends on what the model is for. For an explanatory model, the events-per-variable (EPV) rule of thumb links the number of events to the number of candidate predictor parameters. For a prediction model, the criteria of Riley and colleagues are the current recommendation: they return the sample size that limits overfitting, keeps the optimism in the apparent fit small and estimates the overall risk precisely. The calculator has one tab for each, and a third question, the power to test a single coefficient, is a different calculation that it does not cover.

How It Is Calculated

Tab 4a applies the events-per-variable rule of thumb (Peduzzi et al., 1996):

FORMULA

events = EPV · k n = events / φ round up

k = number of candidate predictor parameters · φ = expected event proportion · EPV = events per variable (10, 15 or 20; the default is 10, with the caveat that EPV is a rule of thumb).

Tab 4b applies the three criteria for a prediction model (Riley et al., 2020). First, the maximum Cox-Snell R² for the event proportion, and the three sample sizes:

FORMULA

max R²cs = 1 − [ φ^φ · (1 − φ)^(1 − φ) ]²
FORMULA

(i) n1 = k / [ (S − 1) · ln(1 − R²cs / S) ]
(ii) n2 = k / [ (R²cs / (R²cs + 0.05 · max R²cs) − 1) · ln(1 − R²cs − 0.05 · max R²cs) ]
(iii) n3 = (1.96 / δ)² · φ · (1 − φ)
n = max(n1, n2, n3) round up

R²cs = the anticipated Cox-Snell R² of the model · S = the shrinkage target (0.9) · δ = the margin for the intercept (0.05). Criterion (i) limits overfitting through shrinkage, (ii) keeps the difference between apparent and adjusted R² small, and (iii) estimates the overall risk precisely.

The anticipated R²cs is a required planning assumption, taken from a previous model in the same setting. If none exists, Riley et al. suggest a conservative 15% of the maximum as a starting point; the calculator offers a button that fills it, labeled as an assumption and never as a default.

Assumptions and When Not to Use It

  • Choose the objective first. The EPV rule belongs to an explanatory model; a prediction model should use the Riley criteria.
  • Count parameters, not variables. The k in both formulas is the number of candidate predictor parameters, so a categorical predictor with several levels contributes more than one.
  • EPV is a rule of thumb. It is not a power calculation, and meeting a target of 10 does not by itself ensure a stable model. See Logistic Regression.
  • R²cs is an assumption you source. It comes from a previous model in the same setting. A guess changes the result substantially.
  • Not a power calculation for one odds ratio. Testing one coefficient with a given power is a different calculation (Hsieh et al., 1998), outside this calculator. To have it done for your design, Request an Assessment.
  • Valid inputs. The event proportion must lie strictly between 0 and 1. Otherwise the calculator returns a message, not a number.

Worked Example (Hypothetical Values)

A team plans an explanatory model with 8 candidate predictor parameters. They expect 20% of participants to have the event and use a target of 10 events per variable on tab 4a.

Input or result Value
Candidate predictor parameters, k 8
Expected event proportion, φ 0.20
EPV target 10
Events required 80
Participants required 400

If the same model were a prediction model, tab 4b with the same k and φ and an anticipated R²cs of 0.0949 (15% of the maximum of 0.6324, the conservative starting value Riley et al. suggest) gives 719 for criterion (i), 237 for (ii) and 246 for (iii), so the requirement is 719, the largest of the three. Press “Load the worked example” under the calculator and these values fill the fields. HYPOTHETICAL VALUES.

What the Result Still Needs

  1. 1
    The objective stated. The protocol says whether the model is explanatory or predictive, since the two use different criteria.
  2. 2
    Candidate parameters counted carefully. Every parameter considered, including dummy variables and any terms for nonlinearity, enters k.
  3. 3
    A sourced event proportion. The proportion of participants expected to have the event, with a citation, because the participant number divides by it.
  4. 4
    A sourced R²cs for a prediction model. From a previous model in the same setting, or a labeled assumption with a sensitivity check.
  5. 5
    A justification paragraph for the protocol. The criteria used, the inputs with their sources and the resulting number of participants and events.
Have the inputs confirmed

A statistician checks the objective, the candidate predictors and the event proportion against your sources, reruns the criteria for your design and returns the justification paragraph you can paste.

Research Planning & Study Design
Already have a calculation?

Independent Statistical Review confirms a sample size calculation prepared by you, a colleague or an AI tool before it goes to a committee.

Independent Statistical Review

Frequently Asked Questions

It is a rule of thumb from simulation work (Peduzzi et al., 1996), and the calculator defaults to 10 only with that caveat. It is not a power calculation. For a prediction model, use tab 4b, the current recommendation.

From a previous model in the same setting. If none exists, Riley et al. suggest a conservative 15% of the maximum as a starting point, and the calculator has a button that fills that value, labeled as an assumption. Report the value you used and show how the sample size changes if it is lower.

Each protects against a different problem: overfitting, optimism in the apparent fit and an imprecise overall risk. The requirement is the largest of the three. In the worked comparison, criterion (i) at 719 decides the answer.

Every parameter you consider for the model, before any selection, not just those you keep. A categorical predictor with several levels contributes several parameters. Count them before you look at the data.

No. Testing a single coefficient with a given power is a different calculation (Hsieh et al., 1998) and is outside this calculator. If that is your question, request an assessment and a statistician will calculate it for your design.

References

  1. Hsieh, F. Y., Bloch, D. A., & Larsen, M. D. (1998). A simple method of sample size calculation for linear and logistic regression. Statistics in Medicine, 17(14), 1623-1634. https://doi.org/10.1002/(SICI)1097-0258(19980730)17:14<1623::AID-SIM871>3.0.CO;2-S
  2. Peduzzi, P., Concato, J., Kemper, E., Holford, T. R., & Feinstein, A. R. (1996). A simulation study of the number of events per variable in logistic regression analysis. Journal of Clinical Epidemiology, 49(12), 1373-1379. https://doi.org/10.1016/S0895-4356(96)00236-3
  3. Riley, R. D., Ensor, J., Snell, K. I. E., Harrell, F. E., Jr., Martin, G. P., Reitsma, J. B., Moons, K. G. M., Collins, G. S., & van Smeden, M. (2020). Calculating the sample size required for developing a clinical prediction model. BMJ, 368, m441. https://doi.org/10.1136/bmj.m441
  4. van Smeden, M., Moons, K. G. M., de Groot, J. A. H., Collins, G. S., Altman, D. G., Eijkemans, M. J. C., & Reitsma, J. B. (2019). Sample size for binary logistic prediction models: Beyond events per variable criteria. Statistical Methods in Medical Research, 28(8), 2455-2474. https://doi.org/10.1177/0962280218784726
i

Method reviewed by an in-house statistician · Last checked November 2026 · Test cases and boundary cases verified before release

Found an error or have a suggestion? Write to info@onlinespss.com with the calculator name and the inputs you used. Every report is checked by a statistician.

Have a Statistician Confirm Your Logistic Regression Sample Size

Share the study aim, the outcome and the sources for your event proportion and predictors. A statistically trained Research Coordinator reviews the request, and the scope and one fixed project fee are confirmed before work begins.

No Commitment Required

Strictly Confidential

Fixed Project Fee

In-House PhD-Level Statisticians

Same-Day Response