liveBook · Manning

T-test

As explained in Statistics Slam Dunk

A t-test is a statistical test that evaluates whether a difference between means is unlikely under a null hypothesis, typically using a t-distributed test statistic.

A t-test asks whether the means of two—and only two—numeric groups are essentially equal or meaningfully different. It weighs the difference in means, group variation, and record counts, beginning from a null hypothesis that any observed difference is due to chance. section 12.7.2 section 7.0

Use it when a practical question has two groups: home versus road teams, championship winners versus other teams, or one treatment versus another. The result is judged against a predefined p-value threshold; with a 5% cutoff, a p-value at or below 0.05 leads to rejecting the null hypothesis, while a higher value leads to failing to reject it. section 7.4.1 section 20.2

A reliable workflow is:

  • Define the two populations, the numeric measure, and a null hypothesis of equal means. section 7.0 section 12.7.2
  • Inspect group averages alongside record counts; a small difference can be significant in a large dataset but not in a short one. section 7.4.1 section 12.10
  • Run R's t.test() on the two series, then read the p-value, confidence interval, and sample means. section 7.4.1
  • Visualize distributions with paired boxplots, but do not substitute the plot for the test when record counts differ. section 12.8.1 section 12.10
  • Pair the significance result with Cohen's d to assess magnitude; effect size does not determine whether to reject a null hypothesis. section 7.0 section 12.10

Home versus road foul calls

For the 2018–19 regular season, road teams averaged 21.10 personal fouls per game and home teams 20.71. A Welch two-sample t-test returned p = 0.02727, below 0.05, so the equal-means null hypothesis was rejected. The difference was statistically significant, even though its practical size still needed a separate effect-size check. section 7.4.1 section 7.0

Statistical significance can change when the record count changes even if the directional difference remains similar. In the 2019 playoffs, road teams averaged 0.59 more fouls per game, yet p = 0.31; the smaller dataset led to a failure to reject equal means. section 7.4.2 section 12.10

options(scipen = 999)

t.test(fouls1819reg$pfR, fouls1819reg$pfH)
## 
##  Welch Two Sample t-test
## 
## data:  fouls1819reg$pfR and fouls1819reg$pfH
## t = 2.2089, df = 2457.8, p-value = 0.02727
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.04290002 0.72132763
## sample estimates:
## mean of x mean of y 
##  21.09512  20.71301

Inspect a complete R t.test() call and its Welch output: t statistic, degrees of freedom, p-value, confidence interval, and each group's mean. section 7.4.1

How Statistics Slam Dunk covers it

How deep it goes
Defines two-group mean testing and works through R outputs, visualizations, thresholds, and record-count caveats without formal derivations.
Examples
Uses NBA home-road fouls and free throws, salary and win-share Gini coefficients, drugs, exam scores, and customer surveys.
What it assumes
Assumes two groups and a numeric measure while defining null hypotheses, p-values, and statistical significance.
What you can do after
Apply it via R's t.test() to compare two group means and make a threshold-based null-hypothesis decision.
How it connects
Connects null hypotheses, p-values, confidence intervals, Cohen's d, boxplots, Gini coefficients, and ANOVA.

Also explained in

Compare how 2 books explain t-test →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.