正文描述:《基于matlab的参数检验》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、根据X~N(5,0.0008),有MATLAB计算拒绝域的临界值:>>a=norminv(0.025,5,0.0008)a=4.9984>>b=norminv(0.975,5,0.0008)b=5.0016总体均值双侧检验:>>x=[97,102,105,112,99,103,94,100,95,105,98,102,100,103];>>[h,p,muci,zval]=ztest(x,100,2,0.05)h=1100为假设值,若h=1则拒绝p=0.0450检验值pmuci=100.0238102.
2、1191zval=2.0045由于置信区间均大于100,则需做下列检验:>>[h,p,muci,zval]=ztest(x,100,2,0.05,'right')h=1p=0.0225muci=100.1922Infzval=2.0045在方差已知的情况下检验均值是否正常:>>x=[0.497,0.506,0.518,0.524,0.498,0.511,0.52,0.515,0.512];>>[h,p,ci,u]=ztest(x,0.5,0.015,0.05,1)h=1p=0.0124ci=0.503
3、0Infu=2.2444忽视标准差条件,可用ttest函数做检验:>>[h,p,ci,T]=ttest(x,0.5,0.05,1)h=1p=0.0036ci=0.5054InfT=tstat:3.5849df:8sd:0.0094若以样本均值和标准差做实际控制参数,可用normcdf函数估计产品的合格比率:>>p=1-normcdf(0.5,mean(x),std(x))p=0.8840两个正态总体的均值检验:>>x=[77.9,78.3,76.8,80.3,72.1,73.7,71.0,69.2,8
4、0.1,77.4];>>y=[79.8,80.7,79.3,82.1,79.3,78.7,80.4,81.2,79.2,80.3];>>[h,sig,ci,stats]=ttest2(x,y,0.05,-1)h=1sig=0.0014ci=-Inf-2.2012stats=tstat:-3.4543df:18sd:2.8612利用kstest函数对生成的『分布数据进行检验:>>r=gamrnd(1,3,400,1);>>alam=gamfit(r)alam=0.97242.7423>>r=sort(r
5、);>>[h,p,jbstat,critval]=kstest(r,[r,gamcdf(r,alam(1),alam(2))],0.05)h=0p=0.7942jbstat=0.0322critval=0.0675利用kstest2检验所创建的标准正态随机分布是否接受原假设:>>x=-1:1:5;>>y=randn(20,1);>>[h,p,k]=kstest2(x,y)h=0p=0.0774k=0.5214建立y与x间的函数关系,并检验残差r是否服从均值为0的正态分布:>>x=[2,3,4,5,7,
6、8,9,13,15,17,19,20];>>y=[107.83,109.35,110.12,111.34,107.56,110.65,112.37,114.76,110.89,111.21,112.35,111.99];>>plot(x,y,'rP');>>a=polyfit(x,y,1);>>plot(x,y,'*',x,polyval(a,x),'b');>>e1=y-polyval(a,x)e1=Columns1through11-1.5077-0.17510.40751.4400-2.7148
7、0.18781.72033.3606-0.8842-0.9391-0.1739Column12-0.7213>>[h1,sig,ci]=ttest(e1,0,0.05)h1=0sig=1ci=-1.02121.0212>>[h2,p,kstat,critval]=lillietest(e1,0.05)h2=0p=NaNkstat=0.1499critval=0.2420零中值分布的符号检验:>>N=1024;>>x1=randn(1,N);假设检验>>alpha0=0.05;>>[p1,h1,stat
8、es]=signtest(x1,alpha0)p1=0.0749h1=0states=zval:-1.7813sign:483>>x2=wblrnd(1,2,N,1);实现的假设检验:>>[p2,h2,states2]=signtest(x2,alpha0)p2=1.1755e-221h2=1states2=zval:31.7813sign:3秩和检验:>>a=[7.0,3.6,9.5,8.1,6.3,5.0,10.3,4.2,2.7,10.6];>>b
显示全部收起