资源描述:
《《非参数统计》与MATLAB编程两样本问题.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、第五章两样本问题§5.1a=[hygepdf(0,22,11,12)hygepdf(1,22,11,12)hygepdf(2,22,11,12)hygepdf(3,22,11,12)]a=00.000017010852920.000935596910830.01403395366244sum(a)ans=0.01498656142619hygecdf(3,22,11,12)ans=0.01498656142619§5.2.5P72x1=[20.619.918.618.918.820.22120.519.819.819.220.5];x2=[21.317.61
2、7.418.519.721.117.318.817.816.91820.1];formatlong[p,h,stats]=ranksum(x1,x2)p=0.04317169310436h=1stats=zval:2.02204509752701ranksum:1.855000000000000e+002zval的算法:n=12;m=12;N=24;me=n*(N+1)/2,de=n*m*(N+1)/12-n*m*3*(2^3-2)/(12*N*(N-1))me=150de=2.996086956521739e+002z=(185.5-me-0.5)/sqr
3、t(de)z=2.02204509752701P值的计算:p=2*(1-normcdf(z))p=0.04317169310436精算算法:[p,h,stats]=ranksum(x1,x2,'alpha',0.05,'method','exact')p=0.04004280818118h=1stats=ranksum:1.855000000000000e+002习题五1.女职工男职工2850030650397003370031000350503325036300228003560031800372503235026900382003395030450313
4、503080037750382002895032250367003410032900380503610030150313003480026550335503135032750392002735035700388004100025200359002990040400320503520037400355002655030450 x=[2850031000228003235030450382003410030150335502735025200320502655030650350503560026900313502895032900313003135035700
5、359003520030450]y=[397003325031800382003080032250380503480032750388002990037400337003630037250339503775036700361002655039200410004040035500]①me=median([x;y])me=33400[length(find(xme));length(find(yme))]ans=188717 年收入me合计女职工18826男职工71724合
6、计252550N11取值范围为:[1,25]hygecdf(0,50,25,26)ans=0单侧检验:p=1-hygecdf(17,50,25,26)p=0.00506098777511在显著性水平0.05下,拒绝原假设。即女职工年收入低于男职工。对双侧检验:p=2*(1-hygecdf(17,50,25,26))p=0.01012197555021在显著性水平0.05下,拒绝原假设。即女职工年收入不同于男职工。大样本用正态近似算:E(N11)=25*26/50=13;D(N11)=26*24*25*25/(50*50*49)e=25*26/50;d=26*
7、24*25*25/(50*50*49);p=1-normcdf(18,e,sqrt(d))p=0.00253743404897拒绝原假设。对于双侧检验:u2=49*(18*17-8*7)^2/(25*25*26*24)u2=7.852564102564101-chi2cdf(u2,1)ans=0.00507486809794在显著性水平下,拒绝原假设。②[p,h,stats]=ranksum(x,y)p=3.396221501665853e-004h=1stats=zval:3.58303725316353ranksum:797对于单侧检验:P值为p/2an
8、s=1.698110750832926e-004所以