25/36
Part 4 of 6 · Few citiesLearn and do

With equal city sizes and equal arms, the clustered standard error is a fixed multiple of this one

That 0.446 against 0.452 is no coincidence. With equal city sizes and equal arms:

SEclusteredSEcity means=G−2G−1⋅N−1N−K\frac{\text{SE}_{\text{clustered}}}{\text{SE}_{\text{city means}}} = \sqrt{\frac{G - 2}{G - 1} \cdot \frac{N - 1}{N - K}}

In words: the clustered standard error is the city-means one times a factor just under 1. At 40 cities and 2,000 users the factor is 0.987.

So the sandwich is the city-means t-test in disguise. It has a slightly smaller standard error, and a slightly smaller cutoff, with G−1G - 1 degrees of freedom instead of G−2G - 2. Those two small gaps are where its extra false positives with few cities come from.

In the editor, write sandwich_factor(G, N, K=2): the factor between the two standard errors.