Sub topic 3
The Test Statistic: How Far Is the Sample From the Null?
Assume you know the mean, variance, standard deviation, normal distribution, and basic probability. You should also be comfortable with standard errors and z-scores.
A test statistic is a standardized measure of how far a sample result is from the value stated by the null hypothesis. It compares the observed difference with the amount of sampling variation that would normally occur.
The general structure
The basic formula is:
\text{test statistic}
=
\frac{\text{sample estimate} - \text{null value}}
{\text{standard error of the estimate}}The numerator gives the direction and size of the difference. The denominator puts that difference into context. A difference of 2 units may be large when the standard error is 0.5, but small when the standard error is 10.
A large positive statistic means the estimate is well above the null value. A large negative statistic means it is well below the null value. A value near zero means the estimate is close to the null.
Example: testing one mean
Suppose the null hypothesis states that a fund's average monthly excess return is zero:
- \(H_0: \mu = 0\)
- \(H_a: \mu \ne 0\)
When the population standard deviation is unknown, use a one-sample t-statistic:
t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}Here:
- \(\bar{x}\) is the sample mean.
- \(\mu_0\) is the hypothesized population mean.
- \(s\) is the sample standard deviation.
- \(n\) is the sample size.
- \(s/\sqrt{n}\) is the estimated standard error.
- The degrees of freedom are \(n-1\).
If the population standard deviation is known, replace \(s\) with \(\sigma\) and use a z-statistic:
z = \frac{\bar{x}-\mu_0}{\sigma/\sqrt{n}}| Situation | Statistic | Reference distribution |
|---|---|---|
| Population standard deviation known | z | Standard normal |
| Population standard deviation estimated from the sample | t | t-distribution with \(n-1\) degrees of freedom |
import math
returns = [1.2, -0.4, 0.8, 2.1, -1.0, 0.5, 1.7, 0.3, -0.2, 1.1]
null_mean = 0.0
n = len(returns)
sample_mean = sum(returns) / n
sample_variance = sum((x - sample_mean) ** 2 for x in returns) / (n - 1)
sample_sd = math.sqrt(sample_variance)
standard_error = sample_sd / math.sqrt(n)
t_statistic = (sample_mean - null_mean) / standard_error
print(f"Sample mean: {sample_mean:.3f}")
print(f"t-statistic: {t_statistic:.3f}")Visual interpretation
For a two-tailed test, compare the absolute value of the statistic with the two-sided critical value. Reject the null when \(|t|\) exceeds that value. For a one-tailed test, the direction in the alternative hypothesis determines which tail matters.
The same logic applies to other parameters. For example, a regression slope is tested with:
t = \frac{b_1-\beta_{1,0}}{\operatorname{SE}(b_1)}Usually, the null value for the slope is zero.
Exercise
A sample mean is 104, the null mean is 100, and the standard error is 2. What is the test statistic?
Show answer
The statistic is (104 - 100) / 2 = 2. The sample mean is two standard errors above the null value.