Course contentsShow
← Data Science
Lesson 358 of 2,14510. Hypothesis Tests for MeansFree lesson

Worked Example: One-Sample t-Test in Practice

Complete step-by-step example testing whether average customer spending differs from a target value using sample data.

Worked Example: One-Sample t-Test in Practice

You'll learn: How to execute a complete one-sample t-test from raw data to conclusion, testing whether average customer spending differs from a target value.

The Scenario

Imagine you manage a coffee shop and believe the average customer spends $8 per visit. You collect spending data from 15 randomly selected customers and want to test if the true average differs from your target.

Sample data (spending in dollars): 6.50, 9.20, 7.80, 10.10, 8.50, 7.20, 9.80, 8.00, 11.20, 7.50, 8.90, 9.50, 6.80, 10.50, 8.70

Step-by-Step Solution

1. Set Up Hypotheses

  • H₀: μ = $8 (average spending equals target)
  • H₁: μ ≠ $8 (average spending differs from target)
  • α = 0.05 (two-tailed test)

2. Calculate Sample Statistics

  • Sample mean (x̄) = $8.67
  • Sample standard deviation (s) = $1.42
  • Sample size (n) = 15

3. Compute the t-Statistic

t = (x̄ - μ₀) / (s / √n) t = (8.67 - 8.00) / (1.42 / √15) t = 0.67 / 0.367 t = 1.83

4. Find the Critical Value

With df = 14 and α = 0.05 (two-tailed), the critical value is ±2.145

5. Make Your Decision

Since |1.83| < 2.145, we fail to reject H₀. The p-value is approximately 0.089, which exceeds 0.05.

6. Interpret

There is insufficient evidence to conclude that average customer spending differs from $8. While our sample average is slightly higher, this difference could reasonably occur by chance.

Key Takeaway: A complete one-sample t-test involves stating hypotheses, calculating the t-statistic from sample data, comparing it to critical values (or using p-values), and making a practical decision about whether your sample provides sufficient evidence against the null hypothesis.