《《非参数统计》与MATLAB编程第一章引言.doc》由会员分享,可在线阅读,更多相关《《非参数统计》与MATLAB编程第一章引言.doc(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、第一章 引言例11 表达1.1 100个零件的长度8.503 8.508 8.498 8.374 8.494 8.500 8.498 8.500 8.502 8.501 8.491 8.504 8.502 8.503 8.501 8.505 8.492 8.497 8.150 8.496 8.501 8.489 8.506 8.497 8.505 8.501 8.500 8.499 8.490 8.493 8.501 8.497 8.501 8.489 8.503 8.505 8.501 8.499 8.489 8.496 8.500 8.503 8.497 8.504 8.503 8.506
2、 8.497 8.507 8.346 8.310 8.489 8.499 8.492 8.497 8.506 8.502 8.505 8.489 8.503 8.492 8.501 8.499 8.804 8.505 8.504 8.499 8.506 8.499 8.493 8.494 8.490 8.505 8.511 8.502 8.505 8.503 8.782 8.502 8.509 8.499 8.498 8.493 8.897 8.504 8.493 8.494 7.780 8.509 8.499 8.503 8.494 8.511 8.501 8.497 8.493 8.501
3、 8.495 8.461 8.504 8.691 8.503 8.508 8.498 8.374 8.494 8.500 8.498 8.500 8.502 8.501 8.502 8.503 8.501 8.505 8.492 8.497 8.150 8.496 8.501 8.489 8.505 8.501 8.500 8.499 8.490 8.493 8.501 8.497 8.501 8.489 8.501 8.499 8.489 8.496 8.500 8.503 8.497 8.504 8.503 8.506 8.346 8.310 8.489 8.499 8.492 8.497
4、 8.506 8.502 8.505 8.489 8.501 8.499 8.804 8.505 8.504 8.499 8.506 8.499 8.493 8.494 8.511 8.502 8.505 8.503 8.782 8.502 8.509 8.499 8.498 8.493 8.493 8.494 7.780 8.509 8.499 8.503 8.494 8.511 8.501 8.497 8.495 8.461 8.504 8.691 8.491 8.506 8.503 8.497 8.503 8.490 8.504 8.497 8.505 8.507 8.492 8.505
5、 8.504 8.501 8.493 8.897 定义:a = Columns 1 through 3 8.5030 8.5080 8.4980 8.5020 8.5030 8.5010 8.5050 8.5010 8.5000 8.5010 8.4990 8.4890 8.3460 8.3100 8.4890 8.5010 8.4990 8.8040 8.5110 8.5020 8.5050 8.4930 8.4940 7.7800 8.4950 8.4610 8.5040 8.5040 8.4970 8.5050 Columns 4 through 6 8.3740 8.4940 8.50
6、00 8.5050 8.4920 8.4970 8.4990 8.4900 8.4930 8.4960 8.5000 8.5030 8.4990 8.4920 8.4970 8.5050 8.5040 8.4990 8.5030 8.7820 8.5020 8.5090 8.4990 8.5030 8.6910 8.4910 8.5060 8.5070 8.4920 8.5050 Columns 7 through 9 8.4980 8.5000 8.5020 8.1500 8.4960 8.5010 8.5010 8.4970 8.5010 8.4970 8.5040 8.5030 8.50
7、60 8.5020 8.5050 8.5060 8.4990 8.4930 8.5090 8.4990 8.4980 8.4940 8.5110 8.5010 8.5030 8.4970 8.5030 8.5040 8.5010 8.4930 Column 10 8.5010 8.4890 8.4890 8.5060 8.4890 8.4940 8.4930 8.4970 8.4900 8.8970x=reshape(a,1,100);ms=mean(x) std(x)% 求x的样本均值和样本标准差ms = 8.4956 0.1047p=normcdf(8.6,ms(1),ms(2)-norm
8、cdf(8.4,ms(1),ms(2)%求P(8.4x8.6)p = 0.6601normcdf(1,0,1)-normcdf(-1,0,1) %随机变量落在正负一个标准差的概率ans = 0.6827min(x) max(x)ans = 7.7800 8.8970max(x)-min(x)ans = 1.11708.9-7.7ans = 1.2000让上限不在内,用HISTC如:n=histc(x,7.7,7.9,8.1,8.3,8.5,8.7,8.9)n = 1 0 1 45 50 3 0n的第一个1表示大于等于7.7而小于7.9的个数bar(7.7,7.9,8.1,8.3,8.5,8.7
9、,8.9,n,histc) 图1.1 100个零件长度的直方图normplot(a)例:1.2 哪一个企业职工的工资高 表1.3 两个企业职工的工资企业1111213141516171819204060企业23456789103050设这两个样本相互独立,且分别来自正态总体和两企业工资的方差相等:h,sig,ci,tstats=ttest2(x,y,0.05,1)h = 0sig = 0.1073ci = -2.7831 Inftstats = tstat: 1.2816 df: 20 sd: 14.6694若假设两企业方差不等:h,sig,ci,tstats=ttest2(x,y,0.05,
10、1,unequal)h = 0sig = 0.1087ci = -2.8621 Inftstats = tstat: 1.2759 df: 18.9224 sd: 14.3535 15.0466 习题一tv=10 14 4 6 12 13 14 13 10 14 9 12 4 19 10 17 10 12 7 19 12 11 2 9 8 16;re=8 10 17 7 14 12 10 11 5 9 9 8 18 16 8 2 6 4 10 3 11 7 25 10 6 5;d=2 4 -13 -1 -2 1 4 2 5 5 0 4 -14 3 2 15 4 8 -3 16 1 4 -23 -1 2 11;h,sig,ci,tstat=ttest(tv,re,0.05,1)h = 0sig = 0.1988ci = -1.3633 Inftstat = tstat: 0.8607 df: 25 sd: 8.2028或者h,sig,ci,tstat=ttest(d,0,0.05,1)h = 0sig = 0.1988ci = -1.3633 Inftstat = tstat: 0.8607 df: 25 sd: 8.2028hist(d)normplot(d)不可信,差值不服从正态分布。