Two Sample Hypothesis Testing to Compare Variances

Theorem 1 of F Distribution can be used to test whether the variances of two populations are equal, using the Excel functions and tools which follows. In order to deal exclusively with the right tail of the distribution, when taking ratios of sample variances from the theorem we should put the larger variance in the numerator of

image870

In order to use this test, the following must hold:

  • Both populations are normally distributed
  • Both samples are drawn independently from each other.
  • Within each sample, the observations are sampled randomly and independently of each other.

Excel Functions: The following Excel function can be used to carry out this test:

FTEST(R1, R2) = two-tailed F-test comparing the variances of the samples in ranges R1 and R2 = the two-tailed probability that the variance of the data in ranges R1 and R2 are not significantly different.

Thus FTEST(R1, R2) = 2 ∙ FDIST(x, df1, df2) where df1 = the number of elements in R1 – 1, df= the number of elements in R2 – 1 and x = var1 / var2 where var1 is the variance of the data in range R1 and var2 = the variance of the data in range R2. FTEST is a two-tail test, while FDIST and FINV are one-tailed.

Also FTEST(R1, R2) = FDIST(x, df1, df2) + FDIST(1/x, df2, df1), i.e. the sum of the right tail starting from x and the left tail starting from 1/x. This is true since FDIST(1/x, df2, df1) = 1 − FDIST(x, df1, df2).

This function ignores all empty and non-numeric cells.

Excel 2010/2013 also provide a new function F.TEST which is equivalent to FTEST (see Built-in Statistical Functions).

In addition Excel provides an F-Test Two-Sample for Variances data analysis tool which automates the process of comparing two variances.

Example 1: A company is comparing methods for producing pipes and wants to choose the method with the least variability. It has taken a sample of the lengths of the pipes using both methods as shown on the left side of Figure 1.

Compare variances Excel

Figure 1 – Excel’s two sample F-test to compare variances

We test the following null hypothesis:

H0: σ1 – σ2 = 0 (equivalently: σ1 = σ2; i.e. both methods have the same variability)

and use the statistic image5029 with 11, 14 degrees of freedom, as described on the right side of Figure 1. Since this is a two-tail test, we note that

p-value = 2 * FDIST(F, df1, df2) = 2 * FDIST(1.85, 11, 14) = 0.279 > 0.05 = α

F-crit = FINV(α/2, df1, df2) = FINV(.025, 11, 14) = 3.09 > 1.85 = F

Either of the above tests shows there is no significant difference in the variance between the two methods with 95% confidence. Note that we needed to double the value for FDIST or halve α since this is a two-tail test.

Alternatively we can use FTEST which is a two-tail test:

         FTEST(A4:A18, B4:B18) = .279 > 0.05 = α

We can also use the F-Test Two-Sample for Variances data analysis tool:

F data analysis Excel

Figure 2 – Comparing variances using Excel’s data analysis tool

This tool only performs a one-tail test, and so the p-value (0.1393) needs to be doubled to get 0.279, which is the same value we calculated in Figure 1. The critical value for F is calculated based on α = .05.

16 Responses to Two Sample Hypothesis Testing to Compare Variances

  1. Lotte says:

    Hello Charles,

    Do you know how I should report this F value in APA style?
    I’m currently using
    F(n1-1,n2-1) = ___, p = ___
    but I’m not sure if this is correct.

    Maybe I should use the ANOVA way of reporting (i.e. F(k-1,N-k) = ___, p = ___; with k being the number of groups)? Or use something entirely different (like F = x, p(f>x) = __)?
    The APA manual and Google aren’t very helpful thus far, so I hope you know what to do.

    Lotte

    • Charles says:

      Lotte,
      Sorry, but I am not sure of the response, but I would use the ANOVA way of reporting, but with the correct values for the comparison of variances (as described on the referenced webpage).
      Charles

  2. Kristian Mamforte says:

    Hi Charles, I think you meant FDIST(1/x, df2, df1) + FDIST(x, df1, df2) = 1 and not FDIST(1/x, df2, df1) = FDIST(x, df1, df2).

  3. Niladri Biswas says:

    Will you please solve this problem??
    “For a random sample of 10 pigs fade on diet A the increase in weights in a certain periods was: 10, 6, 16, 17, 13, 12, 8, 14, 15 and 9. For another random sample of 12 pigs fade on diet B, the increase in the same period were 7, 13, 22, 15, 12, 14, 18, 8, 21, 23, 10, 17. Show that the estimate of the population variance from sample does not differ significantly.”

  4. Norm says:

    Charles,

    Can you explain the notation P(F<=f) one-tail? I understand that this is the area under curve in the upper tail, but the value doesn't change when I re-run the test with different alphas for the same two populations (F-crit, however, does change).

    Norm

    • Charles says:

      Norm,

      If you are referring to Figure 2 then it is important to note that Excel’s data analysis tool only uses an alpha value of .05.

      If you are referring to Figure 1, then you are correct that the p-value does not depend on alpha, whereas F-crit does depend on alpha. In any case alpha enters into the picture since you are typically testing whether p-value < alpha (or equivalently whether F > F-crit).

      See Hypothesis Testing for more details about this.

      Charles

      • Norm says:

        Charles,

        Thank you. It’s curious that the F-test for two population variances in the Analysis Pak allows you to enter other alpha values in the dialogue box when it only calculates at .05. Thank you for that tip. I’m still confused about the notation for the p-value – “P(F<=f) one-tail."

        Is "f" the value that you calculate based on the d.f., sample variance, and hypothesized variance? If that's true, does it mean the p-value for when "f" is less than or equal to Fcrit? It's not explained in any literature on Excel's F-test.

        Thanks again,

        Norm

        • Charles says:

          Norm,
          Sorry, but I gave you the wrong information. Excel’s data analysis tool does take the value you enter for alpha into account. In the term P(F < f), you need to interpret F as the random variable and f as the value of that random variable. Essentially, P(F < f) is the one-tailed p-value. To get the two-tailed p-value you need to double the value presented. This is not the p-value for when "f" is less than or equal to Fcrit. That value is alpha (or alpha/2 for the two-tailed test). For more information as to the meaning of the p-value, see Hypothesis Testing.
          Charles

  5. FelixM says:

    Dear Dr. Zaiontz,
    thanks for your valuable contributions to understand different statistical methods and your information on how to use them in Excel.
    I’m not quite sure about the interpretation of the results of the F test. As you state, Excel functions FTest or F.Test give “the two-tailed probability that the variance of the data in ranges R1 and R2 are not significantly different”. On the other hand, in example 1, it is said that a p value = 0.279 > alpha, among others, “shows there is no significant difference in the variance between the two methods with 95% confidence”. To my understanding, according to the first statement, there is only a 27.9% probability that the variances are not significantly different.
    I would like to confirm equality of variances as a precondition to do a two sample t test. Now, is it sufficient to check whether p value (of F test) > alpha?

  6. saranya says:

    dose % structural aberrations
    negative control 2
    negative control 2
    solvent control-1 5
    solvent control-1 6

    what test can be applied to this data

  7. Roslina Zakaria says:

    Well explained. You really help me to understand Excel.

    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>