1、一、Spearman相关二、Kendall 相关三、Cronbach系数四、定性数据相关,Pearson相关(1)用于度量线性关系,(2)用于连续数据12211()()()()niixyixynnx yiiiixx yysrssxxyy21/21/22(2)()1rtnr非参数相关(1)用于度量单调关系(不一定线性),相依关系度量(measures of association)(2)可用于定序数据,适用于某些不能准确地测量指标值而只能以严重程度、名次先后、反映大小等定出的等级资料,也适用于某些不呈正态分布或难于判断分布的资料。SPEARMAN秩和相关(spearman rank correl
2、ation coefficient)Spearman等级相关分析秩相关的Spearman等级相关分析秩相关(rank correlation)又称等级相关Xx1x2x3xnYy1y2y3ynRXRx1Rx2Rx3RxnRYRy1Ry2Ry3RynCharles Spearman秩相关系数 2222()61(1)()IIiIIRXRXRYRYdrn nRXRXRYRY(RXi秩RYi秩Di=Rxi-Ryi第二个公式只有无节时成立。最大积雪深度X灌溉面积Y5.101907.003.501287.007.102693.006.202373.008.803260.007.803000.004.5019
3、47.005.602273.008.003313.006.402493.00X XY YRXRXRYRY5.15.1190719073 32 23.53.5128712871 11 17.17.1269326937 77 76.26.2237323735 55 58.88.83260326010109 97.87.8300030008 88 84.54.5194719472 23 35.65.6227322734 44 48 8331333139 910106.46.4249324936 66 6C Co or rr re el la at ti io on ns s1.976*.000101
4、0.976*1.0001010Pearson CorrelationSig.(2-tailed)NPearson CorrelationSig.(2-tailed)NRANK of XRANK of YRANK of XRANK of YCorrelation is significant at the 0.01 level(2-tailed).*.C Co or rr re el la at ti io on ns s1.000.976*.0001010.976*1.000.000.1010Correlation CoefficientSig.(2-tailed)NCorrelation C
5、oefficientSig.(2-tailed)NXYSpearmans rhoXYCorrelation is significant at the 0.01 level(2-tailed).*.XYRXRYd2d25.11907321 13.51287110 07.12693770 06.22373550 08.832601091 17.83000880 04.51947231 15.62273440 0833139101 16.42493660 0 4 40.975758)1100(10)4(61)1(6122nndris公式只有无节时成立。x-c(1,2,3,4,5,6);y-c(6,
6、5,4,3,2,1)cor.test(x,y,method=spearman)data nc;input x y;datalines;1 6 2 5 3 4 4 3 5 2 6 1 proc corr data=nc spearman;var x;with y;run;例:某公司想要知道是否职工期望成为好的销售员而实际上就能有好的销售记录。为了调查这个问题,公司的副总裁仔细地查看和评价了公司10个职工的初始面试摘要、学科成绩、推荐信等材料,最后副总裁根据他们成功的潜能给出了单独的等级评分。二年后获得了实际的销售记录,得到了第二份等级评分,见表 中所示。统计问题为是否职工的销售潜能与开始二年的实
7、际销售成绩一致。职工编号职工编号潜能等级潜能等级rxrx销售成绩销售成绩Y Y1 12 24004002 24 43603603 37 73003004 41 12952955 56 62802806 63 33503507 710102002008 89 92602609 98 822022010105 5385385data nc;input x y;datalines;2400 4360 7300 12956280 3350 10200 92608220 5385proc corr data=nc spearman;var x;with y;run;XY86 8877 7668 6491
8、 9687 72SIGN(XI-XJ)SIGN(XI-XJ)SIGN(YI-YJ)SIGN(YI-YJ)-1-1-1-1-1-1-1-11 11 1 1 1-1-1-1-1-1-11 11 11 1-1-11 11 11 11 1-1-1-1-1255*4/210C 258-2-0.610CDNNC8210 10Nc乘积为正的个数。Nd乘积为负的个数。X-c(86,77,68,91,70,71,85,87,63)Y-c(88,76,64,96,65,80,81,72,60)cor.test(X,Y,method=kendall)868688887777767668686464919196967
9、070656571718080858581818787727263636060Kendall相关系数Kendall Tau-b相关系数,有结修正公式非参数的相关系数,比较成对观测样本.0102(sgn()sgn()()()ijijxxyyrTTTTX XY Y7 717.17.5 51 11.51.53 317178 86 62 22 26 65 59 918185 54 44 43 3 一、对X从小到大排序,二、对Y计算SIGN(G3-1.5)三、=SIGN(G3-1.5)四、求符号和sum五、组合数n(n-1)/2六、T=Sum/(n(n-1)/2)XY=SIGN(G3-1.5)=SIGN
10、(G4-2=SIGN(G5-17)1 11.51.52 22 21 13 317171 11 14 43 31 11 1-1-15 54 41 11 1-1-11 16 65 51 11 1-1-11 11 17 7 17.517.51 11 11 11 11 11 18 86 61 11 1-1-11 11 11 1-1-19 918181 11 11 11 11 11 11 11 1sum=26n(n-1)/2=9*8/2=3626/36例:研究温度与产品采收率之间的关系,10次试验结果,计算spearman,Kendall相关系数温度温度成品采成品采收率收率454510010052521
11、1111154541201206363133133626214014068681521527575160160767617117192921801808888195195C Co or rr re el la at ti io on ns s1.000.911*.0001010.911*1.000.000.10101.000.976*.0001010.976*1.000.000.1010Correlation CoefficientSig.(2-tailed)NCorrelation CoefficientSig.(2-tailed)NCorrelation CoefficientSig.(2
12、-tailed)NCorrelation CoefficientSig.(2-tailed)NXYXYKendalls tau_bSpearmans rhoXYCorrelation is significant at the 0.01 level(2-tailed).*.一、两个分类变量的相关二、两个顺序变量有相关三、分类变量与顺序变量的相关四、mobiphon有有序序变变量量分分类类变变量量data xjtj;input x y;datalines;127 13155 33127 38131 10153 57180 89144 42189 70172 78160 23170 68176 77179 58163 63173 89183 84184 72169 49153 47159 63;proc corr data=xjtj SPEARMAN KENDALL pearson;var F1 F2;run;