code_junkie

Weighted Mean

Nov 12th, 2011
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. * WR=Weighted Rating (The new rating)
  2. * R=Average Rating (arithmetic mean) so far
  3. * V=Number of ratings given
  4. * M=Minimum number of ratings needed
  5. * C=Arithmetic mean rating across the whole site
  6.  
  7. (5 + 5 + 4)/3 = 4.67 (rounded)
  8.  
  9. rating / weight
  10. 5 / 2 (since it was given 2 times)
  11. 5 / 2
  12. 4 / 1
  13.  
  14. (sum[(rate * weight)])/(sum of weights)
  15. (5 * 2) + (5 * 2) + (4 * 1) / (2 + 2 + 1)
  16. (24)/(5)
  17. = 4.8
  18.  
  19. select sum(response*ct*ct)/sum(ct*ct) from
  20. ( select response, count(response) as ct from your_table group by response) data
  21.  
  22. select sum(response*ct*ct)/sum(ct*ct) from
  23. ( select response, count(response) as ct from your_table group by response) data
Add Comment
Please, Sign In to add comment