Contents/ Part XIII · Inference Case Studies/ Chapter 85

Review & Choosing the Right Test

Parts XI and XII gave you estimation and a toolbox of tests. This chapter ties them into one playbook: the four questions that pick any test, the assumptions to check first, and the habit of reporting an effect size and interval alongside every p-value, then it maps the five case studies ahead.

⏱️ ~15 min read
🐍 Notebook included
📊 Chapter 85

You have met point estimates and confidence intervals, the logic of hypothesis testing, z-, t-, F-, chi-square, and rank-based tests. The skill now is orchestration: turning a messy real-world question into the right test, run correctly, and reported honestly. That is what the next five chapters practice, and this one is the map.

Every analysis answers four questions: is the outcome numeric or categorical? how many groups? are they independent or paired? and do the assumptions hold? Those answers choose the test. Then you report a p-value, an effect size, and an interval, never one alone.
🧭
The chapter in one line

Estimation and testing are two views of the same data; four questions pick the test; assumptions come first; and a result is only finished when it carries an effect size and an interval, not just a p.

1

The Two Sides of Inference

Estimation asks "what is the value, and how sure are we?", a point estimate wrapped in a confidence interval. Testing asks "is the effect real, or could chance explain it?", H₀ vs H₁ with a p-value. They are mirror images of one another.

A 95% CI that misses 0 ↔ the test rejects H₀ at 5% 0 (no effect) 95% CI for the effect excludes 0 → significant

In the notebook, the same change scores give a 95% CI of about [1.1, 5.3] (which excludes 0) and a test with p ≈ 0.003 (which rejects), the two always agree. Use both in tandem: the test says whether there is an effect, the interval says how large it plausibly is.

2

The Master Decision Map

Answer the four questions and the test is almost forced. This is the same map from the Choosing the Right Test chapter, widened to include estimation and proportions, the version the case studies will use out loud.

Outcome type? numeric categorical / rate 2 pairedpaired t / Wilcoxon 2 indep.Welch t / M-W 3+ groupsANOVA / Kruskal a ratez for proportions 2 variableschi-square
OutcomeGroupsDesignTest (rank-based fallback)
Numeric1 vs a valueone-sample t-test (Wilcoxon)
Numeric2pairedpaired t-test (Wilcoxon signed-rank)
Numeric2independenttwo-sample Welch t (Mann-Whitney U)
Numeric3+independentone-way ANOVA + Tukey (Kruskal-Wallis)
Proportion1 or 2one- / two-proportion z-test
Categorical2 variableschi-square test of independence
3

Assumption Checklists

The fourth question is where most analyses go wrong. Check before you choose, then switch to the rank-based twin when the assumption fails.

Test familyCheckIf it fails
t-test / ANOVAroughly normal, or n ≥ ~30 (CLT); no wild outliersMann-Whitney / Kruskal-Wallis
Welch vs pooled tunequal variances? prefer Welch by defaultWelch handles it
Chi-squareexpected count ≥ ~5 in every cellFisher's exact test
Proportion zat least ~10 successes and ~10 failuresexact binomial test
Paired testsdata are genuinely paired (same units twice)do not treat as independent

The notebook shows the quick programmatic checks: skewness and the Shapiro-Wilk test for normality, and the minimum expected count for a chi-square. The discipline is simple, check, then choose, never the reverse.

4

Reading a Result Honestly

A p-value is half an answer. With a large enough sample, a trivial effect is "significant"; with too small a sample, a real effect hides. The cure is to always report three things together.

ReportAnswers
p-valuecould chance alone explain this? (yes/no at α)
Effect sizehow big is it? (Cohen's d, lift, Cramer's V, η²)
Confidence intervalhow precisely do we know it?

In the notebook, a tiny true effect of 0.06 at n = 50,000 gives p ≈ 10⁻⁴¹ (wildly "significant") with an effect size of 0.06 (negligible), the textbook reminder that significance is not importance. And "not significant" never means "no effect", it may just mean the study lacked power. Every case study ahead closes with this honest, three-part read.

5

The Five Case Studies Ahead

Each of the next five chapters takes one real, downloadable dataset from question to plain-English recommendation, narrating every decision: the hypotheses, the test choice, the assumption checks, the numbers, and a statistician's report written for a non-statistician.

Web A/B Test
Did the redesign convert better?
Two-proportion z-test, a power check, and a confidence interval on the lift.
Comparing Marketing Channels
Which acquisition channel performs best?
One-way ANOVA with Tukey HSD, cross-checked with a rank-based test.
Clinical Trial
Does the new treatment work?
A paired before/after test, a two-arm comparison, and a responder-rate proportion test.
Customer Satisfaction Survey
What do the survey numbers really say?
Chi-square independence, a top-box proportion with a margin of error, and an ordinal test.
Manufacturing Quality
Is the line on spec, and where are the defects?
One-sample test vs target, ANOVA across lines, and a defect-by-shift chi-square.
🐍

The decision rule as runnable code

The companion notebook shows estimation and testing agreeing on the same data via statsmodels' DescrStatsW, implements a choose_test() helper for the whole decision map, runs the assumption checks (skewness, Shapiro-Wilk, expected counts), and demonstrates why every p-value needs an effect size beside it.

📓 View Notebook (code & outputs) ▶ Open in Colab ⬇ View / Download on GitHub

View opens the rendered notebook instantly (no setup). Open in Colab runs & edits it live in your browser. To run locally, install numpy, pandas, scipy, matplotlib, statsmodels, and openpyxl and launch jupyter notebook.

🎓 Key Takeaways

  • Estimation and testing are two views of one dataset; a CI that excludes 0 matches a test that rejects H₀.
  • Four questions (outcome, groups, design, assumptions) pick the test almost uniquely.
  • Check assumptions first: normality / n, expected counts, pairing; switch to a rank-based test when they fail.
  • Report three things: a p-value, an effect size, and an interval, significance is not importance.
  • Next: five case studies apply this playbook end to end, each with a statistician's report.
6

Quiz: Test Yourself

Eight quick questions on the inference playbook. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved, so you can hop back to the chapter and return anytime.

🚀
Let's put it all together

With the playbook in hand, Case Study: A Web A/B Test takes a real experiment from question to ship decision, framing the hypotheses, checking power, running the two-proportion test, and reporting the lift with an interval.