资源描述:
《matlab主成分分析案例》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、1.设随机向量X=(X1,X2,X3)T的协方差与相关系数矩阵分别为,分别从,出发,求的各主成分以及各主成分的贡献率并比较差异况。解答:>>S=[14;425];>>[PC,vary,explained]=pcacov(S);总体主成分分析:>>[PC,vary,explained]=pcacov(S)主成分交换矩阵:PC=-0.1602-0.9871-0.98710.1602主成分方差向量:vary=25.64910.3509各主成分贡献率向量explained=98.65041.3496则由程序输出
2、结果得出,X的主成分为:Y1=-0.1602X1-0.9871X2Y2=-0.9871X1+0.1602X2两个主成分的贡献率分别为:98.6504%,1.3496%;则若用第一个主成分代替原来的变量,信息损失率仅为1.3496,是很小的。2.根据安徽省2007年各地市经济指标数据,见表5.2,求解:(1)利用主成分分析对17个地市的经济发展进行分析,给出排名;(2)此时能否只用第一主成分进行排名?为什么?地区工业总产值资产合计工业增加值实收资本长期负债业务收入业务成本利润第6页共6页合肥491.703
3、80.31158.39121.5422.74439.65344.4417.43淮北21.1230.556.4012.403.3121.1717.712.03亳州1.712.350.570.680.131.481.36-0.03宿州9.839.053.133.430.648.767.810.54蚌埠64.0677.8620.6330.375.9663.5752.154.71阜阳30.3846.909.199.8317.8728.2421.903.80淮南31.2070.078.9318.8833.0531
4、.1726.502.84滁州79.1862.0920.7824.473.5171.2959.076.78六安47.8140.1417.509.524.1445.7034.734.47马鞍山104.6978.9529.6125.965.3998.0884.813.81巢湖21.0717.836.216.221.9020.2416.461.09芜湖214.19146.7865.1641.624.39194.98171.9811.05宣城31.1627.568.809.441.4728.8325.221.05
5、铜陵12.7914.163.664.071.5711.9510.240.73池州6.455.372.392.200.405.974.790.52安庆39.4344.6015.1715.723.2736.0327.873.48黄山5.023.621.631.420.534.454.040.02解答:(1)>>clear>>A=[491.70,380.31,158.39,121.54,22.74,439.65,344.44,17.43;21.12,30.55,6.40,12.40,3.31,21.17,17
6、.71,2.03;1.71,2.35,0.57,0.68,0.13,1.48,1.36,-0.03;9.83,9.05,3.13,3.43,0.64,8.76,7.81,0.54;64.06,77.86,20.63,30.37,5.96,63.57,52.15,4.71;30.38,46.90,9.19,9.83,17.87,28.24,21.90,3.80;31.20,70.07,8.93,18.88,33.05,31.17,26.50,2.84;79.18,62.09,20.78,24.47,3.5
7、1,71.29,59.07,6.78;47.81,40.14,17.50,9.52,4.14,45.70,34.73,4.47;104.69,78.95,29.61,25.96,5.39,98.08,84.81,3.81;21.07,17.83,6.21,6.22,1.90,20.24,16.46,1.09;214.19,146.78,65.16,41.62,4.39,194.98,171.98,11.05;31.16,27.56,8.80,9.44,1.47,28.83,25.22,1.05;12.7
8、6,14.16,3.66,4.07,1.57,11.95,10.24,0.73;6.45,5.37,2.39,2.20,0.40,5.97,4.79,0.52;39.43,44.60,15.17,15.72,3.27,36.03,27.87,3.48;5.02,3.62,1.63,1.42,0.53,4.45,4.04,0.02];得到的相关系数矩阵为:>>R=corrcoef(A)R=1.00000.98770.99880.98200.4