7
$\begingroup$

I've been fooling around with some numbers while learning R and would like to know if the following is generalizable.

When I calculated the mean of numbers 1 through 100, I got this:

> mean(1:100)
[1] 50.5

Then when I calculated the mean of equal length subsets, I got the same:

> mean25 <- mean(1:25)
> mean50 <- mean(26:50)
> mean75 <- mean(51:75)
> mean100 <- mean(76:100)
> mean(c(mean25, mean50, mean75, mean100))
[1] 50.5

As an aside, when calculating the mean of different length subsets, the mean is expectedly not the same:

> mean5 <- mean(1:5)
> mean37 <- mean(6:37)
> mean91 <- mean(38:91)
> mean100 <- mean(92:100)
> mean(c(mean5, mean37, mean91, mean100))
[1] 46.25

My question:

Would it be accurate to say the mean of equal length subsets is always equal to the mean of the set? Are there any counterexamples to this?

Thanks in advance.

$\endgroup$

1 Answer 1

7
$\begingroup$

Would it be accurate to say the mean of equal length subsets is always equal to the mean of the set?

It's always true!

Consider $n=mk$ observations, where you take $k$ mutually-exclusive groups of size $m$.

Label the observations in group $i$ as $x_{ij},\: j=1,2,...,m$.

The individual means are $\bar{x}_i = \frac{1}{m}\sum_{j=1}^m x_{ij}$.

The mean-of-means is

$\overline{\bar{x}_i} = \frac{1}{k}\sum_{i=1}^k \bar{x}_{i}$

$\hspace{.5cm}=\frac{1}{k}\sum_{i=1}^k (\frac{1}{m}\sum_{j=1}^m x_{ij})$

$\hspace{.5cm}=\frac{1}{km}\sum_{i=1}^k \sum_{j=1}^m x_{ij}$

$\hspace{.5cm}=\frac{1}{n}\sum_{i,j} x_{ij}$

which is just the overall mean of the data.

For the unequal-length case, they're also equal (that is, the mean of means equals the overall mean) if you do an appropriately weighted average when taking the mean of means.

$\endgroup$
5
  • $\begingroup$ Thank you for such a tremendously thorough answer, and I appreciate the bit about weighted means at the end as well. I'm off to explore that now! $\endgroup$
    – user60305
    Commented Dec 4, 2014 at 16:27
  • $\begingroup$ could you please clarify this last sentence ("For the unequal-length case, they're also equal (that is, the mean of means equals the overall mean) if you do an appropriately weighted average when taking the mean of means.")? The first part (equal lengths) makes sense to me. But in case of unequal lengths, they are in fact NOT the same...right? $\endgroup$
    – Tilen
    Commented Jan 5, 2020 at 11:24
  • $\begingroup$ I don't follow you. It's possible you have misunderstood the intent of the phrase "appropriately-weighted" $\endgroup$
    – Glen_b
    Commented Jan 6, 2020 at 10:43
  • $\begingroup$ That's very likely. So, could you clarify the intent of that phrase please? Many thanks. $\endgroup$
    – Tilen
    Commented Jan 6, 2020 at 13:20
  • $\begingroup$ If you take weights proportional to OP calls "length" (i.e. number of values in each subset), then the weighted average of those subset means will be the overall mean. $\endgroup$
    – Glen_b
    Commented Jan 6, 2020 at 22:54

Your Answer

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