Skip to content

Lab B: does the test keep its promise?

When the groups have unequal spreads and sizes, which test keeps its 5% false-positive rate, and which one only looks more powerful?

Notebook capstone 1~30 minadvanced Simulated two-group latency designs

The story

A team compares a new model's latency with the old one: a small, noisy pilot of 10 runs against 40 steady production runs. Their report uses the pooled t test because it "has more power" than Welch's.

A test's promise is about repeated use: at the 5% level it should reject about one in twenty datasets where nothing differs. You can check that promise directly by simulating the design many times with no difference, and then with a real one. Every simulated rate is itself an estimate, so it comes with a Monte Carlo interval. Both notebooks draw their datasets from the same written-out generator in Python and R, so the two languages simulate identical datasets.

Data: Simulated two-group latency designs · Simulated. Generated in the notebooks with a written-out Wichmann–Hill stream (ML reference, Laboratory B design).

Stage 1 · notebooks · ~15 min

Check the 5% promise

Simulate 2,000 datasets where both groups have the same mean, count how often each test rejects at the 5% level, and put a Wilson interval around the Welch rate.

Which test keeps its false-positive rate near 5% in this design, and how sure is the simulation?

Notebook exercise: Does the test keep its 5%?. Simulate thousands of datasets where the null is true, count how often the pooled and Welch t tests reject, and report the Monte Carlo interval. 3 checks in Python or R.

Stage 2 · notebooks · ~15 min

Compare power fairly

Add a real difference and measure each test's power. Then calibrate the pooled test on the null simulations and measure its power again at a true 5% false-positive rate.

Does the pooled test's power advantage survive once it is held to a true 5% rate?

Notebook exercise: Power only counts for a calibrated test. Simulate the power of the pooled and Welch t tests for a real shift, then compare them fairly by calibrating the pooled test on null simulations first. 3 checks in Python or R.

Hints
  • Every null dataset has equal means, so each rejection there is a false positive.
  • A simulated rate from 2,000 runs has a Monte Carlo interval; report it with the rate.
  • Power only compares fairly between tests that keep the same false-positive rate.

memo

Which test the latency report should use

Write a short memo for the team: what the pooled test's false-positive rate is in their design, how you know, how certain the simulation is, and what its apparent extra power is worth.

  1. The design
  2. The 5% promise
  3. Power at an honest level
  4. Recommendation
Rubric
CriterionPoints
Reports both tests' null rejection rates from the simulation.2
Gives a Monte Carlo interval for a simulated rate and says what it covers.2
Compares power only after calibrating the pooled test to a true 5% rate.2
Recommends Welch's test for unequal spreads and says why.1
Notes that the result holds for this design and these simulations, not every design.1

Model answer

Show the model answer

The design. A pilot of 10 noisy runs against 40 steady runs: unequal sizes and unequal spreads.

The 5% promise. In 2,000 simulated datasets with no difference, the pooled t test rejected about a quarter of the time, while Welch's test stayed close to 5%, with a Wilson interval that includes 0.05. The pooled test uses one combined variance, which is the wrong yardstick when the small group is the noisy one.

Power at an honest level. With a real difference, the pooled test rejects more often than Welch's. But calibrated on the null simulations so that it rejects only 5% of null datasets, its power falls to about Welch's level: the extra power came from rejecting too often everywhere.

Recommendation. Use Welch's test for this comparison and report the simulated rates with their Monte Carlo intervals. The finding is specific to this design; a different imbalance needs its own simulation.