《实验报告9典型相关分析.doc》由会员分享,可在线阅读,更多相关《实验报告9典型相关分析.doc(8页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、实验九 典型相关分析实验目的和要求 能利用原始数据与相关矩阵、协主差矩阵作相关分析,能根据SAS输出结果选出满足要求的几个典型变量实验要求:编写程序,结果分析实验内容:4.9方法一:SASdata examp4_9;input x1-x2 y1-y2;cards;191 155 179 145195 149 201 152181 148 185 149183 153 188 149176 144 171 142208 157 192 152189 150 190 149197 159 189 152188 152 197 159192 150 187 151179 158 186 148183
2、 147 174 147174 150 185 152190 159 195 157188 151 187 158163 137 161 130195 155 183 158186 153 173 148181 145 182 146175 140 165 137192 154 185 152174 143 178 147176 139 176 143197 167 200 158190 163 187 150;run;proc cancorr data=examp4_9 corr; var x1-x2; with y1-y2; run; The SAS System 16:48 Sunday
3、, October 31, 2012 1 The CANCORR Procedure Correlations Among the Original Variables Correlations Among the VAR Variables(变量x1-x2的相关系数矩阵) x1 x2 x1 1.0000 0.7504 x2 0.7504 1.0000 Correlations Among the WITH Variables(变量y1-y2的相关系数矩阵) y1 y2 y1 1.0000 0.8397 y2 0.8397 1.0000 Correlations Between the VAR
4、 Variables and the WITH Variables变量x1-x3与y1-y3的相关系数矩阵 y1 y2 x1 0.7092 0.7050 x2 0.7140 0.7440 The SAS System 16:48 Sunday, October 31, 2012 2 The CANCORR Procedure Canonical Correlation Analysis Adjusted Approximate Squared Canonical Canonical Standard Canonical Correlation Correlation Error Correla
5、tion 1 0. 0. 0. 0. 2 0. . 0. 0. Test of H0: The canonical correlations in the Eigenvalues of Inv(E)*H current row and all that follow are zero = CanRsq/(1-CanRsq) Likelihood Approximate Eigenvalue Difference Proportion Cumulative Ratio F Value Num DF Den DF Pr F 1 1.7954 1.7882 0.9960 0.9960 0. 6.78
6、 4 40 0.0003 2 0.0072 0.0040 1.0000 0. 0.15 1 21 0.7014检验假设 检验统计量,为第一、第二自由度由检验结果可知,故只有第一对典型变量显著相关取第一对进行分析即可 Multivariate Statistics and F Approximations S=2 M=-0.5 N=9 Statistic Value F Value Num DF Den DF Pr F Wilks Lambda 0. 6.78 4 40 0.0003 Pillais Trace 0. 5.05 4 42 0.0021 Hotelling-Lawley Trace
7、 1. 8.88 4 23 0.0002 Roys Greatest Root 1. 18.85 2 21 a=data;n,m=size(a);b=a./(ones(n,1)*std(a);R=cov(b);X=b(:,1:2);Y=b(:,3:4);A,B,r,U,V,ststs=canoncorr(X,Y)A = 0.5522 -1.3664 0.5215 1.3784B = 0.5044 -1.7686 0.5383 1.7586r = 0.7885 0.0537U = 0.5731 -0.0137 0.3750 -1.6953 -0.4877 0.0774 -0.0209 0.732
8、2 -1.0535 0.0294 1.6762 -2.0193 0.1063 -0.6685 1.1955 -0.1057 0.1912 -0.1546 0.2760 -1.0884 0.1065 2.2268 -0.4453 -0.3895 -0.7422 1.4311 0.7995 0.8741 0.1205 -0.3416 -2.2840 0.5404 0.7994 -0.5736 0.1488 0.3123 -0.6999 -0.4835 -1.3930 -0.5784 0.5590 -0.3406 -1.2373 0.1224 -1.4072 -0.9053 1.7614 1.389
9、9 1.0825 1.6219V = -0.5833 -0.2587 1.0836 -2.2993 0.0390 -0.2672 0.1898 -0.7957 -1.2259 0.3643 0.6314 -0.7140 0.2902 -1.1480 0.4807 -0.1856 1.4442 0.2398 0.3000 -0.0954 0.0090 -0.7055 -0.6741 1.1462 0.2797 0.5190 1.1832 0.0680 0.8615 1.7392 -2.6910 -1.0193 0.6605 2.4438 -0.6441 1.5845 -0.3524 -0.5250 -1.9285 0.1107 0.2797 0.5190 -0.4731 0.4416 -0.8945 -0.2544 1.5147 -0.5507 0.2197 -0.3574ststs = Wilks: 0.3772 0.9971 df1: 4 1 df2: 42 22 F: 6.5972 0.0637 pF: 3.2565e-004 0.8031 chisq: 20.9642 0.0639 pChisq: 3.2189e-004 0.8004 dfe: 4 1 p: 3.2189e-004 0.8004
限制150内