# Is testing the equality of two distributions different from testing the equality of two means?

This is a very naive question: I am confused on how people test the equality of two means and two distributions.

Say that I collected the means of two populations and I wanted to test whether they were statistically different from one another.

From my perspective, testing whether two distributions are equivalent would also test whether two means are equivalent in the process.

That is, if two distributions were the same, then their means would be the same as well. Is there a difference between testing the equality of two means and testing the equality of two distributions?

That is, if two distributions were the same, then their means would be the same as well.

Correct (assuming means exist), equality of distributions implies equality of means.

So if you're doing some hypothesis test where, under the null (and given any additional assumptions) the distributions are the same, the means will be the same.

But be careful; the implication doesn't go in the reverse direction.

Is there a difference between testing the equality of two means and testing the equality of two distributions?

Certainly! You need to consider what's going on with the alternative.

Imagine for example that under the null I have equality of distribution and then under my alternative the spreads can differ but the means remains the same. (To put it more carefully, the equality of location would be one of the assumptions rather than actually in the alternative)

Imagine that under the null both densities look like the black one below... ... but under the alternative one of them becomes more concentrated about the common mean, like the blue one.

There are a variety of possible test statistics for such a case, but most would be of little use as a test of equality of means.

You are correct in your statement that two equal distributions will produce the same expectation value (the mean in the limit of infinite sample size). That's because the expectation value is just the first moment of said distribution. However, the distribution also has higher moments, which may differ. Therefore, two distributions with the same mean might still be different.

As an example, consider two radcally different but symmetric functions of x. They will both have a mean of zero, but depict clearly different distributions.