资源描述:
《matlab数理统计程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、正态总体均值、方差的参数估计与置信区间估计P316例6.5.1置信区间估计clear;Y=[14.8513.0113.5014.9316.9713.8017.9513.3716.2912.38];X=normrnd(15,2,10,1)%随机产生数[muhat,sigmahat,muci,sigmaci]=normfit(X,0.1)%正态拟合[muhat,sigmahat,muci,sigmaci]=normfit(Y,0.1)%正态拟合X=15.257316.312912.664414.078814.475112.573712.361116.8624
2、15.022513.7097muhat=14.3318sigmahat=1.5595muci=13.427815.2358sigmaci=1.13742.5657muhat=14.7050sigmahat=1.8432muci=13.636515.7735sigmaci=1.34433.0324P320例6.5.5置信区间估计clear;Y=[4.684.854.324.854.615.025.204.604.584.724.384.70];[muhat,sigmahat,muci,sigmaci]=normfit(Y,0.05)muhat=4.7092
3、sigmahat=0.2480muci=4.55164.8667sigmaci=0.17570.4211P321例6.5.6置信区间估计clear;Y=[45.345.445.145.345.545.745.445.345.6];[muhat,sigmahat,muci,sigmaci]=normfit(Y,0.05)muhat=45.4000sigmahat=0.1803muci=45.261445.5386sigmaci=0.12180.3454单正态总体均值的假设检验方差sigma已知时P338例7.2.1%[h,p,ci,zval]=ztest(
4、X,mu,sigma,alpha,tail,dim)clearall;X=[8.058.158.28.18.25];[h,p,ci,zval]=ztest(X,8,0.2,0.05)h=0p=0.0935ci=7.97478.3253zval=1.6771注:p为观察值的概率ci为置信区间;zval统计量值若h=0:表示在显著性水平alpha下,不能否定原假设;若h=1:表示在显著性水平alpha下,否定原假设;若tail=0:表示双边假设检验;若tail=1:表示单边假设检验(mu>mu0);若tail=0:表示单边假设检验(mu5、根据指定的维数进行检验%[h,p,ci,zval]=ztest(X,mu,sigma,alpha)%X=normrnd(mu,sigma,N,M);随机产生均值为mu,标准差为sigma的M行N例随机数;clearall;X=normrnd(100,5,100,1);mu=mean(X)sigmal=5;[h,p,ci,zval]=ztest(X,100,5,0.05)mu=99.8810h=0p=0.8119ci=98.9011100.8610zval=-0.2379单正态总体均值的假设检验方差sigma未知时P338例7.2.2%[h,p,ci,ts
6、tat]=ttest(X,mu0,alpha,tail,dim)clearall;X=[239.7239.6239240239.2];[h,p,ci,tstat]=ttest(X,240,0.05)h=1p=0.0491ci=239.0033239.9967tstat=tstat:-2.7951df:4sd:0.4000注:p为观察值的概率ci为置信区间;tstat统计量值若h=0:表示在显著性水平alpha下,不能否定原假设;若h=1:表示在显著性水平alpha下,否定原假设;df为自由度;sd为样本标准背离若tail=0:表示双边假设检验;若tail
7、=1:表示单边假设检验(mu>mu0);若tail=0:表示单边假设检验(mu8、arci为方差的置信区间;stats为卡方统计量的观测值若h=0:表示在显著性水