One Sample Hypothesis Testing of the Variance

Based on Property 7 of Chi-square Distribution, we can use the chi-square distribution to test the variance of a distribution.

Hypothesis Test

Example 1: A company produces metal pipes of a standard length. Twenty years ago it tested its production quality and found that the lengths of the pipes produced were normally distributed with a standard deviation of 1.1 cm. They want to test whether they are still meeting this level of quality by testing a random sample of 30 pipes and finding the 95% confidence interval around σ2.

By Property 7 of Chi-square Distribution

image799

Note that since the chi-square distribution is not symmetric, the confidence interval is not symmetric around σ2, and so the approach used in Confidence Intervals for Sampling Distributions and Confidence Interval for t-test needs to be modified somewhat, in that we need to calculate the lower and upper values of the confidence interval based on different critical values of the distribution:

Upper limit = 0.042*CHISQ.INV.RT(.025, 29) = 0.042 ∙ 45.72 = 1.91

Lower limit = 0.042*CHISQ.INV.RT(.975, 29) = 0.042 ∙ 16.05 = 0.67

Thus, the confidence interval is (0.67, 1.91). We see that the variance of  (1.1)2 = 1.21 is in this range, but the sample is too small to get much precision.

One-Tail Test

Example 2: A company produces metal pipes of a standard length, and claims that the standard deviation of the length is at most 1.2 cm. One of its clients decides to test this claim by taking a sample of 25 pipes and checking their lengths. They found that the standard deviation of the sample is 1.5 cm. Does this undermine the company’s claim?

We perform a one-tail test based on the following hypotheses:

H0: the standard deviation of the pipe length is ≤ 1.2 cm
H1: the standard deviation of the pipe length is > 1.2 cm

If we assume that the population has a normal distribution then by Property 7 of Chi-square Distribution, we know that

image803

Since
image802

it follows that

p-value = CHISQ.DIST.RT(x, df) = CHISQ.DIST.RT(37.5, 24) = 0.039 < .05 = α

and so the null hypothesis is rejected, leading the client to conclude with 95% confidence that the company is no longer meeting its claimed quality standard.

Alternatively, x-crit = CHISQ.INV.RT(α, df) = CHISQ.INV.RT(.05, 24) = 36.42 < 37.5 = x and so once again the null hypothesis is rejected.

Two-Tail Test

In Example 2 we used a one-tail test. For a two-tail test, proceed as follows using the null hypothesis

H0: the standard deviation of the pipe length is = 1.2 cm

We reject the null hypothesis if either CHISQ.DIST.RT(x, df) = .039 < .025 = α/2 or CHISQ.DIST.RT(x, df) = .039 > 1 – α/2 = .975. As result, in this case, we can’t reject the null hypothesis. Alternatively, we reject the null hypothesis if either 37.5 = x > CHISQ.INV.RT(α/2, df) = CHISQ.INV.RT(.025, 24) = 39.4 or 37.5 = x < CHISQ.INV.RT(1–α/2, df) = 12.4, and so once again we cannot reject the null hypothesis in the two-tail test.

Examples Workbook

Click here to download the Excel workbook with the examples described on this webpage.

References

Zar, J. H. (2010) Biostatistical analysis 5th Ed. Pearson
https://bayesmath.com/wp-content/uploads/2021/05/Jerrold-H.-Zar-Biostatistical-Analysis-5th-Edition-Prentice-Hall-2009.pdf

NIST (2012) Chi-square test for the variance
https://www.itl.nist.gov/div898/handbook/eda/section3/eda358.htm

16 thoughts on “One Sample Hypothesis Testing of the Variance”

  1. in example 2:
    claims that the standard deviation of the length is at most 1.2 cm. at most means
    h1 : the standard deviation of the pipe length is < 1.2 cm

    Reply
    • Sam,
      You wouldn’t say H0 = 1.2. You can say
      H0: the standard deviation of the pipe length = 1.2 cm
      This would be the two tailed version of the null hypothesis.
      Charles

      Reply
    • Jesse,
      In Example 1 we are finding the confidence interval for s^2 given that we know the population variance. The calculation you are referring to finds the confidence interval for the population variance given that you know the sample variance.
      Charles

      Reply
  2. Charles:

    I am seeing an inconsistency in certain aspects of the literature concerning this test. I would like your input in this matter. In conducting a two tailed chi-squared test for a single population variance, it is clear that one computes the p value by doubling the smaller area on a side of the calculated value of the test statistic. Does one then compare that p-value to alpha or to alpha/2? I say alpha as with all other hypothesis tests. However, if one does not double the aforementioned smaller area, then I suspect that the proper comparison is to alpha/2. That said, then one should not call the non doubled area the p value, correct? You would actually be comparing p-value/2 to alpha/2 which would be a valid comparison, but you would not be using the p value per se. What do you think?

    Reply
    • Alan,
      If the p-value for the one-tail test is say .02, then for a symmetric distribution the p-value for the two-tailed test is .04, which you can compare with alpha (say .05).
      Equivalently, you can use the one-tailed p-value of .02 and compare it with alpha/2 = .025.
      This is true, for example, for the t test. You need to be careful with the chi-square distribution since it is not symmetric.
      Charles

      Reply
    • Lionel,

      You are asking for a one-tailed test. Example 2 of the referenced website shows a one-tailed test (while Example 1 shows a two-tailed test).

      Note: since variance is always a non-negative number, variance > 0 is equivalent to variance <> 0.

      Charles

      Reply
      • I have a same queation but can not find the result, I am looking for a test to test if the variability of my sample is close to zero, if i want to use chi-square test i would have zero in the denominator.!!!

        Reply
        • Parisa,
          This is a good question. I hadn’t thought about it before. Essentially zero variance means that all the data is the same (and so is equal to the mean). Thus, let w = abs(x-mean) where mean is the mean of your sample. Thus you could perform a one sample t test to see whether the w values have a mean of zero.
          Charles

          Reply
  3. Hello Charles, how do I calculate p-value for test where H0: VAR = anything; H1: VAR anything? (two tailed test). Do I have two P values?

    Reply
    • Even in a two tailed test, you only have one p-value. This single value needs to take into account both the right tail and the left tail.
      Charles

      Reply

Leave a Comment