2-Variance Test (F test, Levene, Brown-Forsythe)

Compare the spread of two groups such as machine 1 and 2 or supplier A and B. The variance ratio (group 1/group 2), its confidence interval and the p-value are shown on 6 result panels.

1Data Table

Paste a table copied from Excel into a cell (Ctrl+V). Click a column header (A, B…) before pasting to use the first line as column names. Double-click a header to rename it, right-click to insert/delete rows and columns, and formulas such as =A1*2 work too.

22-Variance Test Options

Data input
Test method

How to run a 2-variance test

  1. Copy a group name column together with a measurement column, or two columns already split by group.
  2. Choose the data input mode, set the response and group column (exactly 2 levels) or the group 1 and group 2 columns, and choose the test method.
  3. Press Analyze and check the variance ratio, p-value and decision in the test summary.

Worked example with sample data

The sample data are 20 thickness measurements (mm) each from machine 1 and machine 2. The Machine column is the group column and the Thickness column the response column.

Variance ratio plot from the 2-variance test of machine 1 and 2 thickness (ratio 0.3063 with its 95% CI)
Variance ratio plot from the 2-variance test of machine 1 and 2 thickness (ratio 0.3063 with its 95% CI)

The standard deviations are 0.09632 for machine 1 and 0.174 mm for machine 2, so machine 2 spreads almost twice as much. The F test variance ratio (machine 1/machine 2) is 0.3063, and with (19, 19) degrees of freedom the p-value is 0.01325, so the two machines have different variances.

The 95% confidence interval of the variance ratio is 0.1212 to 0.7739 and does not contain 1. In the variance ratio plot (log scale) the whole interval lies to the left of the dashed line at 1.

Testing the same data with Levene (mean-based) gives p=0.05256 and Brown-Forsythe gives p=0.1031, neither significant. Machine 2 has 2 outliers by the IQR rule, and because the F test assumes normality, the outliers may have inflated the result. Check the outliers before deciding.

Three test methods

The F test compares the variance ratio F = s1²/s2² with the F distribution with (n1-1, n2-1) degrees of freedom and also gives a confidence interval for the ratio. It assumes normality.

Levene uses the distance of each value from its group mean, and Brown-Forsythe the distance from the group median, in an analysis of variance, so they are less affected by non-normality. These two methods do not give a confidence interval for the ratio.

Group order

In the group column mode the group names are sorted and the first becomes group 1. The variance ratio is group 1/group 2, so a value below 1 means group 1 has the smaller spread.

What the result shows

A group table (N, variance, standard deviation), a test summary, a box plot by group, an individual value plot, the standard deviation of each group with a chi-square confidence interval, and a variance ratio plot (dashed line at 1).

How to read the 2-variance test result

  • If the p-value is below the significance level, the two groups have different spreads, and the interpretation tells you which group has the larger variance.
  • If the variance ratio confidence interval of the F test does not contain 1, the difference is significant.
  • If the histogram is skewed or there are outliers, also check the Brown-Forsythe result instead of the F test.

Frequently asked questions

Is it the same as Excel F.TEST?

Excel F.TEST(range1, range2) returns the two-sided F test p-value, so choosing the F test and two-sided gives the same value.

Do I need this before a t test?

Not necessarily. Welch, the default of the 2-sample t test, works with unequal variances, so the variance test is mainly used when the spread itself matters.

What if there are 3 or more groups?

Use the test for equal variances (Bartlett, Levene, Brown-Forsythe).

Other chart tools