Back to tools

    Sample Size Calculator

    How many patients do you need for your clinical prediction model?

    Calculations run in your browser. Only if you request the report by email are the entered parameters sent.

    Answer a few questions with typical options, or fill them in from your statistical analysis plan (SAP).

    Estimate how many patients you need to develop a model that predicts whether an outcome occurs or the value of a clinical measurement.

    Before you start

    1. Choose what you want to predict and the clinical variables to assess. Typical options are provided; for categorical variables, just indicate how many categories there are.
    2. Review the suggested values. If you have a statistical analysis plan (SAP), upload or paste it to fill in the questions.
    3. See the sample size immediately. When finished, request a brief report by email with the justification, assumptions and references for your protocol.

    For developing models with independent patients. Not for treatment comparisons, validating existing models, survival or repeated measurements. Calculations run in your browser; only if you provide a SAP is its text sent to AI without being stored. Do not include patient data.

    Diagnostic model with a binary outcome, 10 candidate predictors

    Background: sample size for clinical prediction models

    The calculator implements the Riley criteria for developing multivariable prediction models (logistic regression for binary outcomes, linear regression for continuous ones), an alternative to the events-per-variable rule recommended in TRIPOD+AI and PROBAST.

    Why is the 10 events per variable (EPV) rule not enough?

    The 10 EPV rule ignores outcome frequency and the model's expected performance. Riley et al. (BMJ 2020) show it can yield insufficient or unnecessarily large samples, and propose deriving the minimum from explicit criteria.

    Which criteria does the calculator apply?

    For binary outcomes: expected global shrinkage ≥ 0.9, small difference (≤ 0.05) between apparent and adjusted Nagelkerke R², and precise estimation of overall risk (± 0.05 margin). For continuous outcomes, also precision of the residual variance and of the mean outcome. The final size is the largest of all.

    What are candidate parameters?

    Each coefficient the model might estimate: a numeric or yes/no variable counts 1; a categorical variable with k categories counts k − 1. Count every predictor assessed, not only those retained in the final model.

    Which Cox-Snell R² should I assume?

    Ideally, take it from a previously published model in the same population. Otherwise the calculator proposes conservative values according to expected predictor strength; the maximum possible value depends on outcome prevalence.

    Riley RD, Ensor J, Snell KIE, et al. BMJ. 2020;368:m441. doi:10.1136/bmj.m441 · Riley RD, Snell KIE, Ensor J, et al. Stat Med. 2019;38(7):1276–1296. doi:10.1002/sim.7992

    Method and assumptions

    What it calculates

    The minimum sample size for developing a clinical prediction model according to the criteria of Riley et al. [1–3], for binary outcomes (logistic regression) and continuous outcomes (linear regression). Survival (time-to-event) outcomes are not covered.

    Criteria

    Binary outcome [1, 2]: (i) expected global shrinkage factor ≥ 0.9; (ii) absolute difference ≤ 0.05 between apparent and adjusted Nagelkerke R²; (iii) precise estimation of overall risk, with a margin of error of ±0.05 (95% CI).

    Continuous outcome, the equivalent criteria of Riley et al. (Part I) [3]: (i) expected global shrinkage ≥ 0.9; (ii) absolute difference ≤ 0.05 between apparent and adjusted R²; (iii) residual standard deviation estimated within a multiplicative margin of error ≤ 1.10; (iv) mean outcome estimated within ±0.1 standard deviations (95% CI).

    The recommended size is the maximum across the criteria. The report you can receive by email lists the size each criterion requires.

    Performance assumption

    The “Little / Moderate / A lot” levels correspond to:

    LevelBinary: Nagelkerke R²Continuous: R²
    Little0.100.10
    Moderate0.150.20
    A lot0.300.40

    For binary outcomes, Nagelkerke R² is converted to Cox-Snell R² by scaling it by the maximum possible for the outcome prevalence φ, max R²CS = 1 − exp(2[φ ln φ + (1 − φ) ln(1 − φ)]), the same route as the nagrsquared option of pmsampsize 1.1.3 [4]. For continuous outcomes, R² is used directly.

    Difference from pmsampsize

    Reference case: with 16 candidate parameters, 15% prevalence and the “Moderate” level, the calculator gives 1602 patients and pmsampsize 1594. The 8-patient difference arises because pmsampsize rounds intermediate values to three decimals (here, Cox-Snell R² 0.086 out of a maximum of 0.571) and the calculator does not. It is an implementation choice, not an error.

    Privacy

    The calculation runs in your browser. If you paste or upload a statistical analysis plan (SAP) to fill in the assumptions, that text is sent to an AI model for analysis (only its relevant sections if it is very long) and is not stored.

    References

    1. Riley RD, Ensor J, Snell KIE, Harrell FE Jr, Martin GP, Reitsma JB, et al. Calculating the sample size required for developing a clinical prediction model. BMJ. 2020;368:m441.
    2. Riley RD, Snell KIE, Ensor J, Burke DL, Harrell FE Jr, Moons KGM, et al. Minimum sample size for developing a multivariable prediction model: Part II — binary and time-to-event outcomes. Stat Med. 2019;38(7):1276–96.
    3. Riley RD, Snell KIE, Ensor J, Burke DL, Harrell FE Jr, Moons KGM, et al. Minimum sample size for developing a multivariable prediction model: Part I — continuous outcomes. Stat Med. 2019;38(7):1262–75.
    4. Ensor J, Martin EC, Riley RD. pmsampsize: Sample size for development of a prediction model. R package version 1.1.3. CRAN.