Sum of averages vs average of sums

The average of the entries in a column is the sum of the entries in that column, divided by the number of entries. The number of entries is the number of rows. So the sum of the averages is the sum of all the entries in the table, divided by the number of rows.

The average of the row sums is the sum of all entries in the table divided by the number of rows, so you should get the same number either way.


Generally no is correct, it is only the same in specific cases.

ie. Generally

Sum(x) / Sum(y) not equal to Sum (x/y) / n

where n is the total entries x is row entries and y is column entries.

only true if all of the y's are equal

eg: (1/2 + 3/5)/2 = 11/20 (1+3)/(2+5) = 4/7

Where as if y is equal (1/7 + 4/7)/2 = 5/14 (1+4)/(7+7) = 5/14

PS Sorry about posting on dead thread just want it to be right for anyone else looking.


Sigh!! Found my problem -- it was a stupid "dupe error" in my code. I was looking for an error in the "average of sums" logic, but it was in the "sum of averages" logic -- referencing the wrong variable.

Well, anyway, we've demonstrated about 5 ways from Sunday that the sum of averages really IS equal to the average of sums, in case that's important to anyone in the future.

Tags:

Average