I have a study where I asked participants to sort voices based on different traits (for example from least to most confident or from least to most attractive).

I want to do a rank correlation to see if:

  1. There is a relationship within participants' responses between different traits (if a participant thinks a voice is more attractive, do they also prefer that voice more?)

  2. There is a relationship within traits between participants' responses (if a participant thinks a voice is more masculine, does another participant agree?)

In my study, voices were identified using integers 0 through 5. Therefore, for each participant, I have a sorted list of digits 0 through 5 for each trait. How can I use this data with a rank correlation test like Spearman's Rho?

I think it is a mistake to simply pass the two ''ranked lists'' to a function like

scipy.stats.spearmanr([0,3,2,5,4,1], [2,0,3,1,5,4])

but I am not sure about this.


1 Answer 1


The answer is that I should convert each sorted list of voices to their corresponding indices.

voices = [0, 1, 2, 3, 4, 5]
sorted_voices = [0, 3, 2, 5, 4, 1]
indices = [0, 5, 2, 1, 4, 3] #indices of voices in sorted_voices

I should be using the indices in the spearmanr function rather than the list of voices themselves. This would have been more obvious if I didn't numerically code them as 0 through 5.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.