views:

50

answers:

4

Lets say, we're calculating averages of test scores:

Starting Test Scores: 75, 80, 92, 64, 83, 99, 79

Average = 572 / 7 = 81.714...

Now given 81.714, is there a way to add a new set of test scores to "extend" this average if you don't know the initial test scores?

New Test Scores: 66, 89, 71

Average = 226 / 3 = 75.333...

Normal Average would be: 798 / 10 = 79.8

I've tried:

Avg = (OldAvg + sumOfNewScores) / (numOfNewScores + 1)

(81.714 + 226) / (3 + 1) = 76.9285

Avg = (OldAvg + NewAvg) / 2

(81.714 + 79.8) / 2 = 80.77

And neither come up the exact average that it "should" be. Is it mathematically possible to do this considering you don't know the initial values?

+7  A: 

You have to know the number of test scores in the original set and the old average:

newAve = ((oldAve*oldNumPoints) + x)/(oldNumPoints+1)
duffymo
+3  A: 

Say, you have 2 blocks of scores:

1st: n scores with average = a1 
2nd: m scores with average = a2

then average of total scores equals:

a1*(1.0*n/(m+n))+a2*(1.0*m/(m+n))

In case you want just add 1 score (a2) to existing set formula becomes

a1*(n/(n+1))+ a2/(n+1)
Vladimir
A: 

Actually it appears that what I'm trying to accomplish is called a rolling average or a moving average and my second equation was right:

Avg = (OldAvg + NewAvg) / 2

Ref: http://en.wikipedia.org/wiki/Moving_average

thepip3r
If your goal is to produce the average of your 10 test scores, then this method will be incorrect. The last 3 test scores will be weighted higher than the first 7.
Seth
my ultimate goal was to calculate the average if you know the current average (but don't know the previous test scores making up that average) and a have a new set of test scores to factor in:
thepip3r
In the question, you asked for an equation that would give the same result as your "normal average" equation. This answer will not accomplish that. If you have changed your mind on what "average" you are trying to calculate, please edit the question.
mbeckish
+1  A: 

The standard approach is to store the count and the sum of the values.

They can be updated easily, and from them the average can be computed without loss of precision.

starblue