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?
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityOk, 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 fix the problem of thirdender, and put it on a programmatic way.
Substract a value:
average = ((average * nbValues) - value) / (nbValues - 1);
Add a value:
average = average + ((value - average) / nbValues);
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$.
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.
[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
.
$\endgroup$