Monte Carlo Tolerance Analysis
When the shortcuts break down, because the formula is curved, the parts aren't normal or there are too many to track, let the computer build thousands of virtual assemblies from random parts and count how many work. That fraction is itself an estimate, with standard error , so four times the runs buys half the error.
What the symbols mean
- Estimated yield
The fraction of simulated assemblies that meet the spec.
- Number of runs
How many virtual assemblies were built.
- Standard error
How much the estimate changes from one simulation to the next; in practice, plug in p̂ for p.
What the symbols mean
- Margin of error
The ± half-width you want, at the confidence level set by z.
- Failure fraction
1 − p: the rare outcome you're trying to measure.
- Expected failures
How many failing runs you expect to see; about 100 gives ±10%.
What the symbols mean
- Standard normal draw
A random number from N(0, 1).
- Uniform draw
A random number between 0 and 1, what computers produce directly.
- Inverse CDF
Turns a uniform draw into a draw from any distribution with CDF F.
Explanation
Monte Carlo simulation is simply building lots of pretend products on a computer, each from randomly chosen parts, and counting how many come out good. The name comes from the casino in Monaco, a nod to the dice-rolling at its heart. The formulas are short: (good runs divided by total runs), its standard error (the same as for any poll), the run-count formula (that standard error solved for ) and three recipes for turning random numbers into random parts. A computer does the heavy lifting; you just have to read the answer honestly.
When the shortcuts run out. An RC low-pass filter should cut off at kHz, within ±8%. Its resistor is ±5% and its capacitor ±10%, and parts in both bins are spread roughly uniformly across the band: makers sort the best parts into tighter bins, so the wide bins come out flat. The formula is a quotient, the inputs aren't normal and the tolerances are big. The linear-and-normal shortcuts of the last two lessons get shaky. So let the computer build the filters.
The recipe.
- Model each input from data: its distribution, mean and SD. Probability plots tell you whether "normal" is fair.
- Draw random values of every input, independently (or with the correlation you measured).
- Compute the output for each of the virtual assemblies with the exact formula, no linearizing.
- Count the fraction in spec: .
- Report , because the answer is itself random.
Why the standard error is . Each run lands in spec with probability , independently of the others, so the count of good runs is binomial with mean and variance . Then has
That's the standard error of a confidence interval for a proportion: a simulation is a survey of virtual parts. Setting and solving gives the number of runs, .
Rare failures need many runs. For a defect rate measured in ppm, the error that matters is relative: , one over the square root of the number of failures you expect to see. Seeing 100 failures gives about ±10%; at 50 ppm that takes 2 million runs. For very rare events engineers lean on the normal-tail formulas or smarter sampling schemes.
Where random parts come from. Computers produce uniform numbers on . Then:
- uniform on : , with SD , the resolution formula from Measurement Error;
- normal: , where comes from a normal generator (one classic recipe is );
- anything whose CDF you can invert: , because . For an exponential lifetime that's ; for a Weibull it's .
Simulation vs the formulas. Monte Carlo handles anything: curved formulas, flat or skewed parts, correlation, even logic like "scrap any resistor outside its own band." The price is computer time and an answer with noise in it. The formulas are instant and exact under their assumptions. Good practice uses both: if the simulation and the RSS estimate disagree by more than a few standard errors, one of the assumptions is wrong, and you've learned something about the design.
A common mistake. It's tempting to report a simulated yield as if it were exact, because a computer produced it. It isn't: rerun with fresh random numbers and you'll get a slightly different , so always give its standard error. Related slips: running 1,000 trials to estimate a 100 ppm defect rate (you expect to see 0.1 failures), feeding the same stream of random numbers to two inputs (which makes them perfectly correlated), and assuming normal parts when the bins are flat.
See it
Worked examples
A Monte Carlo study builds virtual RC filters and finds with their cutoff in spec. Estimate the yield and give a 95% interval.
- 1
.
How many runs are needed to estimate a yield near to within with 95% confidence?
- 1
.
Practice
Type your answer and check it. Solve them all to complete the lesson.
A Monte Carlo study of simulated gearboxes finds with acceptable end play. Find the standard error of the estimated yield, in percentage points, to 3 decimal places.
You want to estimate an assembly yield that's probably near to within percentage points with 95% confidence (). How many simulation runs do you need? (Round up.)
A simulation of circuits estimates a failure rate that's really (1,000 ppm). What is the relative standard error of the estimate, , in percent? Give 3 significant figures.
To simulate bearing lives that follow a Weibull distribution with and h, a program solves for each uniform random number , where . What life does produce, in hours? Give 3 significant figures.
Three spacers have lengths uniform on mm and stack into a slot of mm. One Monte Carlo run draws , and for the three spacers. What gap does this virtual assembly have, in micrometers?
In which situation is a Monte Carlo analysis most clearly worth it, compared with the root-sum-square formula?
A four-part stack has spec limits at of the assembly (σ from RSS), so the normal model predicts a yield of . A Monte Carlo run with the parts' real, flat distributions finds in spec out of . How many standard errors is the simulated yield from ? (Use the standard error computed from .) Give 3 significant figures.
The hardest one here. Get it, and you've got this lesson.
A bracket's strength is normal with mean kN and SD kN; the load on it is normal with mean kN and SD kN, independent of . It fails when . How many Monte Carlo runs are needed to estimate the failure probability with a relative standard error of 10%? Give 3 significant figures.
Where it's used
Monte Carlo tolerance analysis is built into mechanical CAD packages and circuit simulators: designers run thousands of virtual builds of an engine, a lens stack or a power supply before any metal is cut. Chip designers simulate the random variation of every transistor to predict yield, and structural engineers estimate the failure probabilities of bridges and aircraft parts by sampling loads and strengths. The same logic drives risk analysis in finance and in project scheduling.