Textbooks/Applied Engineering Mathematics/Chapter 7Lite (plain text) version
7Statistics for engineering evidence
Version 1 · Technically checked (automated checks only) · 4 source lessons · 8 practice items
Introduction
A single number from a test is not evidence until you know how much it would wobble if you ran the test again. This chapter describes distributions honestly (including the one strange run), turns spread into a standard error and a confidence interval, propagates uncertainty by simulation when formulas get awkward, and compares two designs by the difference between them rather than by two separate averages.
Explanation
This chapter is built from 4 School lessons. Each part below is the lesson's own explanation; open the lesson for its predict-and-discover activities.
7.1 Distributions, spread and the one weird run
Nineteen runs take about 48 ms. One takes 110 ms. Is your code slow, or is your summary lying to you?
Centre: mean or median?
The mean uses every value, so it is efficient for well-behaved data and sensitive to extremes. The median is the middle of the sorted list: robust to a few wild values, but it throws information away. For timings, which often have a long right tail (occasional slow runs from caches, interrupts or garbage collection), report both, or report the median with the interquartile range.
Spread: variance and standard deviation
Sample variance s² = Σ(xᵢ − x̄)² / (n − 1); the standard deviation s is its square root and has the data's units. Dividing by n − 1 rather than n corrects a bias: deviations are measured from x̄, which was fitted to the same data, so they come out slightly too small. With n = 5 the correction is 25%; with n = 100 it is 1%.
Shape matters
Two data sets can share a mean and SD yet look completely different: one symmetric bell, one skewed with a long tail, one with two humps (perhaps two machines mixed together). Always plot the data (dot plot or histogram) before trusting a summary. A bimodal timing histogram usually means two different code paths, not noise.
Outliers: flag, investigate, report
A z-score z = (x − x̄)/s counts standard deviations from the mean; |z| > 3 is a common flag for roughly normal data. A flag is a question, not a verdict. Was the laptop throttling? Did a backup start? If you exclude a point, say so, give the rule you set before looking, and show the result both ways. Silently deleting inconvenient data is falsification.
Common mix-ups
- The mean is always the best summary.
✓ For skewed data or data with rare extremes the median (with IQR) often represents a typical value better; report what fits the question. - An outlier is an error and should be removed.
✓ An outlier is a flag to investigate. Remove only with a pre-stated rule, and report it.
Open the full lesson: Distributions, spread and the one weird run →
7.2 What a 95% confidence interval really promises
Your interval is 47.2 to 49.0 ms. Is there a 95% chance the true mean is in there?
The recipe
- Compute x̄ and s from n independent measurements. 2. SE = s/√n. 3. Half-width h = z·SE. 4. Report x̄ ± h with the confidence level, n and the method. Example: 48.1 ± 0.9 ms (95% CI, n = 30, normal approximation).
The correct interpretation
If you repeated the whole experiment many times, about 95% of the intervals built this way would contain the true mean. Once your interval is computed, μ either is in it or isn't; you just don't know which. Saying 'there is a 95% probability μ lies between 47.2 and 49.0' is a common shortcut, but strictly it is a different (Bayesian) statement.
When the approximation breaks
The z-interval assumes independent data, a roughly normal sampling distribution and enough data to trust s. It under-covers for small n (use t), for strongly skewed data with small n (use more data, a transformation, or the bootstrap), and badly for correlated data such as drifting benchmarks. Systematic error is never captured: a mis-calibrated timer shifts every interval.
Width, level and effort
Higher confidence widens the interval (99% is about 31% wider than 95%). Quadrupling n halves it. Choose the level before you look at the data, and plan n from the half-width you need: n ≈ (z·σ/h)².
Derivation: Building the interval from the sampling distribution
For large n, the sample mean is approximately normal: x̄ ~ N(μ, σ²/n).
Standardise: Z = (x̄ − μ)/(σ/√n) ~ N(0, 1). For a standard normal, P(−1.96 ≤ Z ≤ 1.96) = 0.95.
Substitute: P(−1.96 ≤ (x̄ − μ)/(σ/√n) ≤ 1.96) = 0.95.
Rearrange the inequality for μ: P(x̄ − 1.96·σ/√n ≤ μ ≤ x̄ + 1.96·σ/√n) = 0.95. The random quantity is x̄, so this is a statement about the interval, not about μ.
σ is unknown, so replace it with s. For small n this extra uncertainty matters: use Student's t value (for example t = 2.26 instead of 1.96 when n = 10) or the interval will be too narrow.
Result (normal approximation): x̄ ± z·s/√n, with z = 1.645 (90%), 1.96 (95%) or 2.576 (99%).
Common mix-ups
- A 95% CI contains 95% of the measurements.
✓ It describes uncertainty in the mean, which is about √n times narrower than the spread of individual measurements. - A narrower interval is always better.
✓ Only if it is honest. Ignoring drift, using z for tiny n or dropping inconvenient runs gives narrow, wrong intervals.
Open the full lesson: What a 95% confidence interval really promises →
7.3 Monte Carlo: propagate by simulation
Your model has six uncertain inputs and a square root, an exponential and an if-statement. Is there a formula for its uncertainty? You don't need one.
The algorithm
- Describe each uncertain input with a distribution (normal with its standard uncertainty is the default; uniform for a resolution limit). 2. Draw one value of every input. 3. Run the model. 4. Repeat N times. 5. Summarise the outputs: mean, SD, percentiles (the 2.5th and 97.5th give a 95% interval without assuming normality).
How big should N be?
The Monte Carlo estimate of a mean has standard error s_out/√N; estimates of an SD or of tail percentiles need more samples than estimates of a mean. A practical check: run with two different seeds. If the results differ in a digit you intend to report, increase N. For a 95% interval from percentiles, N ≥ 10,000 is a sensible start.
Correlated inputs
If two inputs share a cause (the same reference voltage, the same temperature), sample that shared cause once per trial and derive both from it. Sampling them independently would understate or overstate the output's uncertainty. This is far easier to get right in Monte Carlo than in a formula.
Reproducible randomness
Use a seeded pseudo-random generator and record the seed, the distributions, their parameters and N. Then anyone can regenerate your histogram exactly. Every simulator and practice generator on this site is seeded for exactly this reason: the server can recompute your result from the seed to check it.
Common mix-ups
- Monte Carlo is random, so its answers can't be trusted.
✓ Its error is predictable (it shrinks as 1/√N) and seeded runs are exactly reproducible. - More inputs need exponentially more Monte Carlo samples.
✓ That is true of grid methods. Monte Carlo's convergence rate doesn't depend on the number of inputs.
Open the full lesson: Monte Carlo: propagate by simulation →
7.4 Is the difference real? Effect sizes and correlation
Greenhouse readings rise with the heater power, and also with the sunshine. Which one is warming the plants?
The difference and its uncertainty
For independent conditions A and B, the difference of means d = x̄_B − x̄_A has standard error SE_d = √(SE_A² + SE_B²). A rough 95% interval is d ± 1.96·SE_d. If that interval comfortably excludes zero, the data support a real difference; if it straddles zero, you can't tell the sign yet.
Effect size: how big, not just whether
Cohen's d = (x̄_B − x̄_A)/s_pooled expresses the difference in units of run-to-run spread. d ≈ 0.2 is small, 0.8 large. With enough data even a trivially small effect becomes 'significant'; the effect size tells you whether anyone should care. Engineers usually prefer the raw difference in real units (ms, W, mm) plus its interval.
Correlation is a number, not a mechanism
Pearson's r runs from −1 to +1 and measures how well a straight line describes the relationship. r = 0.9 between heater power and temperature does not prove the heater warms the greenhouse: sunshine might raise both (the controller turns the heater down when it's sunny, which could even make r negative). Correlation also misses curved relationships entirely.
Control the confounders
A confounder affects both the thing you change and the thing you measure. Defeat it by design: change one variable at a time, randomise or interleave the order of conditions, and run both conditions under the same environment. In simulation you can hold the weather fixed exactly, which is one reason engineers simulate before field trials.
Common mix-ups
- If two numbers differ, one condition is better.
✓ A difference smaller than about two standard errors of the difference is easily produced by noise. - A high correlation proves cause and effect.
✓ Correlation can come from a common cause, reverse causation or chance. Causation needs a controlled comparison.
Open the full lesson: Is the difference real? Effect sizes and correlation →
Worked examples
Distributions, spread and the one weird run: example 1
Runs (ms): 47, 49, 48, 50, 46. Find the mean and sample SD.
Solution
Mean = 240/5 = 48. Deviations −1, 1, 0, 2, −2; squares 1, 1, 0, 4, 4; sum 10. s² = 10/4 = 2.5, so s ≈ 1.58 ms.
Distributions, spread and the one weird run: example 2
Add a sixth run of 70 ms. What happens to the mean, the median and the z-score of 70 measured against the first five?
Solution
Mean = 310/6 ≈ 51.7 ms (up 3.7). Median of 46, 47, 48, 49, 50, 70 = (48 + 49)/2 = 48.5 (up 0.5). z = (70 − 48)/1.58 ≈ 13.9: definitely flag it and find out what happened.
What a 95% confidence interval really promises: example 1
n = 36 runs, x̄ = 52.4 ms, s = 4.8 ms. Give the 95% CI.
Solution
SE = 4.8/6 = 0.8 ms. h = 1.96 × 0.8 = 1.57 ms. CI: 52.4 ± 1.6 ms, i.e. 50.8 to 54.0 ms.
What a 95% confidence interval really promises: example 2
How many runs would give a half-width of 0.5 ms with the same s?
Solution
n = (1.96 × 4.8/0.5)² = (18.8)² ≈ 354 runs. Precision is expensive.
Monte Carlo: propagate by simulation: example 1
A Monte Carlo run gives SD(P) = 0.92 W with N = 1,000, and 0.89 W with a different seed. You want to report SD to two significant figures. Is N enough?
Solution
The two seeds disagree in the second figure (0.92 vs 0.89), so no. With N = 16,000 the sampling noise drops by 4×, and repeated seeds should then agree to about ±0.01 W.
Is the difference real? Effect sizes and correlation: example 1
A: mean 40.0 ms, SE 0.6. B: mean 38.2 ms, SE 0.8. Give the difference with a 95% interval.
Solution
d = 38.2 − 40.0 = −1.8 ms. SE_d = √(0.36 + 0.64) = 1.0 ms. Interval: −1.8 ± 1.96 → −3.8 to +0.2 ms. It just includes 0, so the evidence for B being faster is suggestive, not conclusive.
Interactive figures
Interactive figure (online). Description: The interactive shows 19 run times clustered around 48 ms with an SD near 3 ms, plus one run you move from 40 to 120 ms. Moving it to 110 ms raises the mean by about 3 ms, raises the SD several-fold, leaves the median almost unchanged, and gives a z-score far above 3, so the run is flagged. Choosing 'Exclude and report' recomputes the summaries without it and reminds you to report the exclusion.
Interactive figure (online). Description: The simulator draws 20 experiments of n readings from a normal distribution with true mean 50 and builds a confidence interval from each, drawn as a horizontal bar. Bars that miss the true mean are marked 'miss'. Over many batches, about 95% of 95% intervals contain 50 when n is 30; with n = 3 coverage drops to roughly 80%, because z = 1.96 is too small when σ is estimated from so few points.
Laboratory
Everything runs in your browser. No kit, nothing mains-powered. Simulations are simplified educational models.
Equation Lab exploration
Equation Lab: Distributions
Draw repeated samples and watch how often a 95 % interval built from each sample contains the true mean.
Open Equation Lab: Distributions →Simulation OS experiment
Simulation OS: Repeated distance measurements
Take 5, 20 and 80 readings, build an interval each time and check that the width shrinks roughly as 1/√n.
Open Simulation OS: Repeated distance measurements →
Guided practice
Answers are checked on the server; wrong answers get a hint and another try. Signed in, solved items also count towards the source lesson.
- Your benchmark times have a long right tail from occasional background tasks. Which centre is least affected by those rare slow runs?
- Mean
- Median
- Maximum
- Range
- A run is flagged with z = 4.2. What is the most defensible action?
- Delete it: it is obviously wrong
- Investigate the cause, apply a rule fixed in advance, and report results with and without it
- Keep it but don't mention it
- Re-run until the outlier goes away, then report only the new runs
- Which statement correctly interprets a 95% confidence interval?
- 95% of the data lie inside it
- If the experiment were repeated many times, about 95% of intervals built this way would contain the true mean
- The true mean changes 5% of the time
- There is a 95% chance the next measurement will fall inside it
- With n = 4 runs, you build x̄ ± 1.96·s/√n. What is the main risk?
- The interval is too wide
- The interval is too narrow: with so few runs s is unreliable, and the t value (3.18) should replace 1.96
- There is no risk
- The mean will be biased
- When is Monte Carlo clearly preferable to the quadrature formula?
- When all inputs have tiny uncertainties and the model is a simple product
- When the model has thresholds or strong curvature, or inputs are correlated
- Never: formulas are always more accurate
- Only when you have no computer
- Which detail is essential so that someone else can reproduce your Monte Carlo result exactly?
- The colour of the histogram
- The random seed, the input distributions and N
- How long it took to run
- The name of your laptop
- SE_A = 0.3 W and SE_B = 0.4 W for two independent conditions. What is the SE of the difference of means, in W? (W)
- A team tests firmware v2 on Monday morning and v1 on Friday afternoon, when the lab is warmer. v2 uses less power. What is the main problem?
- The sample is too large
- Temperature is a confounder: it changed along with the firmware
- Power can't be measured accurately
- Nothing: the result is clear
Engineering applications
Acceptance testing
A supplier claims a motor delivers 2.0 N·m. Ten units averaging 1.95 N·m with an interval of ±0.08 N·m cannot reject the claim; the same average from fifty units could.
Tolerance analysis by simulation
When a part's performance depends on several toleranced dimensions through a nonlinear formula, sampling thousands of random builds gives the spread of performance without any calculus.
Watch
Optional verified videos. Nothing loads from YouTube until you press play.
- Confidence Intervals, Clearly Explained!!! (StatQuest with Josh Starmer)
- Standard Deviation vs Standard Error, Clearly Explained!!! (StatQuest with Josh Starmer)
- Correlation Doesn't Equal Causation: Crash Course Statistics #8 (CrashCourse)
Chapter summary
- Describe a distribution by its centre, spread and shape; investigate outliers, never delete them silently.
- The standard error s/√n measures how much the mean would vary between repeats.
- A 95 % interval procedure captures the true value in about 95 % of repeated studies; small n needs t, not 1.96.
- Compare designs by the difference and its own standard error, and watch for confounders.
Glossary
- Mean and median
- The mean is the sum of the values divided by how many there are; the median is the middle value once the values are sorted.
- Standard deviation
- Standard deviation measures how spread out values are around their mean: the square root of the average squared distance from the mean.
- Standard error of the mean
- The standard error of the mean estimates how much a sample mean would vary between repeated experiments: the sample standard deviation divided by the square root of the number of readings.
- Outliers and honest data
- An outlier is a reading far from the rest. It may be a genuine effect or a fault; either way it must be investigated and reported, and any exclusion rule decided before seeing the results.
- Confounding variable
- A confounding variable affects both the thing you changed and the thing you measured, creating an apparent link that is not a cause.
Definitions from the Field Guide.
Project: Is version B really faster?
Use a School simulation with a random element to compare two settings. Run each enough times to estimate the difference with an interval, write the decision rule first, and report the difference, its interval and the decision.
Deliverables
- The decision rule, written before the runs
- The difference with its 95 % interval
- A note on possible confounders and how you controlled them
Keep your work in your Engineering Journal; it stays private unless you choose to share it.
References
- Douglas C. Montgomery and George C. Runger (2014). Applied Statistics and Probability for Engineers, 6th edition. Wiley.
Publication record
- Version
- 1
- Status
- Technically checked (automated checks only)
- Technical review
- Automated checks only, last run 2026-11-29. No human, educator or mentor review is claimed.src/content/textbooks/textbooks.test.ts: schema, every lesson, diagram, practice item, video, Field Guide entry, lab and reference resolves; figure numbers recomputed; no practice answers in client payloads.
- Written by
- Compiled and written by the Tactiverge team with AI assistance, from Tactiverge School lessons that were themselves written with AI assistance.
- Licence
- All rights reserved by the founders unless a licence is approved.
- Corrections
- None recorded yet.Spotted a mistake? Use “Report a problem” on any chapter, or see the corrections page.