Is it possible to compute Spearman's rank correlation in MATLAB?
15 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Edited: MathWorks Support Team
on 4 May 2020
I would like to compute Spearman's rank correlation using MATLAB or the Statistics Toolbox.
Accepted Answer
MathWorks Support Team
on 4 May 2020
Edited: MathWorks Support Team
on 4 May 2020
In the Statistics Toolbox 5.0 (R14), the CORR function can compute Spearman's rank correlation. The syntax is as follows:
rho = corr(X, Y, 'type', 'Spearman');
where 'type' is a type of correlation, specified as the comma-separated. The acceptable values include 'Pearson', 'Kendall' and 'Spearman'. Please refer to the following link for more information:
For previous product releases, please read below for any possible workarounds:
You can easily code the Spearman rank correlation, however, using the existing functions from the Statistics Toolbox.
Here are some functions that will assist you:
TIEDRANK Compute the ranks of a sample, adjusting for ties
CORRCOEF Computes the Correlation coefficients
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!