Capstone — Designing and Analyzing a Real Experiment

Statistical Inference & Applied Statistics

Chapter 10 · Capstone — Designing and Analyzing a Real Experiment

One continuous worked experiment, touching every chapter of this course in the order a real analyst would actually reach for each idea: testing whether a redesigned checkout button genuinely improves conversion, from a historical baseline through a properly powered experiment to a closing Bayesian reframing.

A Full Worked Experiment — Testing a Redesigned Checkout Button

1 — The historical baseline is a sample, not the truth (Ch.2)

Before designing anything, the team pulls 400 historical sessions: 32 conversions, p = 8%. This is a sample of past traffic, not a guaranteed future rate — it carries genuine sampling error, and past traffic mix may not perfectly match what the actual test window will see. This number is a starting estimate, not a fact to design blindly around.

2 — Quantifying how much to trust that baseline (Ch.3)

Treating 8% as a proportion estimate: SE = √(0.08×0.92/400) ≈ 0.0136. The 95% confidence interval: 0.08 ± 1.96×0.0136 ≈ [5.3%, 10.7%]. The true baseline conversion rate could honestly be anywhere in that fairly wide range — a useful, humbling number to have before committing to a test design built on the single point estimate of 8%.

3 — Stating the formal hypotheses (Ch.4)

H₀: p_control = p_treatment (the button color makes no real difference) against H₁: p_control ≠ p_treatment, at the standard α = 0.05. Nothing about the experiment's own numbers is examined yet — the rules are fixed first, deliberately, to avoid the peeking trap Chapter 6 warned about.

4 — An A/A sanity check before the real test (Ch.5)

Before trusting the traffic-splitting mechanism itself, the team runs an A/A test — two groups, both shown the old button, compared on average session duration to confirm the split itself introduces no artificial bias. Group 1: n=30, mean 145s, s=40s. Group 2: n=32, mean 138s, s=38s. Welch's t-test: SE_diff ≈ 9.92, t ≈ 0.705, df = 29, critical value ≈ 2.045. |0.705| < 2.045 → fail to reject, exactly the desired outcome — the split mechanism itself shows no detectable bias, so the actual A/B test can proceed with confidence in the infrastructure.

5 — Running the properly powered test (Ch.6)

Using Step 1's own 8% baseline and wanting to detect a lift to 10% (Chapter 6's own worked effect size), proper sample-size planning calls for ≈3,210 per group — not the smaller, underpowered pilot Chapter 6's own example ran with. This time, the team runs the test to that full planned size: control n=3,210, 257 conversions (≈8.01%); treatment n=3,210, 321 conversions (10.00%).

QuantityValue
Pooled p̂≈ 0.0900
SE_pooled≈ 0.00714
z≈ 2.791
p-value≈ 0.0053
Proper planning finds what the pilot missed
0.0053 < 0.05 — this time, reject H₀. The exact same 8%→10% effect that Chapter 6's own underpowered n=1,000 pilot failed to detect (p≈0.118) becomes clearly significant once the sample size is actually planned properly. Nothing about the real effect changed — only whether there was enough data to reliably see it.
6 — Resisting a tempting observational shortcut (Ch.7)

Digging into the treatment group's data, engaged sessions (more product pages viewed) also tend to run longer — r ≈ 0.998 between pages viewed and session duration across a sample. It's tempting to conclude "showing users more product pages makes them stay longer," but per Chapter 7's own caution, this observational correlation could just as easily be reverse causation: genuinely interested users naturally view more pages and stay longer, with neither driving the other. Only Step 5's own randomized comparison — not this correlation — can support a causal claim.

7 — A regression-based follow-up (Ch.8)

Fitting a least-squares line to the same pages-viewed/duration data: duration ≈ 40.77 × pages + (−24.62), with R² ≈ 0.996 — a striking fit. Predicting duration for a session viewing 7 pages: ≈ 260.8s. Since the observed data only ranged up to 6 pages viewed, this prediction is already a mild extrapolation, per Chapter 8's own caution — worth flagging honestly rather than reporting with false confidence.

8 — A closing Bayesian reframing (Ch.9)

Step 5's result is a frequentist one: H₀ rejected at α=0.05, a binary decision. A Bayesian analyst, starting from a skeptical prior (most small UI tweaks historically move conversion very little), would update that prior using this experiment's own strong evidence (p≈0.0053, a properly powered result) and land on a substantially higher posterior belief the button change genuinely helps — a graded probability statement rather than a reject/fail-to-reject binary. Per Chapter 9's own honest scope boundary, computing that exact posterior number needs machinery (a specified prior distribution, conjugate updating) beyond this course — but the qualitative direction is clear either way: strong, properly powered evidence moves a skeptical starting belief substantially, regardless of which framework reports the final number.

This is, in essence, exactly what a rigorous, real A/B test looks like end to end — every step traceable to a specific chapter of this course, none of it a shortcut around the planning and honesty each one demanded.

What This Course Doesn't Cover

In the interest of an honest accounting: advanced experimental design (multi-armed bandits, sequential testing), machine learning model evaluation, and full computational Bayesian methods were all named in Chapter 1 as deliberately out of scope. This course built the core inferential toolkit those more specialized areas each build on, not a substitute for them.

This Course's Throughline, Restated

Reasoning honestly under incomplete information
Every chapter in this course answered a version of the same question: how much can a limited, incomplete sample actually tell you about the truth, and how do you act correctly under the uncertainty that remains? The capstone above used exactly eight ideas — sampling, confidence intervals, hypothesis testing, the t-test, proper A/B test planning, correlation's limits, regression, and Bayesian updating — across one continuous, realistic experiment. That's the real payoff: not a single flashy technique, but a disciplined process that catches its own mistakes (an underpowered pilot, a tempting correlational shortcut) before they become false conclusions.

Where This Course Connects

Together with its sibling course, this completes the Probability & Statistics arc within Maths for Programmers — Probability & Statistics Fundamentals built the forward-reasoning vocabulary and distributions; this course built the backward-reasoning discipline for drawing honest conclusions from real, limited data. Both connect directly to Technical Support's own diagnostic material (`perfdiag1`/`incident1`) and to Data Science & ML's own `ds1`/`ml1`, where this exact inferential toolkit gets applied at production scale.

Hands-On Exercises

Exercise 1

A different historical baseline shows 45 conversions out of 500 sessions. Using this chapter's own Steps 1–2 technique, compute the point estimate and its 95% confidence interval.

📄 View solution
Exercise 2

A team runs an A/A test comparing two groups both shown the same design: Group 1 n=25, mean=200, s=30; Group 2 n=28, mean=215, s=35. Using this chapter's own Step 4 technique, compute Welch's t-statistic and the conservative degrees of freedom. Using the critical value 2.064 (df=24), state whether this A/A test passes its own sanity check.

📄 View solution
Exercise 3

For each of the eight steps in this chapter's own worked experiment, name the specific inferential-statistics topic it relied on, without looking back at the step labels — just from the description of what each step actually does.

📄 View solution

Chapter 10 Quick Reference

  • Full worked experiment: a sampled baseline (Ch.2) → a confidence interval on it (Ch.3) → formal hypotheses (Ch.4) → an A/A sanity check via t-test (Ch.5) → a properly powered A/B test (Ch.6) → resisting an observational shortcut (Ch.7) → a regression follow-up (Ch.8) → a Bayesian reframing (Ch.9)
  • Out of scope: advanced experimental design, ML model evaluation, and full computational Bayesian methods — each reserved for its own specialized study
  • This course's throughline: a disciplined process for reasoning honestly under incomplete information, catching its own mistakes (underpowered pilots, tempting correlations) before they become false conclusions
  • This course, together with Probability & Statistics Fundamentals, is the direct foundation under Technical Support's diagnostic material and Data Science & ML's own applied work
  • Course complete — Statistical Inference & Applied Statistics, 10 chapters, from sampling to Bayesian updating