find new average if removing one element from current average

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$.

Tags:

Average