数学模型实验7.docx

上传人:b****6 文档编号:5624666 上传时间:2022-12-29 格式:DOCX 页数:10 大小:411.02KB
下载 相关 举报
数学模型实验7.docx_第1页
第1页 / 共10页
数学模型实验7.docx_第2页
第2页 / 共10页
数学模型实验7.docx_第3页
第3页 / 共10页
数学模型实验7.docx_第4页
第4页 / 共10页
数学模型实验7.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

数学模型实验7.docx

《数学模型实验7.docx》由会员分享,可在线阅读,更多相关《数学模型实验7.docx(10页珍藏版)》请在冰豆网上搜索。

数学模型实验7.docx

数学模型实验7

数学建模实验

七.数理统计实验

解:

(1)灯泡寿命服从正态分布,满足

编写程序,

x<-c(1067,919,1196,785,1126,936,918,1156,920,948)

shapiro.test(x)

interval_estimate1(x)

解得,

Shapiro-Wilknormalitytest

data:

x

W=0.9126,p-value=0.299

meandfab

1997.19902.99651091.203

因此,可得p-value=0.299<0.05,该样本符合正态分布,均值为997.1。

此灯泡的置信区间为[902.9965,1091.203],95%的灯泡至少使用902.9965小时。

(2)编写程序,

t.test(x,mu=1000,alternative=”two.sided”,conf.level=0.95)

解得,

OneSamplet-test

data:

x

t=-0.0697,df=9,p-value=0.946

alternativehypothesis:

truemeanisnotequalto1000

95percentconfidenceinterval:

902.99651091.2035

sampleestimates:

meanofx

997.1

因此,由p-value=0.946可知,使用1000小时以上的概率为94.6%。

解:

假设正常男子血小板计数符合正态分布,

编写程序,、

X<-c(220,188,162,230,145,160,238,188,247,113,

126,245,164,231,256,183,190,158,224,175)

t.test(X,alternative="two.side",mu=225)

解得,

OneSamplet-test

data:

X

t=-3.4783,df=19,p-value=0.002516

alternativehypothesis:

truemeanisnotequalto225

95percentconfidenceinterval:

172.3827211.9173

sampleestimates:

meanofx

192.15

因此,可知油漆工人的血小板计数与正常成年男子的有差役,说明油漆作业对人体血小板计数有影响,并使其减少。

解:

(1)由题可得,当两方差相等时,可以得到其均值差的置信度为

的双侧置信区间为,

编写程序,

>x<-c(113,120,138,120,100,118,138,123)

>y<-c(138,116,125,136,110,132,130,110)

>t.test(x,y,var.equal=TRUE)

解得,

TwoSamplet-test

data:

xandy

t=-0.566,df=14,p-value=0.5804

alternativehypothesis:

truedifferenceinmeansisnotequalto0

95percentconfidenceinterval:

-16.1648849.414884

sampleestimates:

meanofxmeanofy

121.250124.625

因此,可知两种治疗组的双侧置信区间为[-16.164884,9.414884],因为0在置信区间内,所以可以认为实验组与对照组的均值没有显著差异。

(2)两总体方差不同模型,编写程序,

>x<-c(113,120,138,120,100,118,138,123)

>y<-c(138,116,125,136,110,132,130,110)

>var.test(x,y)

解得,

Ftesttocomparetwovariances

data:

xandy

F=1.2278,numdf=7,denomdf=7,p-value=0.7935

alternativehypothesis:

trueratioofvariancesisnotequalto1

95percentconfidenceinterval:

0.24581036.1327511

sampleestimates:

ratioofvariances

1.2278

因此,可知两治疗组的方差比置信度为0.95的置信区间为[0.2458103,6.1327511],因为1在质心区间内,所以可认为实验组与对照组的方差是相同的。

(3)成对数据模型,

编写程序,

>x<-c(113,120,138,120,100,118,138,123)

>ks.test(x,"pnorm",mean=mean(x),sd=sqrt(var(x)))

解得,

One-sampleKolmogorov-Smirnovtest

data:

x

D=0.1944,p-value=0.9229

alternativehypothesis:

two-sided

因此,可得p-value=0.9229>0.05,可以认为检验数据来自正态分布的总体。

(4)分析三种方法,通过Kolmogorov-Smirnov来检验,编写程序,

>x<-c(113,120,138,120,100,118,138,123)

>y<-c(138,116,125,136,110,132,130,110)

>ks.test(x,y)

Two-sampleKolmogorov-Smirnovtest

data:

xandy

D=0.375,p-value=0.6272

alternativehypothesis:

two-sided

p-value=0.6272>0.05,故认为两方法的效果相同

因此可知,第三种分析方法比较精确而且考虑多种情况,因此可以认为其结果真实可靠。

解:

设H0:

老年人口比重为14.7%,H1:

老年人口比重不为14.7%。

编写程序,

binom.test(57,400,p=0.147,conf.level=0.95)

解得,

Exactbinomialtest

data:

57and400

numberofsuccesses=57,numberoftrials=400,p-value=0.8876

alternativehypothesis:

trueprobabilityofsuccessisnotequalto0.147

95percentconfidenceinterval:

0.10974770.1806511

sampleestimates:

probabilityofsuccess

0.1425

因此可得,p-value=0.8876>0.05,由二项式的总体检验可知,不能拒绝原假设,所以该市老年人口比重为14.7%。

解:

由题可得,假设:

H0:

p1=9/16,p2=p3=3/16,p4=1/16,

编写程序,

chisq.test(c(315,101,108,32),p=c(9,3,3,1)/16)

解得,

Chi-squaredtestforgivenprobabilities

data:

c(315,101,108,32)

X-squared=0.47,df=3,p-value=0.9254

因此,可得p-value=0.9254>0.05,故假设成立,结果符合自由组合规律。

解:

编写程序,

X<-0:

5;Y<-c(92,68,28,11,1,0)

q<-ppois(X,mean(rep(X,Y)));

n<-length(Y)

p<-numeric(n);

p[1]<-q[1];

p[n]<-1-q[n-1];

for(iin2:

(n-1))

p[i]<-q[i]-q[i-1]

chisq.test(Y,p=p)

解得,

Chi-squaredtestforgivenprobabilities

data:

Y

X-squared=2.1596,df=5,p-value=0.8267

Warningmessage:

Inchisq.test(Y,p=p):

Chi-squared近似算法有可能不准

重新分组以满足Poisson分布,编写程序,

Z<-c(92,68,28,12)

n<-length(Z);p<-p[1:

n-1];p[n]<-1-q[n-1]

chisq.test(Z,p=p)

解得,

Chi-squaredtestforgivenprobabilities

data:

Z

X-squared=0.9113,df=3,p-value=0.8227

因此,可得p-value=0.8227>0.1,因此可以认为每分钟顾客数X服从Poisson分布。

解:

根据题意,假设:

H0:

使用电子仪器与剖腹产两者独立。

编写程序并求解

>x<-c(358,2492,229,2745)

>dim(x)<-c(2,2)

>chisq.test(x,correct=FALSE)

Pearson'sChi-squaredtest

data:

x

X-squared=37.9488,df=1,

p-value=7.263e-10

因此,可得p-value=7.263e-10<0.05,因此原假设不成立,使用电子仪器与剖腹产有关。

解:

根据题意,假设:

H0:

工艺一与工艺二相互独立,编写程序并求解,

x<-c(3,6,4,4);dim(x)<-c(2,2)

fisher.test(x)

Fisher'sExactTestforCount

Data

data:

x

p-value=0.6372

alternativehypothesis:

trueoddsratioisnotequalto1

95percentconfidenceinterval:

0.046243825.13272210

sampleestimates:

oddsratio

0.521271

因此,可得p-value=0.6372>0.05,且1包含在置信区间内,说明两者相互独立,可认为工艺一与工艺二互相独立。

解:

(1)编写程序,

x<-c(3,5,7,9,10)

y<-c(1,2,4,6,8)

wilcox.test(x,y,alternative="greater")

解得,

Wilcoconranksumtest

data:

xandy

w=19,p-value=0.1111

alternativehypothesis:

truelocationshiftisgreaterthan0

因此,可得p-value=0.1111>0.05,无法确定新方法是否显著地提高了教学效果。

(2)编写程序,

x<-c(4,6,7,9,10)

y<-c(1,2,3,5,8)

wilcox.test(x,y,alternative="greater")

解得,

Wilcoconranksumtest

data:

xandy

w=21p-value=0.04762

alternativehypothesis:

truelocationshiftisgreaterthan0

因此,可得p-value=0.04762<0.05,所以可以认为新方法有一定的提高效果。

解:

根据题意,假设:

H0:

新旧疗法相同,H1:

新疗法优于原疗法的效果。

编写程序并求解,轻重1-5分别代表5个等级,1为差,5为好,

>x<-rep(1:

5,c(0,1,9,7,3))

>y<-rep(1:

5,c(2,2,11,4,1))

>

>wilcox.test(x,y,exact=FALSE)

Wilcoxonranksumtestwithcontinuitycorrection

data:

xandy

W=266,p-value=0.05509

alternativehypothesis:

truelocationshiftisnotequalto0

因此,可得p-value=0.05509>0.5,可认为新旧疗法效果相同。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 其它语言学习

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1