1
$\begingroup$

I have 2 vectors of raw values. I need to do a percentile rank correlation and an ordinal rank correlation between them in Matlab.

Vec1 = [25    28    29    29    31    32    33    33    33    35    37] ;

I'm using corr function in Matlab with type=Spearman for the ordinal part.

I'm confused about the percentile rank part. Until now I was using tiedranks*100/length and would feed the output to corr function with type=Pearson (courtesy of a forum answer). However, the correct way is at http://www.psychstat.missouristate.edu/introbook/sbk14m.htm.

Website Ranks    = [4.6  13.6  27.3  27.3  40.9  50    68.2  68.2  68.2  86.4  95.4] ;
TiedRanks*100/len= [9.09 18.18 31.81 31.81 45.45 54.54 72.72 72.72 72.72 90.90 100];

Please let me know which is correct? Can I use Matlab's prctile function here? Thanks.

$\endgroup$
1
$\begingroup$

Percentile ranks are defined as the website describes. The formula you were using gives something other quantity which is something like a rescaled rank and it is incorrect if you were trying to get percentile rank.

Also, note that rank is not the same as percentile rank, these are different quantities. Spearman correlation is equivalent to taking the Pearson correlation of the rank.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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