Sorry for the vague title, but I have an issue regarding a custom data visualization which I couldn't describe better. I am stuck now.
My use case is that I have ordinal rating data (let's say an Amazon rating between 1 and 5), which is encoded through lines with same length and with a specific angle depending on the value of the rating. In my case the formula for the angle is as follows:
$$angle = \frac{\pi * (5 - rating - 2))} {5}$$
Now in the following example I have six 5-star ratings and three 1-star ratings.
Here is an image of the output
In the output, you can see the end location of the red line (which is the set of the 9 ratings) is located at the wrong location for the average, which would be 3.66. The yellow line shows the average based on the end location of my line. And the green line shows the true location of the average.
My question is now that I would like to understand mathematically why this is the case and if anybody knows a solution for me to edit the graph in a way that the final line location provides information about the average value.
So you have a wrong formula.
Starting data:
$minRating= 1$
$maxRating = 5$
$initialAngle= \theta$
The "increment angle" between ratings must take a value $\beta=\frac{ratingRange}{totalSteps}$ and it must be that $\theta + totalSteps·\beta <= \pi$
Your visualizaton is a linear equation: $$angle\;\; \alpha=\theta + \beta·numberOfSteps$$ where $numberOfSteps$ is the "rating", being it an integer number or not. I used "steps" so you can understand it better checking some integer ratings.
The formula you need is: $$angle\;\; \alpha=\theta + \beta·rating$$
Let's say you have $maxRating - minRating = totalSteps= 4$ This hint allows us to say $beta < \pi/4$.
The point is to choose the angles $\theta, \beta$ so as the visualization gets clear.
Let's choose some intial angle $\theta=\pi/6 \;$ (30 degrees) and also $\beta=\pi/6$
For the case $rating =0$ the visualized angle is 30 degrees.
For $rating =1$ the angle is 30+30·1=60 degrees.
For $rating =5$ the angle is 30+30·5=180 degrees.
Nope. We'd like some more simetry, not reaching 180 degrees.
Lets's try again with $\theta=0$ and $\beta=\pi/6$
$rating=0$ then angle is 0 degrees.
$rating=1$ then angle is 0+30·1= 30 degrees.
$rating=5$ then angle is 0+30·5= 150 degrees.
Much better. Then: $$angle\;\; \alpha=\theta + \beta·rating = 0 + \pi/6·rating = \frac{\pi·rating}{6}$$
If you have ratings "5, 5, 3" then the average is 13/3=4.3. When putting this value in the formula we have $angle = \pi · 4.3 / 6 = 2.27\, rad = 130\, degrees \;$ which is below the angle for rating=5 (150) and greater than angle for rating=4 (120 degrees), as expected.