Spearman相关系数又称秩相关系数,是利用两变量的秩次大小作线性相关分析,对原始变量的分布不作要求,属于非参数统计方法,适用范围要广些.对于服从Pearson相关系数的数据亦可计算Spearman相关系数,但统计效能要低一些.Spearman相关系数的计算公式可以完全套用Spearman相关系数计算公式,但公式中的x和y用相应的秩次代替即可.
老外的例子,不需要看懂英文,有算例.
Statistics Toolbox
Description:It calculates the Spearman rank correlation coefficient from 2 or more data sets,and the associated t-test and p-values.The code is adapted with major changes from the Numerical Recipes book (http://www.***.com/)
Example:
>> x = [1 2 3 3 3]';
>> y = [1 2 2 4 3; rand(1,5)]';
>> [r,t,p] = spear(x,y)
>> [r,t,p]=spear(x,y)
r =
0.8250 -0.6000
t =
2.5285 -1.2990
p =
0.0855 0.2848
用SPSS软件或matla