# How to test for equal spread in bivariate normal samples with equal means?

I'm working with samples taken from a bivariate normal distribution, where the differences in means is not relevant since all samples are scaled to mean (0,0) anyway, and I'm trying to remember how to test the null hypothesis that the two samples were drawn from the same distribution. In other words, say I draw n samples $$(x_{a,1}, ..., x_{a,n})$$ from $$X_a \sim N((0,0), \Sigma_a)$$ and n samples $$(x_{b,1}, ..., x_{b,n})$$ from $$X_b \sim N((0,0), \Sigma_b)$$. How do I test the null hypothesis $$H_o: \Sigma_a = \Sigma_b$$?

I think this would be an F-test in the univariate case, but it's been a long time since I took statistics and I'm having trouble figuring out the multivariate generalization.

• FWIW, "$X_a=X_b$" is not a hypothesis, nor can it be tested. Presumably you want a simultaneous test for equality of the variances and the correlation coefficient.
– whuber
Commented Apr 10 at 19:04
• Thank you. My statistical notation is a bit rusty, as you can tell. What's the preferred notation to express that the two are identically distributed? $X_a \sim X_b$ somehow doesn't feel right, but perhaps that's the normal way to express it? Commented Apr 10 at 20:42
• You did well with your statement of $H_0.$ There's no need to rephrase it.
– whuber
Commented Apr 10 at 20:44
• Edited accordingly. Thanks again! Commented Apr 10 at 20:45
• sciencedirect.com/science/article/pii/S0047259X08001474 may be helpful here; if you are sure of the bivariate Normality, and have a moderate to large sample size, Box's M-test is, I believe, the way to go. Commented Apr 20 at 18:26

Box's M-test, described below, would do the job but is extremely sensitive to non-normality. It's a multivariate extension of Bartlett's test for homogeneity of variance.

In its most general form, let's assume we are testing for the equality of $$m$$ $$k \times k$$ covariance matrices: $$H_0: \Sigma_1 = \Sigma_2 = \dots = \Sigma_m$$. We have $$m$$ sample covariance matrices $$S_1, \dots, S_m$$ with observation counts $$n_1, \dots, n_m$$. The total number of observations is $$n = \sum n_i$$.

Define the pooled covariance matrix $$S$$:

$$S = {1 \over n-m}\sum_{i=1}^m (n_i-1)S_i$$

with appropriate adjustments if we somehow knew the population means.

Now define:

$$M = (n-m)\ln|S| - \sum_{i=1}^m(n_i-1)\ln |S_j|$$

and

$$c = {2k^2+3k-1\over 6(k+1)(m-1)}\sum_{i=1}^m\left({1 \over n_j-1}-{1\over n-m}\right)$$

Then:

$$M(1-c) \sim \chi^2\left({k(k+1)(m-1)\over 2}\right)$$

well, approximately at any rate.

This appears to work reasonably well for $$m \leq 5$$, $$k \leq 5$$ and the $$n_i \geq 20$$, so far as I've been able to discover. It's implemented in the heplots R package as boxM. There's a more complex version, still based on the log determinants, that has an approximate $$F$$ distribution, that appears to be better. Of course, bootstrapping the $$M-$$statistic is also an option!

This paper: Optimal tests of homogeneity of covariance, scale, and shape is also of interest.

• Thanks jbowman. I marked this as the accepted answer since it has an associated R package. I also detailed a simpler test in my answer below, which I found in an old Army publication. It accomplishes the same conceptual goal, but it doesn't test the null that I originally laid out per se. Commented May 1 at 19:00

I found a practical answer to my question in an old US Army statistical booklet dealing with projectile accuracy. For convenience I'll rename the two samples I mentioned in the OP to $$a = \{a_1, ..., a_n\}$$ and $$b = \{b_1, ..., b_n\}$$ where $$a_i$$ is the cartesian coordinate pair $$(x_{a_i}, y_{a_i})$$ of the $$i^{th}$$ sample from distribution $$A$$.

In his 1964 booklet Statistical Measures of Accuracy for Riflemen and Missile Engineers, Frank Grubbs defines the "radial variance" of sample $$a$$ as the sum of the variances of the horizontal and vertical components of the sample: $$\sigma^2_{x_a} + \sigma^2_{y_a}$$.

The ratio of the radial variances is distributed F with 2n-2 df.

$$\frac{\sigma^2_{x_a} + \sigma^2_{y_a}}{\sigma^2_{x_b} + \sigma^2_{y_b}} \sim F_{\alpha}\left((2n-2, 2n-2)\right)$$

And with that, it's a simple F-test of the ratio of the "radial variances". I'm still digesting how this test differs in practice from the Box-M, but at least it gives me a practical option in the meantime.

• Thanks! The trouble with Grubb's solution is that it is, in effect, assuming that the covariance is zero; if a priori you are pretty sure it's zero or close to it, I'd think the F-test would be a better one than the M-test, due to its being somewhat robust to deviations from Normality. Commented May 1 at 20:27
• Can you help me understand why Grubb's method assumes no covariance and/or what goes wrong if there is covariance? (I will admit that my attempt to figure this out started with rifle accuracy, so I'm not concerned in practice if the only reason $\Sigma_A \neq \Sigma_B$ is because A is elliptical in one direction and B is elliptical in another - so long as they're all the same distance from zero. My lack of concern with this aspect is one of the main reasons I marked your Box-M as the accepted answer, because I presume others will care more about differences in covariance more than I do.) Commented May 2 at 0:55
• Actually, looking at it more carefully, it also assumes that the variances of the horizontal and vertical components are the same. To see this, consider the situation where the true variance of $y$ is 100x the true variance of $x$. In that case, the ratio would for practical purposes be equal to $s^2_{y_a}/s^2_{y_b}$, as the contribution of $x$ to the numerator and denominator would be tiny. Consequently, the ratio would have, approximately, an $F(n-1, n-1)$ distribution. Commented May 2 at 1:47
• Covariances are important too, as if the covariance between $x$ and $y$ is large and positive, for example, if $s^2_x > \sigma^2_x$, then $s^2_y$ is more likely to be $> \sigma^2_y$. In short, the sample variances aren't independent anymore, so adding them doesn't get you a $\chi^2(2n-2)$ distribution. Commented May 2 at 1:50
• Ah, OK thank you. Grubbs mentions in other areas of the same text the assumption that the horizontal and vertical variances of the underlying distributions are equal and independent, but I didn't catch that he was carrying it into this example. Thanks again! Commented May 2 at 2:04