Sample Size Calculator

Calculate required sample size with literature-based effect size estimation, sensitivity matrix across power levels, and reproducible R/Python code — includes verification guidance.

sample sizepower analysisstudy planningeffect sizeR codePython codeclinical trialcomprehensive
Usage Guide
  1. Fill in your study design, primary outcome type, and target statistical power.
  2. Click AI Run — receive sample size calculations with sensitivity analysis directly in the chat.
  3. Adjust assumptions and ask for recalculations or alternative scenario comparisons.
Medical Research Assistant
Fill in variables and run directly with AI
Wiki

What this tool does

A sample size calculation assistant for clinical and biomedical researchers. Provide your study design, primary outcome, expected effect size, significance level, and target power — the AI uses established formulas to calculate the required sample size, displays all intermediate steps, and adjusts for expected dropout. The result includes a sensitivity matrix showing how sample size changes across different effect size and power assumptions, so you can plan for uncertainty rather than committing to a single number.

Why a sensitivity matrix instead of one number

Your pre-specified effect size is almost always uncertain. Published effect sizes are frequently inflated due to small-study bias and selective reporting. The sensitivity matrix — displaying sample sizes across a grid of plausible effect sizes (e.g., Cohen's d = 0.3 to 0.6) and power levels (80%, 85%, 90%) — gives you a realistic planning range. Choose the sample size that remains feasible even under the more conservative effect size assumptions.

Effect size estimation from literature

If you do not have a prior effect size estimate, the AI will guide you to search PubMed for similar published trials or observational studies and extract their observed effect sizes. It will also remind you that published effect sizes may overestimate the true effect; using a value 20–30% smaller than the published estimate is a common conservative approach recommended by biostatisticians.

Supported study designs

Two-arm parallel RCTs (superiority, non-inferiority, equivalence), paired designs (crossover, before-after), prospective cohort studies, case-control studies, cross-sectional prevalence surveys, and diagnostic accuracy studies (sensitivity, specificity, AUC). For complex designs such as cluster-randomized trials or adaptive trials, the tool provides guidance on the key formula parameters and recommends specialist consultation for final calculations.

Reproducible code

The AI generates ready-to-run R code (pwr, MASS, or survival packages as appropriate) and/or Python code (statsmodels, pingouin) for every calculation — with all parameters declared explicitly, no hidden defaults. You can re-run the calculation independently to verify the result.

Verification and limitations

Sample size calculations involve assumptions; the AI is a planning aid, not a regulatory tool. Always verify final sample sizes using validated standalone software (G*Power, PASS, nQuery) and, for regulated clinical trials, consult a qualified biostatistician. The AI will display clear disclaimers alongside every calculation.

FAQ