I need some help with the following.
I have 10 or X amount of subjects with a rating and would like to distribute a score of 1 to 5 between them based on their rating. The subject with the highest rating will get a 5 and the lowest subject will get a 1. So the remaining 8 subjects will get a score between 1 to 5 based on increments of 0.25 (round up to closest 0.25).
E.g.
Subject #1 has rating of 99 : Score of 5
-
-
Subject #10 has rating of 1 : Score of 1
I would like the equation to help distribute the remaining values amongst the remaining 8.
So final result would look something like (in score order). Equation should evenly distribute the score though so that increments are equivalent as possible based on the number of subjects:
- Subject #1 has rating of 99 : Score of 5
- Subject #8 has rating of 90 : Score of 4.75
- Subject #3 has rating of 80 : Score of 4.25
- Subject #5 has rating of 70 : Score of 4.00
- Subject #7 has rating of 60 : Score of 3.75
- Subject #2 has rating of 52 : Score of 3.00
- Subject #9 has rating of 47 : Score of 2.75
- Subject #4 has rating of 40 : Score of 2.50
- Subject #6 has rating of 20 : Score of 1.75
- Subject #10 has rating of 1 : Score of 1
I hope this makes sense. Thank you so much for your help.
I'll be using this in some PHP code / web application
It seems that you want the score to be a linear function of the rating. One first finds the slope from two given points, such as $(99,5 )$ and $(1,1)$: $$m=\frac{5-1}{99-1}$$ and then forms the equatin using the slope and one of the points, such as $(1,1)$: $$ s = m(r-1)+1 $$ Then round to the nearest multiple of $0.25$, by rounding $4s$ to the nearest integer and then dividing by $4$.