additional points to weighted average

46 Views Asked by At

Given a weighted average for a set of data points (weight, score) and additional information such as the sum of all the weights in the dataset - could you help me to determine what the new weighted average when incorporating an additional data point?

1

There are 1 best solutions below

0
On

For a set of scores that are represented as a tuple $(p,q)$ where $p$ represents the ... and $q$ represents the weight of the score, the weighted average/mean for the data-set is calculated using the following formula:

$$ \overline{p} = \frac{\sum_{i=1}^{n}(q_{i}\times p_{i})}{\sum_{i=1}^{n}(q_{i})} $$

this can be better expressed as

$$ \overline{p} = \frac{1}{\sum_{i=1}^{n}(q_{i})}\times \sum_{i=1}^{n}(q_{i}\times p_{i}) $$

When we introduce a new data-point $(p_{n+1},q_{n+1})$ we can calculate the new weighted average if we are provided with the following data:

  1. The old weighted average ( $\overline{x}$ )
  2. The sum of the weights before the addition of the new data-point ( $\sum_{i=1}^{n}(q_{i})$ )
  3. The new data point ( $(p_{n+1},q_{n+1})$ )

Using this information the weighted average formula includes the new data point as follows:

$$ \overline{p'} = \frac{1}{\sum_{i=1}^{n}(q_{i}) + q_{n+1}}\times \Big[ \sum_{i=1}^{n}(q_{i}\times p_{i}) + (p_{n+1} \times q_{n+1}) \Big] $$

But we don't know each of the previous data-points to enable us to calculate the sum of the products $\sum_{i=1}^{n}(q_{i}\times p_{i}$) since we know from rearranging the weighted average formula that this term can be found as follows:

$$ \sum_{i=1}^{n}(q_{i}\times p_{i}) = \overline{p} \times \sum_{i=1}^{n}(q_{i}) $$

So the new weighted average $\overline{p`} $ can be calculated as:

$$ \overline{p'} = \frac{1}{\sum_{i=1}^{n}(q_{i}) + q_{n+1}}\times \Big[ \overline{p} \times \sum_{i=1}^{n}(q_{i}) + (p_{n+1} \times q_{n+1}) \Big] $$