liveBook · Manning

T.test() function

As explained in Statistics Slam Dunk

The t.test() function is a base R function that performs a Student's t-test and reports test statistics and significance information.

Use base R's t.test() function to compare the means of exactly two data series. It considers their mean difference, variances, and record counts before testing whether the difference is statistically distinguishable from zero. section 12.7.2

A practical comparison follows these steps:

  • Interpret a p-value below 0.05 as evidence against equal means, then visualize the groups with paired boxplots. section 12.7.2

NBA salary inequality

Comparing Gini coefficients produces means of 0.48 for other teams and 0.53 for championship teams. The Welch two-sample test reports p = 0.006245, supporting a statistically significant difference in salary distributions.

How Statistics Slam Dunk covers it

How deep it goes
Explains inputs, hypotheses, p-value interpretation, filtering, test output, and follow-up visualization.
Examples
Uses Gini coefficients for championship-winning teams and all other teams, then pairs the test with boxplots.
What it assumes
Introduces means, variances, record counts, null hypotheses, p-values, and significance thresholds during the comparison.
What you can do after
Apply it via base R to test whether two observed group means differ significantly and interpret the resulting output.
How it connects
Connects means, variances, null hypothesis, p-value, confidence interval, Welch's t-test, and ggplot2 boxplots.

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.