One situation in which exchangeability does not
hold occurs when we're testing whether means of two
groups are equal, but suspect variances may be
unequal.
To be specific, let's look at the following situation:
x1
is a sample of size $n_1 = 10$ from a normal
population with $\mu_1=100$ and $\sigma_2=10$ and
x2
is a sample of size $n_2 = 50$ from a normal
population with $\mu_2=100$ and $\sigma_2=4.$
Inappropriate pooled t test. Suppose we try to use a pooled 2-sample t test of $H_0:\mu_1=\mu_2$ vs $H_a:\mu_1\ne\mu_2.$ Then
the true rejection rate (about $36\%)$ of an alleged test at level
$\alpha=0.05=5\%$ is much larger than $5\%,$
as shown by the following simulation in R. A monumental 'false discovery' rate. The pooled test assumes the two samples are from populations with equal variances.
set.seed(2020)
pv = replicate(10^5, t.test(rnorm(10,100,20),
rnorm(50,100,4), var.eq=T)$p.val)
mean(pv <= .05)
[1] 0.35981
Welch t test, not assuming equal variances. Such situations with unequal variances validate the
preference of many statisticians for the Welch two-sample t test, which does not assume equal variances
in the two populations. The Welch test (with intended $\alpha=5\%)$ has a true
significance level very nearly $5\%.$
set.seed(2020)
pv = replicate(10^5, t.test(rnorm(10,100,20),
rnorm(50,100,4))$p.val)
mean(pv <= .05)
[1] 0.05056
Flawed permutation test with non-exchangeable samples. A permutation test using the difference in sample
means as metric is no 'cure' for lack of exchangeability caused by heteroscedasticity.
set.seed(620)
m = 10^5; pv = numeric(m)
for(i in 1:m) {
x1 = rnorm(10, 100, 20); x2 = rnorm(50, 100, 5)
x = c(x1, x2)
d.obs = mean(x[1:10]) - mean(x[11:60])
for(j in 1:2000) {
x.prm = sample(x)
d.prm[j] = mean(x.prm[1:10]-x.prm[11:60]) }
pv[i] = mean(abs(d.prm) >= abs(d.obs))
}
mean(pv <= .05)
[1] 0.3634
So the rejection rate of the permutation test, with
difference in means as its metric and an intended $\alpha = 0.05,$ is about as high
as for the pooled t test.
Note: A permutation test with the Welch t statistic as metric treats samples with unequal variances as exchangeable (even if data may not be normal). Its significance level would be substantially correct.