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.