Sub topic 8
Testing Variances with Chi-Square and F
Assume you know sample variance, degrees of freedom, the chi-square distribution, and the F distribution. In CFA questions, use the chi-square test for one population variance and the F-test for comparing two population variances. Both tests assume normally distributed observations.
Chi-square test for one variance
Suppose a fund's monthly returns have population variance \(\sigma^2\). To test whether the variance equals a hypothesized value \(\sigma_0^2\), state:
- \(H0: \sigma^2 = \sigma0^2\)
- \(Ha: \sigma^2 \ne \sigma0^2\), \(\sigma^2 > \sigma0^2\), or \(\sigma^2 < \sigma0^2\)
The test statistic is:
\chi^2 = \frac{(n-1)s^2}{\sigma_0^2}Here, \(n\) is the sample size and \(s^2\) is the sample variance. The statistic has \(n-1\) degrees of freedom when the null hypothesis is true.
For a two-tailed test, divide the significance level between the two tails. Reject \(H_0\) when the statistic is too small or too large. For a one-tailed test, use only the relevant tail.
For example, if \(n=16\), \(s^2=0.0225\), and \(H_0:\sigma^2=0.01\):
\chi^2=\frac{(16-1)(0.0225)}{0.01}=33.75The test uses 15 degrees of freedom. Compare 33.75 with the appropriate chi-square critical value or calculate its p-value.
F-test for two variances
To compare two independent population variances, use:
- \(H0: \sigma1^2 = \sigma_2^2\)
- \(Ha: \sigma1^2 \ne \sigma_2^2\)
The statistic is:
F=\frac{s_1^2}{s_2^2}The numerator and denominator determine the degrees of freedom:
df_1=n_1-1,\qquad df_2=n_2-1The samples must be independent, and each population should be approximately normal. The F distribution is not symmetric, so reversing the variance ratio changes the critical values. Keep the sample labels and tail probabilities consistent.
| Test | Statistic | Degrees of freedom |
|---|---|---|
| One variance | \(\frac{(n-1)s^2}{\sigma_0^2}\) | \(n-1\) |
| Two variances | \(\frac{s_1^2}{s_2^2}\) | \(n_1-1,\ n_2-1\) |
from scipy import stats
n = 16
sample_variance = 0.0225
null_variance = 0.01
chi_square = (n - 1) * sample_variance / null_variance
p_value = 2 * min(
stats.chi2.cdf(chi_square, n - 1),
stats.chi2.sf(chi_square, n - 1),
)
print(chi_square, p_value)Exercise
A sample has n = 10 and s² = 0.04. Test H₀: σ² = 0.02. What is the chi-square statistic and its degrees of freedom?
Show answer
χ² = (10 - 1)(0.04 / 0.02) = 18. The test has 9 degrees of freedom.