Search code examples
phpratingweighted-average

1 raiting subtraction from total weighted rating


This is a 10 star rating.

I have a weighted rating of 8.1 made from 25 users ratings. I want to delete 1 user rating (7.5) that is invalid, how i do direct calculation on this? I don't want to recalculate all 24 ratings that are left.

I tough of this (8.1+7.5)/2 but it doesn't give me the right answer

Any others ideas of subtraction from a weighted rating?


Solution

  • When you calculate an average, the formula is :

    (rate1 + rate2 + ... + rateN) / number of rates.

    So, we have this equation where x is the addition of all rates exept the one you want to substract :

    (x + 7.5) / 25 = 8.1

    x + 7.5 = 8.1 * 25

    x = 8.1 * 25 - 7.5

    x = 195

    So the answer is 195 / 24 = 8.125

    Based on previous, the formula is :

    (average * total votes - rate to remove) / total votes - 1