Lite / Engineering Complex Systems / Week 28
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?
Why should I care?
Optimisation means changing a design and claiming it got better. The claim needs a size, an uncertainty, and a reason to believe your change caused it rather than something that changed at the same time.
- Quantify a difference between two conditions with its standard error and an effect size.
- Interpret a correlation coefficient and explain why it does not establish cause.
- Name a confounding variable and design a comparison that controls it.
Predict
Design B's mean is 2 ms faster than A's. The SE of each mean is 1.5 ms. Is the difference convincing?
- Yes, B is clearly faster
- Not yet: the SE of the difference is about 2.1 ms, as big as the difference itself
- No: 2 ms is too small to ever matter
Guess first, then reveal
The difference of two independent means has SE = √(1.5² + 1.5²) ≈ 2.1 ms. A 2 ms gap is less than one SE: noise could easily produce it. More runs, or a less noisy setup, are needed.
Discover
Do Level 2: find the glitch and the clean mean from the noisy readings, then use the heat balance. As you go, note which quantities you measured and which you inferred from a model.
What the interactive shows (text version)
In the greenhouse Build, Level 2 gives ten noisy thermometer readings, one of which is a glitch, and asks for the clean mean and predictions from the heat balance Q = UA·(T − T_out). The lesson's point: separate what you measured from what you inferred, and attach an uncertainty to each comparison.
Watch (optional)
Watch for: Listen for the three ways a correlation can arise without A causing B: reverse causation, a common cause, and coincidence.
Lurking variables and coincidences explained with everyday examples, before you trust a trend in your own data.
“Correlation Doesn't Equal Causation: Crash Course Statistics #8” by CrashCourse (opens YouTube; streaming video uses a lot of data)
The video is optional. Everything you need is in this lesson's text.
Understand
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.
Explain it another way
Intuitive
Ice-cream sales and sunburn rise together. Ice cream doesn't burn you: sunny days drive both.
Technical
Welch's approach: SE_d = √(s_A²/n_A + s_B²/n_B). Pearson r = cov(x, y)/(s_x·s_y). r² is the fraction of variance in y explained by a linear fit on x.
Mathematical
For independent X and Y, Var(X − Y) = Var(X) + Var(Y), the same rule that will appear as uncertainty propagation next week. Covariance is the expected product of deviations: cov(x, y) = Σ(xᵢ − x̄)(yᵢ − ȳ)/(n − 1).
Applied
Clinical trials randomise patients so that unknown confounders are spread evenly across treatment and control. A/B tests on software do the same by randomly assigning users to versions.
Worked 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.
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.
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.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
Apply it
Find a claimed improvement in a product review or a project of your own. Write down: the difference, its uncertainty (or why it's missing), one possible confounder, and how you'd redesign the test.
Reflect
Which confounders could creep into a benchmark you run on your own computer?
Write your answer on paper or in your own notes. Lite never stores what you write.