Test Statistics
& p-Values
Learn how to quantify evidence against a null hypothesis using test statistics and interpret the probability of observing your data.
What Is Hypothesis Testing?
Hypothesis testing is a formal procedure to decide whether sample data provide enough evidence to reject a claim about a population parameter. Every test follows the same core logic:
What Is a Test Statistic?
A test statistic measures how far your sample result is from the null hypothesis value, in standardized units. The larger the absolute value, the stronger the evidence against \( H_0 \).
Think of it as a signal-to-noise ratio: the numerator is the signal (how much the data differ from \( H_0 \)) and the denominator is the noise (how much variability we expect).
What Is a p-Value?
The p-value is the probability of obtaining a test statistic at least as extreme as the one observed, assuming \( H_0 \) is true.
The \(z\)-Test Statistic
When the population standard deviation \( \sigma \) is known (or \( n \) is large), we use the \( z \)-test for a population mean:
The \(t\)-Test Statistic
When \( \sigma \) is unknown (the usual case), we estimate it with the sample standard deviation \( s \) and use the \( t \)-test:
The \( t \)-distribution has heavier tails than the standard normal, especially for small \( n \). As \( n \to \infty \), the \( t \)-distribution approaches the \( z \)-distribution.
\(z\) vs \(t\): When to Use Each
| \( z \)-Test | \( t \)-Test | |
|---|---|---|
| \( \sigma \) known? | Yes | No (use \( s \)) |
| Distribution | Standard Normal | \( t \) with \( df = n-1 \) |
| Sample size | Large \( n \geq 30 \) | Any \( n \) |
| Tails | Thinner | Heavier (wider) |
| In practice | Rare | Most common |
One-Tailed vs Two-Tailed Tests
p-value = area in both tails. Tests for any difference from \( \mu_0 \).
p-value = area in the left tail. Tests if the mean is less than \( \mu_0 \).
p-value = area in the right tail. Tests if the mean is greater than \( \mu_0 \).
How to Perform a Hypothesis Test
Significance Level \( \alpha \)
The significance level \( \alpha \) is the threshold for deciding when to reject \( H_0 \). It represents the maximum probability of a Type I error (rejecting a true \( H_0 \)) that we're willing to accept.
Example 1: \( z \)-Test
A factory claims its light bulbs last \( \mu = 1000 \) hours. A sample of \( n = 36 \) bulbs has \( \bar{x} = 985 \) hours. The population \( \sigma = 60 \) hours. Test at \( \alpha = 0.05 \) (two-tailed).
Example 2: \( t \)-Test
A teacher believes students sleep less than 8 hours. A sample of \( n = 20 \) students has \( \bar{x} = 7.4 \) hours and \( s = 1.2 \) hours. Test at \( \alpha = 0.05 \) (left-tailed).
Visualizing the \( t \)-Test Result
Example 3: Proportion Test
A company claims 80% of customers are satisfied. In a survey of \( n = 200 \), only \( \hat{p} = 0.74 \) are satisfied. Test at \( \alpha = 0.05 \) (left-tailed).
Common Mistakes
Test Statistic Summary
| Mean (\( z \)) | Mean (\( t \)) | Proportion | |
|---|---|---|---|
| Parameter | \( \mu \) | \( \mu \) | \( p \) |
| Formula | \( \frac{\bar{x}-\mu_0}{\sigma/\sqrt{n}} \) | \( \frac{\bar{x}-\mu_0}{s/\sqrt{n}} \) | \( \frac{\hat{p}-p_0}{\sqrt{\frac{p_0 q_0}{n}}} \) |
| Distribution | Normal | \( t_{n-1} \) | Normal |
| When to use | \( \sigma \) known | \( \sigma \) unknown | Categorical data |
Question 1 of 5
A researcher computes a test statistic of \( z = 2.45 \) for a two-tailed test. Using a standard normal table, \( P(Z > 2.45) \approx 0.0071 \). What is the p-value?
Question 2 of 5
A sample of \( n = 25 \) has \( \bar{x} = 52 \), \( s = 10 \), and we test \( H_0\!: \mu = 50 \). What is the test statistic?
Question 3 of 5
If the p-value of a test is 0.03 and the significance level is \( \alpha = 0.05 \), what is the correct conclusion?
Question 4 of 5
Which statement correctly describes the p-value?
Question 5 of 5
A company tests \( H_0\!: p = 0.50 \) vs \( H_a\!: p > 0.50 \) using \( n = 100 \) and finds \( \hat{p} = 0.58 \). What type of test is this, and which test statistic formula applies?