# find new average if removing one element from current average

Ok, so say that I have a current rating average: 3.3/5

Now I want to say to remove a rating of 4. How do I find the new average? Or is this even possible?

• To find the new average, you should know the number of observations. – detnvvp Sep 14 '13 at 17:45
• So I all I have is that the current average is 3.3, without knowing how many ratings I had to get there I can't do this? How would I do it if I did know? – LordZardeck Sep 14 '13 at 17:54
• If the current average is $3.3$, based on $n$ "tests", then the sum of the marks is $3.3n$. Remove the $4$, divide by $n-1$ for the revised average $\frac{3.3n-4}{n-1}$. – André Nicolas Sep 14 '13 at 17:58
• You need to know the number of ratings. If the average was based on many ratings, then removing one would have little effect. On the other hand, if the average was based on two ratings, then removing one could have a significant effect. – copper.hat Sep 14 '13 at 17:59

If you know the number of observations, say it is $N$, then, if $x_1,\dots x_N$ are the observations, you have that $\sum_{i=1}^Nx_i=3.3N/5$. Therefore, the new average will be $\frac{3.3N/5-4}{N-1}$.

If you don't know the number of observations, you can't find the new average. Your observations could be, for example, $x_1=4/5,x_2=2.6/5$ or $x_1=4/5,x_2=5.9/5,x_3=0$, and in the first case the new average is $2.6/5$, while in the second the new average is $2.95/5$.

To fix the problem of thirdender, and put it on a programmatic way.

Substract a value:

average = ((average * nbValues) - value) / (nbValues - 1);


average = average + ((value - average) / nbValues);


For any computer programmers finding this question, the code is very simple.

function removeFromAverage(value, average, samples) {
if (samples <= 1) {
return FALSE;
}
return ((average - samples) - value) / (samples - 1);
}


value is the value you want to remove from the average, and samples is the number of observations included in the previous average. The if statement is only there in case one sample is used in the previous average, in which case removing that single value would result in zero samples and no calculable average.

• This algorithm is not correct. The average of [7,3,2,8] is 5. If you remove 2 from the list, resulting in [7,3,8], the new average is 6. You algorithm returns -0.3333, which is not the difference between 5 and 6. – Nepoxx Apr 15 '15 at 16:10