Enrichment · STEM Explorations · How many random trials is enough

More trials,
smaller error.

A Monte Carlo run estimates a probability by repeating a random experiment many times and counting successes. The estimate wobbles around the truth by about the square root of p times one minus p over the number of trials. Type the probability you expect, the trials, a z-score for your confidence and a scale (4 turns a quarter-circle hit rate into an estimate of pi). The page works out the error and the trials you need for a margin you choose.

The monte carlo simulation engine

The worked example is Darts in a quarter circle (78.54% hit) estimating pi with 10,000 trials at 95%, wanting plus or minus 0.01. Nothing you type leaves this browser.

Loading the calculator. If nothing appears, turn on JavaScript.

What you get

Enrichment · STEM ExplorationsOpen to everyone · no sign-in

What you finish with
The standard error, margin and interval of a Monte Carlo estimate of a probability, the trials needed for a margin you choose and a table by number of trials.
Who it is for
Students in statistics, computer science and physics, and the hobbyists and teachers who run random experiments and want to know how far to trust them.
Format
Browser calculator for a phone, tablet or computer, by touch or keyboard. Prints a summary; downloads a spreadsheet (.csv); export and import a file.
Access
Open to everyone with the link: no account, no sign-in, nothing to buy and nothing to install. Everything you type stays in this browser; nothing is sent to Caveat.
Where it lives
The STEM Explorations space in Caveat Enrichment.
Support
Questions, a correction or a request: team@caveatacademic.com.

How to use it

  1. Name the run.
  2. Type the chance of success on one trial and the number of trials.
  3. Type the z-score for your confidence and a scale (1 if none).
  4. Type the margin you want on the estimate.
  5. Read the margin you get and the trials you need, and scan the table.

Plan the run

How the figures are worked out

Error falls with the square root.

The worked example: pi from darts in a quarter circleHit chance0.7854pi ÷ 4Std. error0.0041110,000 trialsScaled0.0164× 4For ±0.01103,598trialsThe worked example: pi from darts in a quarter circleHit chance0.7854pi ÷ 4Std. error0.0041110,000 trialsScaled0.0164× 4For ±0.01103,598trials
A dart in the unit square lands inside the quarter circle with probability pi ÷ 4, so four times the hit rate estimates pi.

The model

Each trial succeeds with probability p, independently. The count of successes is binomial, and the share of successes in n trials has standard error √(p(1 − p) ÷ n). For enough trials the estimate is close to normal, which is where the z-score comes from.

Why pi works as an example

Throw points at random in a unit square. The share that land inside the quarter circle of radius 1 approaches pi ÷ 4. Multiply by 4 and the same error formula gives a margin on pi. About 100,000 trials are needed to pin pi to ±0.01 with 95% confidence, a slow way to find a number, which is the point.

Sources

  1. Metropolis, N., & Ulam, S. (1949). The Monte Carlo method. Journal of the American Statistical Association, 44(247), 335-341.
  2. NIST/SEMATECH. e-Handbook of Statistical Methods: confidence intervals for a proportion. itl.nist.gov/div898/handbook.
  3. Kroese, D. P., Brereton, T., Taimre, T., & Botev, Z. I. (2014). Why the Monte Carlo method is so important today. WIREs Computational Statistics, 6(6), 386-392.
  4. Common Core State Standards for Mathematics, HSS-IC.A.2 and HSS-MD: using simulation to decide whether a model fits and to estimate probabilities. thecorestandards.org.

Figures worked from your own numbers. Nothing you type is sent to Caveat. The worked example is made up. Your entries stay in this browser. Support: team@caveatacademic.com.

Written with AI, then checked before it is published. How we checkFound a mistake? Report it and we fix it, or refund you.Cancel anytime.