The Two-Sample Behrens-Fisher Problem: Comparing Means under Unequal Variances
Comparing the means of two independent groups is a standard task in agricultural and biological research. When the data meet the assumptions of normality and equal variances (homoscedasticity) across both groups, the pooled two-sample Student’s t-test works well. However, in practice, variances are rarely equal. This scenario, where group variances are unknown and unequal (heteroscedasticity), leads to the Behrens-Fisher problem. Applying a pooled t-test under unequal variances, especially when sample sizes also differ, alters the Type I error rate and leads to incorrect statistical conclusions.
This guide explains the mathematical formulation of the Behrens-Fisher problem, the failure of the standard pooled t-test, the Welch-Satterthwaite and Cochran-Cox approximations, and real-life agricultural examples. We also provide Python and R implementations for analysis.
1. Mathematical Formulation of the Behrens-Fisher Problem
Let X11, X12, …, X1n1 be a random sample of size n1 from a normal distribution with mean μ1 and variance σ12. Let X21, X22, …, X2n2 be an independent random sample of size n2 from a normal distribution with mean μ2 and variance σ22:
X1i ~ N(μ1, σ12), i = 1, …, n1
X2j ~ N(μ2, σ22), j = 1, …, n2
The four parameters (μ1, μ2, σ12, σ22) are unknown. We want to test the null hypothesis that the population means are equal against the alternative hypothesis that they differ:
H0: μ1 – μ2 = 0 vs. H1: μ1 – μ2 ≠ 0
When the population variances are equal (σ12 = σ22 = σ2), the standard Student’s t-test statistic is:
t = (X̄1 – X̄2) / √[ sp2 (1/n1 + 1/n2) ]
Where X̄1 and X̄2 are the sample means, and sp2 is the pooled sample variance:
sp2 = [ (n1 – 1)s12 + (n2 – 1)s22 ] / (n1 + n2 – 2)
Here, s12 and s22 are the sample variances. Under the null hypothesis, t follows Student’s t-distribution with n1 + n2 – 2 degrees of freedom. This distribution is independent of the parameter values.
When σ12 ≠ σ22, the pooled variance sp2 is a biased estimator of the variance of the difference between the means. The ratio of the unknown variances, θ = σ12 / σ22, functions as a nuisance parameter. In classical frequentist statistics, no exact test exists where the test statistic follows a standard probability distribution independent of θ for finite samples. This mathematical difficulty is known as the Behrens-Fisher problem.
2. Consequences of Ignoring the Behrens-Fisher Problem
Ignoring unequal variances and using the pooled t-test leads to incorrect rates of Type I error (rejecting a true null hypothesis). The severity depends on the relation between sample sizes and variances:
- Equal Sample Sizes (n1 = n2): The pooled t-test is relatively robust. The actual Type I error rate remains close to the nominal level (e.g., 5%), though it slightly exceeds it as the variance ratio increases. However, the test suffers a minor loss of power compared to tests designed for unequal variances.
- Larger Variance in the Smaller Sample (n1 < n2 and σ12 > σ22): The pooled variance estimator understates the true variance of the mean difference. The calculated t-value is artificially inflated, causing the actual Type I error rate to exceed the nominal level. A nominal 5% test can have an actual Type I error rate of 15% or higher, leading to excessive false positives.
- Larger Variance in the Larger Sample (n1 < n2 and σ12 < σ22): The pooled variance estimator overstates the true variance. The test statistic is biased toward zero, making the test conservative. The actual Type I error rate falls below the nominal level (often under 2%), reducing the statistical power to detect real differences.
To avoid these errors, researchers must determine proper sample sizes using structured approaches, which can be evaluated with resources like a sample size calculator or detailed studies of sample size determination formulas.
3. Key Statistical Approximations
Because no exact frequentist solution exists, statisticians use approximations. The two most common frequentist methods are Welch’s t-test and Cochran’s approximation. The classic Bayesian/Fiducial approach is also noted.
Welch’s t-Test (Welch-Satterthwaite Approximation)
Welch (1938) proposed modifying the test statistic and adjusting the degrees of freedom. The Welch t-statistic is defined as:
t’ = (X̄1 – X̄2) / √[ s12/n1 + s22/n2 ]
Instead of using the pooled variance, this statistic uses the sum of the estimated variances of the individual sample means. The distribution of t’ is approximated by Student’s t-distribution with degrees of freedom ν, calculated using the Welch-Satterthwaite equation:
ν = [ (s12/n1 + s22/n2)2 ] / [ (s12/n1)2 / (n1 – 1) + (s22/n2)2 / (n2 – 1) ]
The calculated degrees of freedom ν is generally not an integer and is bounded by:
min(n1 – 1, n2 – 1) ≤ ν ≤ n1 + n2 – 2
When the variances are unequal, ν falls below n1 + n2 – 2. If one sample variance is much larger than the other, ν approaches the degrees of freedom of that single group. This reduction in degrees of freedom increases the critical value, controlling the Type I error rate near the nominal level.
Cochran’s Approximation (Cochran-Cox Test)
Cochran and Cox (1950) proposed an alternative method. Instead of adjusting the degrees of freedom, they adjust the critical value of the test. The test statistic remains the same as in Welch’s t-test (t’). However, the critical value at significance level α is calculated as a weighted average of the critical values of the individual groups:
tc = (w1 t1 + w2 t2) / (w1 + w2)
Where:
- w1 = s12 / n1
- w2 = s22 / n2
- t1 is the critical value of Student’s t-distribution with n1 – 1 degrees of freedom at level α.
- t2 is the critical value of Student’s t-distribution with n2 – 1 degrees of freedom at level α.
We reject the null hypothesis if |t’| > tc. Cochran’s approximation is conservative, keeping the actual Type I error rate at or below the nominal level α.
The Behrens-Fisher Fiducial Solution
Behrens (1929) derived a distribution for the test statistic using fiducial probability, which was later developed by Fisher (1935). The fiducial approach treats the parameter values as random variables based on the observed data. The resulting Behrens-Fisher distribution depends on the sample sizes and the angle φ, where tan2(φ) = (s12/n1) / (s22/n2). While mathematically distinct from frequentist probability, tables of this distribution allow testing. Today, Welch’s t-test is more widely used because it behaves well under frequentist evaluations.
4. Real-Life Agricultural Examples
To illustrate the calculations, we present two agricultural research examples. The first example features unequal sample sizes and unequal variances, and the second features equal sample sizes with unequal variances. Both analyses are detailed in the textbook Elements of Statistics for Agriculture and Forestry co-authored by B.K. Hooda.
Example 1: Crop Yields under Drip vs. Flood Irrigation
An agronomist compares the yield of a wheat cultivar under two irrigation methods. Drip irrigation is applied to 10 plots, and flood irrigation is applied to 15 plots. Drip irrigation provides controlled conditions, resulting in low variation. Flood irrigation leads to higher variation across plots. The yields (in tons per hectare) are recorded in Table 1.
| Plot No. | Drip Irrigation Yield (tons/ha) | Flood Irrigation Yield (tons/ha) |
|---|---|---|
| 1 | 6.2 | 5.1 |
| 2 | 6.5 | 5.8 |
| 3 | 6.1 | 4.9 |
| 4 | 6.4 | 6.2 |
| 5 | 6.3 | 5.5 |
| 6 | 6.2 | 5.0 |
| 7 | 6.6 | 6.0 |
| 8 | 6.3 | 5.3 |
| 9 | 6.1 | 4.8 |
| 10 | 6.3 | 5.7 |
| 11 | – | 5.2 |
| 12 | – | 5.9 |
| 13 | – | 5.1 |
| 14 | – | 5.6 |
| 15 | – | 5.4 |
Table 2 shows the summary statistics calculated from the raw yield values.
| Statistic | Drip Irrigation (Group 1) | Flood Irrigation (Group 2) |
|---|---|---|
| Sample Size (n) | 10 | 15 |
| Sample Mean (X̄) | 6.3000 | 5.4333 |
| Sample Variance (s2) | 0.0267 | 0.1810 |
| Standard Deviation (s) | 0.1633 | 0.4254 |
The variance for Group 2 is approximately 6.8 times larger than that of Group 1. The sample sizes are also unequal. This requires applying Welch’s t-test.
Step 1: Calculate the test statistic t’
t’ = (6.3000 – 5.4333) / √[ 0.02667/10 + 0.18095/15 ]
t’ = 0.8667 / √[ 0.00267 + 0.01206 ] = 0.8667 / √[ 0.01473 ] = 0.8667 / 0.1214 = 7.141
Step 2: Calculate the Welch-Satterthwaite degrees of freedom ν
ν = [ (0.00267 + 0.01206)2 ] / [ (0.00267)2 / 9 + (0.01206)2 / 14 ]
ν = [ 0.014732 ] / [ 0.00000711 / 9 + 0.00014552 / 14 ]
ν = 0.0002170 / [ 0.00000079 + 0.00001039 ] = 0.0002170 / 0.00001118 = 19.40
Rounding down to 19 degrees of freedom, the critical value of Student’s t-distribution at significance level α = 0.05 (two-tailed) is 2.093. Since |t’| = 7.141 > 2.093, we reject the null hypothesis of equal yields.
Cochran-Cox Test Comparison:
For α = 0.05, the critical values are t1 = 2.262 (for 9 df) and t2 = 2.145 (for 14 df). The weights are w1 = 0.00267 and w2 = 0.01206. The Cochran-Cox critical value is:
tc = [ (0.00267 × 2.262) + (0.01206 × 2.145) ] / [ 0.00267 + 0.01206 ]
tc = [ 0.00604 + 0.02587 ] / 0.01473 = 0.03191 / 0.01473 = 2.166
Since |t’| = 7.141 > 2.166, we reject the null hypothesis, confirming a statistical difference in wheat yields between the two irrigation methods.
Example 2: Milk Yield in Cows Fed with Different Supplements
A dairy scientist evaluates two feed supplements (Formula X and Formula Y) on daily milk yield. Twelve cows are assigned to Formula X, and twelve to Formula Y. The daily yields (in liters per cow) are shown in Table 3.
| Cow No. | Formula X Yield (L/day) | Formula Y Yield (L/day) |
|---|---|---|
| 1 | 14.2 | 12.5 |
| 2 | 13.8 | 15.2 |
| 3 | 14.5 | 11.8 |
| 4 | 14.1 | 16.1 |
| 5 | 13.9 | 13.0 |
| 6 | 14.3 | 14.8 |
| 7 | 14.0 | 12.1 |
| 8 | 14.4 | 15.5 |
| 9 | 13.7 | 13.5 |
| 10 | 14.2 | 14.2 |
| 11 | 14.1 | 12.8 |
| 12 | 14.0 | 15.0 |
Table 4 lists the summary statistics computed from these values.
| Statistic | Formula X (Group 1) | Formula Y (Group 2) |
|---|---|---|
| Sample Size (n) | 12 | 12 |
| Sample Mean (Ȳ) | 14.1000 | 13.8750 |
| Sample Variance (s2) | 0.0564 | 2.0893 |
| Standard Deviation (s) | 0.2374 | 1.4454 |
The variance of Group 2 is approximately 37 times larger than that of Group 1. The sample sizes are equal (n1 = σ2 = 12). Although equal sample sizes make the pooled t-test robust against Type I error rate inflation, the large variance difference still warrants Welch’s t-test for correct degrees of freedom calculations.
Step 1: Calculate the test statistic t’
t’ = (14.1000 – 13.8750) / √[ 0.05636/12 + 2.08932/12 ]
t’ = 0.2250 / √[ 0.00470 + 0.17411 ] = 0.2250 / √[ 0.17881 ] = 0.2250 / 0.4229 = 0.532
Step 2: Calculate the degrees of freedom ν
ν = [ (0.00470 + 0.17411)2 ] / [ (0.00470)2 / 11 + (0.17411)2 / 11 ]
ν = 0.03197 / [ 0.00002206 / 11 + 0.030314 / 11 ]
ν = 0.03197 / [ 0.00000201 + 0.00275582 ] = 0.03197 / 0.0027578 = 11.59
Rounding down to 11 degrees of freedom, the critical value of Student’s t-distribution for α = 0.05 (two-tailed) is 2.201. Since |t’| = 0.532 < 2.201, we fail to reject the null hypothesis of equal means. The difference in daily milk yields between supplements is not statistically significant.
Notice how the degrees of freedom decreases from n1 + n2 – 2 = 22 to 11.59. The high variance of Group 2 dominates the variance of the difference between means. Consequently, the degrees of freedom drops near n2 – 1 = 11, illustrating Welch’s correction.
5. R and Python Implementation
Modern statistical packages compute Welch’s t-test by default when comparing two independent groups. Here are the scripts to analyze the data from Example 1.
R Implementation
In R, the `t.test()` function performs Welch’s t-test by default (`var.equal = FALSE`):
# Input raw data for Example 1 drip_yield <- c(6.2, 6.5, 6.1, 6.4, 6.3, 6.2, 6.6, 6.3, 6.1, 6.3) flood_yield <- c(5.1, 5.8, 4.9, 6.2, 5.5, 5.0, 6.0, 5.3, 4.8, 5.7, 5.2, 5.9, 5.1, 5.6, 5.4) # Execute Welch's t-test (default option) welch_result <- t.test(drip_yield, flood_yield, var.equal = FALSE) # Display results print(welch_result)
Python Implementation
In Python, the `ttest_ind` function from `scipy.stats` executes Welch's t-test by setting `equal_var=False`:
import numpy as np
from scipy import stats
# Input raw data for Example 1
drip_yield = np.array([6.2, 6.5, 6.1, 6.4, 6.3, 6.2, 6.6, 6.3, 6.1, 6.3])
flood_yield = np.array([5.1, 5.8, 4.9, 6.2, 5.5, 5.0, 6.0, 5.3, 4.8, 5.7, 5.2, 5.9, 5.1, 5.6, 5.4])
# Execute Welch's t-test (equal_var=False)
t_stat, p_val = stats.ttest_ind(drip_yield, flood_yield, equal_var=False)
# Calculate Welch-Satterthwaite degrees of freedom
v1 = np.var(drip_yield, ddof=1)
v2 = np.var(flood_yield, ddof=1)
n1 = len(drip_yield)
n2 = len(flood_yield)
se1 = v1 / n1
se2 = v2 / n2
df = (se1 + se2)**2 / ((se1**2 / (n1 - 1)) + (se2**2 / (n2 - 1)))
print(f"Welch t-statistic: {t_stat:.4f}")
print(f"P-value: {p_val:.4e}")
print(f"Welch Degrees of Freedom: {df:.4f}")
6. Conclusion and Recommendations
The two-sample Behrens-Fisher problem highlights the importance of checking statistical assumptions before drawing conclusions. Relying on the standard pooled t-test under unequal variances alters Type I error rates, leading to false discoveries or missed findings. When variances differ, Welch's t-test or Cochran's approximation should be used to protect the integrity of the analysis.
Dr. B.K. Hooda
Professor of Statistics & Head, Dept. of Mathematics & Statistics, CCS HAU Hisar.