资源描述:
《降鑫磊2010221014统计学》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、第一题:clearclca=[4.10003.70003.50003.90004.10003.50003.50003.60004.10004.00004.10004.00003.70004.30004.20003.20003.80003.40003.40003.90003.90003.30003.40004.00003.90003.70003.40003.50003.60003.90003.30004.00003.50003.40003.6000];b=[3.90004.20003.90004.50004.00004.40004.10003.30004.0000
2、3.40004.50003.80004.70003.60004.30003.50003.90003.80004.80003.80003.80003.40003.80004.10004.70004.30003.30003.90003.80003.80004.60004.10003.40003.80004.2000];u=a-b;[h,p,ci,stats]=ttest(u,0,0.01)结果:h=1p=0.0030ci=-0.4767-0.0376stats=tstat:-3.1955df:34sd:0.4761第二题:将13类鼠标质量按ward聚类分为3类第一类
3、'微软SideWinder''罗技G9'第二类'Razer3G''Razer巨腹蛇''双飞燕XL-750FS''微软Habu''罗技新版MX518第三类'美心点击王''苹果新概念MG09V5U''明基幻影熊''多彩T2''优派黑甲鼠''新贵狙激豹'聚类图程序代码:[x,textdata]=xlsread('problem2.xls');>>x=zscore(x);>>y=pdist(x);>>z=linkage(y,'ward');obslabel=textdata(2:14);>>[H,T]=dendrogram(z,'orientation','Right'
4、,'labels',obslabel);>>set(H,'LineWidth',2,'Color','k')xlabel('ward聚类');Taverage=clusterdata(x,'linkage','ward','maxclust',3);>>obslabel(Taverage==1)ans='微软SideWinder''罗技G9'>>obslabel(Taverage==2)ans=Columns1through4'Razer3G''Razer巨腹蛇''双飞燕XL-750FS''微软Habu'Column5'罗技新版MX518'obslabel(Ta
5、verage==3)ans=Columns1through4'美心点击王''苹果新概念MG09V5U''明基幻影熊''多彩T2'Columns5through6'优派黑甲鼠''新贵狙激豹'clear>>[x,textdata]=xlsread('problem4.xls');>>xz=zscore(x);>>[COEFF,SCORE,latent,tsquare]=princomp(xz);>>explained=100*latent/sum(latent);>>[m,n]=size(x);>>result1=cell(n+1,4);%定义一个n+1行,4列的元
6、胞数组result1(1,:)={'特征值','差值','贡献率','累积贡献率'};result1(2:end,1)=num2cell(latent);%存放特征值result1(2:end-1,2)=num2cell(-diff(latent));%存放特征值之间的差值result1(2:end,3:4)=num2cell([explained,cumsum(explained)])%存放(累积)贡献率result1='特征值''差值''贡献率''累积贡献率'[4.7255][3.4912][67.5071][67.5071][1.2343][0.7857]
7、[17.6334][85.1406][0.4487][0.1425][6.4095][91.5500][0.3061][0.0924][4.3731][95.9231][0.2138][0.1532][3.0536][98.9767][0.0606][0.0495][0.8653][99.8421][0.0111][][0.1579][100.0000]>>varname=textdata(1,2:end);>>result2=cell(n+1,3);>>result2(1,:)={'标准化变量','特征向量t1','特征向量t2'};%result2的第一行r
8、esult2(2:end