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)

  • 2
    $\begingroup$ It sounds like you are looking for the multivariate T test. $\endgroup$
    – whuber
    Oct 24, 2021 at 15:10
  • $\begingroup$ In your first null hypothesis you compare male mean of $X_1$ to female mean of $X_2$? Is that what you want? $\endgroup$ Oct 25, 2021 at 15:06
  • $\begingroup$ 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. $\endgroup$
    – Arturo Sbr
    Oct 25, 2021 at 16:05
  • $\begingroup$ 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. $\endgroup$
    – Dave
    Oct 25, 2021 at 16:16
  • $\begingroup$ Oh, it doesn't. I just added it to make the example more relatable. $\endgroup$
    – Arturo Sbr
    Oct 25, 2021 at 16:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.