How to calculate the value of correlation coefficient r using Spearman correlation coefficient test?

5 views (last 30 days)
HI, For attached rainfall data sheet A.Xls I want to calculate the value of correlation coefficient "r" by using Spearman correlation coefficient test. Can some one help me to calculate it in mat-lab. Moreover kindly guide me how to interpret the value of r for strong, week and negligible correlation.
  2 Comments
Muhammad shahid
Muhammad shahid on 6 Dec 2017
Dear jean claude I have two variables in the attached sheet Year and rainfall I should consider them as X and Y? and RHO here represent the value of r?

Sign in to comment.

Accepted Answer

jean claude
jean claude on 6 Dec 2017
if you have the statistics toolbox you can use
[RHO,PVAL] = corr(x,y,'type','Spearman')

More Answers (1)

Muhammad shahid
Muhammad shahid on 7 Dec 2017
Dear jean claude I have developed this code for data in one column. I wan to perform this on many columns like for attached data set "B.xls" hOW I Would have to modify this code?
data = xlsread('V'); [nrows, ncolumns] = size(data); for i = 1:ncolumns X = data(1:nrows-1); Y = data(2:nrows); [RHO,PVAL] = corr(X,Y,'type','Spearman'); end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!