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.
