# F Test

## Introduction

An F test is a statistical test which uses the F distribution for the null hypothesis. So, for example, ANOVA is actually one of F tests. But in many cases, an F test refers to a statistical test which is testing the equality (or homogenity) of two variances. In this page, I also refer an F test to such a test.

Unfortunately, an F test is now considered a less robust test for testing the equality of two variances. One reason for this is because an F-test is known to be very sensitive to non-normality.** To address this problem, people use other tests like Levene's test or Bartlett's test for checking of the homogenity of the variances**. Nonetheless, understanding an F test is still beneficial for statistics beginners because it is closely related to other kinds of common statistical test, such as a t test and an ANOVA test.

The basic idea of an F test is to look at the ratio of the two variances calculated from your sampled data. And it has the null hypothesis such that **two normal populations have the same variances**. Please keep in mind that the test cares about the variances of the populations, not the ones of the sampled data. If the ratio (which is called F value) is too extreme, you will reject the null hypothesis, and say that you find a significant difference. That's pretty much it. It's quite simple, eh? :) But the idea of F value–**taking a ratio of two values and checking whether it is extreme or not**–is a key concept in ANOVA and regression. So remember this point.

## R code example

First, prepare the data.

value <- c(1,1,2,3,1,3,2,4,1,2,6,5,1,3,5,1,2,3,4)
group <- c(0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1)
data <- data.frame(group, value)
And, run an F test.

var.test(data[data["group"]==0,2], data[data['group']==1,2])
Then, you get the result.

F test to compare two variances
data: data[data["group"] == 0, 2] and data[data["group"] == 1, 2]
F = 0.3419, num df = 9, denom df = 8, p-value = 0.1306
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.07846272 1.40237802
sample estimates:
ratio of variances
0.3418803
As you can see here, you have two dfs (degrees of freedom; DOFs): The DOF for the numerator and DOF for the denominator. As I said above, an F test is using the ratio of the variances, which is also shown as “ration of variances”. This is why you have two DOFs. And it is exactly the same as the F value. In this example, the p value is 0.13, so our F value is not extreme enough to say that we have a difference in the two variances.

## How to report

You can report the result of an F test like:

**An F test did not reveal a significant difference in the variances of the two groups (F(9,8) = 0.34, p=0.13).**

You need to report the F value and p value.

## Comments