# Working out the “best” score based on quantity and ratio

I'm not an expert with mathematics so I hope I'm posting in the right place!

I've got a lot of products which can be rated good, bad and OK by a user. What I'm having trouble with is finding which is rated the "best"- similar to Amazon's sort by rating.

Getting the average rating won't work as I want a product with 99 good ratings and 1 bad rating to rank higher than a product with just 2 good ratings. Any ideas on what type of formula to use?

-

Thanks to Raskolnikov's comment I've found out what I need is either the Wilson Score Interval (which at the minute is way too complicated) or the Bayesian rating, which can be found here- http://www.thebroth.com/blog/118/bayesian-rating.

Now I know at least what the formula I want is called, I can figure out how to get what I want.

-
Often what is done is to take the products with the highest average rating after throwing out all the products that have only a few ratings. Sports ratings usually do something similar. For example, the batting title in baseball is awarded to the player with the highest batting average, after disqualifying all players with an insufficiently large numbers of plate appearances. –  MJD Mar 24 '12 at 19:52
Some similar questions: here, here and here. –  Raskolnikov Mar 24 '12 at 19:58
Mark Dominus- thank you, what you said made sense and thanks to Raskolnikov I found the "Bayesian Rating", which takes that in to account and helps me out immensely! –  penpen Mar 25 '12 at 2:45
Relevant is this article on How Not to Sort by Average Rating, which discusses a solution given in 1927 by Edwin B. Wilson. Oh, I see from your comment below that this is just what you found. I will leave the link here anyway. –  MJD Aug 28 '14 at 22:50

To assign a rating to a number, any polynomial with degree greater than 1 will work in your case. For example suppose $n_1$, $n_2$ and $n_3$ is no. of good, OK and bad ratings on product respectively. Then your equation will look like $${n_1^a + n_2^b - n_3^c}\over{n_1 + n_2 + n_3}$$, where you can take $a = 2, b= 1.5, c = 2.$ (all are greater than 1).