Bayesian Sample Size Calculator

Set priors, precision, population, and dropout assumptions easily. View posterior width, needs, and scenario comparisons. Make stronger study plans with clear Bayesian evidence targets.

Calculator form

Reset

Example data table

Scenario Prior Anticipated p Credible level Half width Design effect Dropout Completed target Recruitment target
Baseline survey Beta(1,1) 0.50 95% 0.05 1.00 0.00 381 381
Clustered field study Beta(2,2) 0.35 95% 0.04 1.40 0.10 765 850
Finite population audit Beta(3,7) 0.20 90% 0.03 1.00 0.05 382 403
High precision pilot Beta(5,5) 0.60 99% 0.02 1.10 0.15 1648 1939

Formula used

This calculator plans a sample for a proportion with a beta prior. Start with prior parameters α and β. Enter an anticipated event rate p and a desired posterior half width m.

Posterior parameters are estimated as α* = α + n×p and β* = β + n×(1-p). The expected posterior mean is α* / (α* + β*).

Posterior variance is (α*×β*) / [(α* + β*)2 (α* + β* + 1)]. Expected half width is z × sqrt(variance), where z matches the chosen credible level.

The smallest n meeting the half width target becomes the base completed sample. That value is then multiplied by design effect, optionally corrected for a finite population, and finally inflated for dropout.

This is a practical planning approximation. Exact Bayesian decision rules can differ when loss functions, sequential stopping, or alternative priors are used.

How to use this calculator

  1. Enter a beta prior that reflects existing evidence.
  2. Set the anticipated event proportion for the new study.
  3. Choose the posterior credible level you want reported.
  4. Enter the target half width for acceptable precision.
  5. Add design effect when clustering or weighting increases variance.
  6. Add expected dropout so recruitment remains realistic.
  7. Enter population size only when the population is limited.
  8. Press calculate and review the completed and recruitment targets.
  9. Use the chart to inspect how interval width shrinks.
  10. Download CSV or PDF for documentation or review.

Why Bayesian sample size planning matters

Bayesian sample size planning helps convert prior knowledge into a clear recruitment target. Instead of focusing only on long run error rates, it asks whether the final posterior distribution will be precise enough for a decision. That makes it useful for pilot studies, audits, safety monitoring, clinical screening, product testing, and quality assurance.

A beta prior is convenient for proportion studies because it combines easily with binary outcomes. The prior adds interpretable evidence, often called effective prior sample size. When the prior is weak, the recommended sample behaves more like a traditional precision design. When the prior is strong, fewer new observations may be needed.

The main planning choice is usually the acceptable posterior interval width. Smaller widths demand larger samples. Higher credible levels also increase the requirement because they widen the interval. Design effect, finite population limits, and dropout then turn an ideal completed sample into an operational recruitment target.

No single assumption is perfect, so sensitivity analysis is important. Try more than one anticipated proportion, more than one prior, and more than one dropout rate. A defensible plan is often the one that stays stable across realistic scenarios.

Frequently asked questions

1) What makes Bayesian sample size different?

Bayesian sample size uses a prior and a target posterior precision. Classical formulas usually rely on repeated sampling properties and no explicit prior beliefs.

2) What outcome type fits this calculator?

This tool targets a posterior credible interval width for a proportion. It is most suitable for binomial or yes-no outcomes with a beta prior.

3) Does a stronger prior reduce the sample size?

A larger prior effective sample size usually reduces the required new sample. Strong priors add information, but poor priors can mislead planning.

4) Why are design effect and dropout included?

Design effect inflates the completed sample for clustering or weighting. Dropout inflates recruitment so enough completed observations remain after losses.

5) When should population size be entered?

Population size matters when the target population is limited. The calculator applies a conventional finite population correction after design adjustment.

6) Why is 0.50 often used for anticipated proportion?

Using 0.50 is conservative for many proportion studies because variance is highest near the middle. Known event rates can justify smaller samples.

7) Is this an exact Bayesian solution?

This version uses a normal approximation to posterior credible width. It works well in many planning settings, but exact Bayesian designs may differ.

8) Can one answer guarantee the final sample?

No. A sample size model guides planning, not proof. Sensitivity checks with multiple priors and event rates usually produce more defensible decisions.

Related Calculators

posterior predictive checkbayes rule calculatorbayesian logistic regressiondeviance information criterionbayesian t testprior probability calculatorrandom effects bayesianinverse gamma posteriorconjugate prior calculatormcmc acceptance rate

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.