# Test multiple differences of means (multivariate t test)

Let's say I have a dataset with two groups (male and female), a target variable ($$y$$) and multiple features ($$X_1$$, $$X_2$$ and $$X_3$$).

gender y X1 X2 X3
m 100 39 150 12
m 120 44 180 16
f 100 22 140 14
f 150 40 169 20

I can test the hypothesis that the population means of $$X_1$$ are equal between men and women with a simple $$t$$ test.

$$H_0$$: $$\mu_{X_1}^{m} = \mu_{X_2}^{f}$$

$$H_1$$: $$\mu_{X_1}^{m} \neq \mu_{X_2}^{f}$$

I can carry out the same test for $$X_2$$ and $$X_3$$.

If I do this for every feature in my dataset, I will test each hypothesis individually. However, how can I test if all the population means are different between men and women simultaneously?

$$H_0$$: $$\begin{bmatrix} \mu_{X_1}^m - \mu_{X_1}^f = 0\\ \mu_{X_2}^m - \mu_{X_2}^f = 0\\ \mu_{X_3}^m - \mu_{X_3}^f = 0 \end{bmatrix}$$

$$H_1$$: Any other case (at least one pair of means does not hold)

• It sounds like you are looking for the multivariate T test.
– whuber
Oct 24, 2021 at 15:10
• In your first null hypothesis you compare male mean of $X_1$ to female mean of $X_2$? Is that what you want? Oct 25, 2021 at 15:06
• Yes, but also the male mean of $X_2$ vs the female mean of $X_2$. So basically, using a multivariate distribution to simultaneously test those two hypotheses. Oct 25, 2021 at 16:05
• It sounds like Hotelling's $T^2$ test is exactly what you want, though I don't see how the target variable $y$ comes up.
– Dave
Oct 25, 2021 at 16:16
• Oh, it doesn't. I just added it to make the example more relatable. Oct 25, 2021 at 16:17