The F-statistic is a ratio of random variables from the [[chi-squared distribution]] each divided by its [[degrees of freedom]] given by
$F = \frac{[(n_1-1)S^2_1/\sigma^2_1]/(n_1 -1)}{[(n_2-1)S^2_2/\sigma^2_2]/(n_2 -1)} = \frac{\sigma_2^2}{\sigma_1^2}*\frac{S_1^2}{S_2^2}$
The F-statistic has the [[F-distribution]] with $n_1 - 1$ and $n_2 - 1$ degrees of freedom.
$F \sim F(n_1 - 1, \ n_2 - 1)$
Note that $\sigma^2$ and $S^2$ in the numerator are from the second and first random variable, and conversely the first and second in the denominator. If you flip the ratios of the F-statistic, the new F-statistic has the distribution $F \sim(n_2 - 1, n_1 -1)$. By convention, formulate the ratio such that the ratio $\frac{S_1^2}{S_2^2}$ is greater than $1$. This allows for a one tail test as opposed to a two tail test in [[hypothesis testing]] because you know the [[rejection region]] will be in the upper tail.
## Example
We want to calculate a confidence interval for the difference in means given two samples. First, we need to confirm that the variances of the two populations are equal to use a [[pooled variance]].
Let's find a $99\%$ confidence interval for the ratio $\sigma^2_1/\sigma^2_2$.
The sample sizes are 18 and 15 and the variances are 15.3 and 19.7, respectively.
The [[F-statistic]] is
$F = \frac{15.3}{19.7}* \frac{\sigma_2^2}{\sigma_1^2}$
The critical values from the [[F-distribution]] are `qf(0.005, 17, 14)` = $4.1592$ and `qf(.995, 17, 14)` = $0.2601$.
Putting the f-statistic between critical values we have
$0.2601 < \frac{15.3}{19.7}* \frac{\sigma_2^2}{\sigma_1^2} < 4.1592$
Which solves to a confidence interval of
$(0.187, 2.986)$
Thus, it is plausible that the variances are equivalent because the interval includes $1$. We can continue using the pooled variance.