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

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.

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 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:

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.

38 Responses to Two Sample Hypothesis Testing to Compare Variances

1. Roslina Zakaria says:

Well explained. You really help me to understand Excel.

Thank you.

• Charles says:

Rosalina, thanks very much for your comment. Charles

2. 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

• Charles says:

I’m afraid that you need to provide additional information before I can provide an answer.
Charles

3. Pingback: F-test for two-tailed?

4. 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?

5. 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).

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

6. 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.”

• Charles says:

The procedure to use is the one explained on the referenced webpage.
Charles

7. 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).

• Charles says:

Kristian,

Yes. Thanks for catching this error. I have now revised the referenced webpage.

Charles

8. 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

9. Jean-Pierre says:

Two tailed F-testing for differences in population variances. Why not put the ratio of the highest variance in the nominator and do a right one tailed testing?
Actually, the same question can be linked to differences in the population means: why not take the subtraction of the smallest from the highest sample mean and further with a one tailed t-testing?

• Charles says:

You can do these things. Typically, the left tail is tested.
Charles

10. Apurva says:

Sir I want to know that I am calculating F.inv.Rt for right tail for alpha 0.02 and it is coming exact equal to f.inv(which calculates left tail ) for 0.98 why ?

• Charles says:

Perhaps I don’t understand your question, but in general =F.INV.RT(alpha,df1,df2) yields the same value as =F.INV(1-alpha,df1,df2).
Charles

I am trying to compare 2 variables to see if they are equal. I am using the F-test in the Data Analysis Toolpack to determine the correct T-test to use (equal or unequal variances). However, when I enter the range 1 (Method 1), and range 2 (Method 2), I get one F and F Critical ouput FF Crit (dont’ reject Ho). How should the data be entered into the ranges, and does it matter? This giving me 2 decisions, to reject and the other to not reject Ho. Could you explain why this would happen and which output I should go with? Am I missing something?

• Charles says:

Are you saying that based on comparing F with alpha you get a different result from that of comparing F with F crit?
In any case, when in doubt use the t test with unequal variances. If the variances are equal, the result of this test will be very similar to the t test with equal variances.
Charles

12. Meena Sankaranarayanan says:

I just want to now why the large value must be put on the Numerator while computing the F test statistic.

I do understand F>0 since S^2 is always positive, however the above is unclear. Kindly clarify

• Charles says:

You don’t have to do this. It just makes the analysis more consistent.
Charles

13. Johan Gambol says:

Oh, look there, 3.09>1.85. Amazing! I’ll just reject my null hypothesis then. I have no idea what those numbers mean. Thanks for explaining.

• Purnur says:

Easy, 1.85 is a small number compared to the F criterion, which means that the ratio between the variances is not that large. So the two variances are close enough to each other, i.e. the difference between the variances it not significantly large.
Actually you do not reject the null hypothesis.

14. VIJI says:

WHY IS THE LARGER VARIANCE IN NUMERATOR

• Charles says:

It is really just convention. You could adjust all the tests to put the larger variance in the denominator.
Charles

• Purnur says:

You wish to see if the larger variance is SIGNIFICANTLY larger than the small variance. If this is the case, then the F-test is significantly above the standard F-distribution for those parameters.
So it makes sense to put the larger variance there.

15. Ever says:

i have age and motivational need as variables, i wanted to know if age affects the motivational need of the respondents, should i use F test?

• Charles says:

Ever,
The referenced webpage uses an F test to compare variances. Whether “age affects the motivational need of the respondents” is a different issue. You can use correlation or regression to address this issue.
Charles

16. Fatima says:

If varience is equal than which test should apply or if unknown then which test?

• Charles says:

Fatima,
What hypothesis are you trying to test?
Charles

17. Julie says:

Hello Charles,
Can you please explain the difference in a significant change in variance at the .10 level as opposed to the .05 level?
Thanks!

18. fred dormer says:

Hi Charles,

So I have a “batch” problem. At the end of every month, I receive data as 30 pairs of (X, Y).
I want to find if I can do regression on them. So, at the end of every month I do an f-test on the data for that month. In an year, I have 12 different f-test values, some below the critical level, some above.

My question is, is this a valid approach? If it is, how should I decide if the regression is meaningful (since some f-test values are below the critical level).

Thanks,
Fred

• Charles says:

Fred,
Your question is not clear to me.
What are you testing? Are you testing whether the variances for the x and y values are equal? This is not necessary for regression.
If you are performing regressions, then use the tests for regression.
Charles