How to calculate the correlation between two ratings

108 Views Asked by At

Suppose x and z are two persons who rate a classical piece of music y on a five point scale.

x rates y $3$ out of $5$

z also rates y $3$ out of $5$

I need to know how much the ratings of x and z are similar.

I was thinking to create the difference between them. In other words:

$3/5 - 3/5 = 0$

But I need a function that can change the zero to one, because obviously they are similar and have the same taste.

That same function should gives me zero if the difference is one. In other words, if:

x likes y by $5$ out of $5$

z likes y by $0$ out of $5$

The difference between them is one. Thus, that function should respect it. I don't know what that function could be, I don't even know if my proposal for making the difference is correct could you help guys?

Update 1

I can't use $1-\text{difference}$ because if the case what z and x have expressed their opinions in not just $y$, but also $y_1, y_2, \ldots, y_n$, I might end up with a negative value, while as you know the similarity must be between $0$ (not similar at all) and $1$ (identical taste).