17.3.5.2 Algorithms (One Sample Test for Variance)


Let \sigma\,\! be the variance of samplex\,\! and \sigma_0\,\! is the hypothetical variance, this function tests the hypotheses:

H_0:\sigma = \sigma_0\,\! vs H_1:\sigma \ne \sigma_0\,\!

H_0:\sigma\le\sigma_0 vs H_1:\sigma > \sigma_0\,\!

H_0:\sigma\ge\sigma_0 vs H_1:\sigma < \sigma_0\,\!

Test Statistics

To compare the variance, we firstly compute the Chi-square value by:

x^2=\frac{(n-1)s^2}{\sigma_0^2}

where s^2\,\! is the sample variance. For a given significance level, \alpha\,\!, we will reject the null hypothesis H_0\,\! when:

|x^2| \ne \chi_{\alpha/2}^2\,\!, for two tailed test

x^2>\chi_\alpha^2, for upper tailed test

x^2<\chi_{1-\alpha}^2, for lower tailed test

Confidence Intervals

And the confidence interval for the sample variance can be generated by:

Null Hypothesis Confidence Interval
H_0:\sigma = \sigma_0\,\! \sqrt{\frac{(n-1)s^2}{\chi_{(\alpha/2,n-1)}^2}} \le \sigma \le \sqrt{\frac{(n-1)s^2}{\chi_{(1-\alpha/2,n-1)}^2}}
H_0:\sigma\le\sigma_0 \sqrt{\frac{(n-1)s^2}{\chi_{(\alpha,n-1)}^2}} \le \sigma \le \infty
H_0:\sigma\ge\sigma_0 0 \le \sigma \le \sqrt{\frac{(n-1)s^2}{\chi_{(1-\alpha,n-1)}^2}}