文档详情

统计建模与R软件第五章课后习题答案.docx

发布:2018-01-17约1.09万字共13页下载文档
文本预览下载声明
统计建模与R软件第五章习题答案(假设检验)Ex5.1 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,mu=225) One Sample t-testdata:? xt = -3.4783, df = 19, p-value = 0.002516alternative hypothesis: true mean is not equal to 22595 percent confidence interval:?172.3827 211.9173sample estimates:mean of x 192.15原假设:油漆工人的血小板计数与正常成年男子无差异。备择假设:油漆工人的血小板计数与正常成年男子有差异。p值小于0.05,拒绝原假设,认为油漆工人的血小板计数与正常成年男子有差异。上述检验是双边检验。也可采用单边检验。备择假设:油漆工人的血小板计数小于正常成年男子。 t.test(x,mu=225,alternative=less) One Sample t-testdata:? xt = -3.4783, df = 19, p-value = 0.001258alternative hypothesis: true mean is less than 22595 percent confidence interval: -Inf 208.4806sample estimates:mean of x 192.15同样可得出油漆工人的血小板计数小于正常成年男子的结论。Ex5.2 pnorm(1000,mean(x),sd(x))[1] 0.5087941 x?[1] 1067? 919 1196? 785 1126? 936? 918 1156? 920? 948 pnorm(1000,mean(x),sd(x))[1] 0.5087941x=1000的概率为0.509,故x大于1000的概率为0.491.要点:pnorm计算正态分布的分布函数。在R软件中,计算值均为下分位点。Ex5.3 A-c(113,120,138,120,100,118,138,123) B-c(138,116,125,136,110,132,130,110) t.test(A,B,paired=TRUE) Paired t-testdata:? A and Bt = -0.6513, df = 7, p-value = 0.5357alternative hypothesis: true difference in means is not equal to 095 percent confidence interval:?-15.62889?? 8.87889sample estimates:mean of the differences -3.375p值大于0.05,接受原假设,两种方法治疗无差异。Ex5.4(1)正态性W检验:x-c(-0.7,-5.6,2,2.8,0.7,3.5,4,5.8,7.1,-0.5,2.5,-1.6,1.7,3,0.4,4.5,4.6,2.5,6,-1.4)y-c(3.7,6.5,5,5.2,0.8,0.2,0.6,3.4,6.6,-1.1,6,3.8,2,1.6,2,2.2,1.2,3.1,1.7,-2) shapiro.test(x) Shapiro-Wilk normality testdata:? xW = 0.9699, p-value = 0.7527 shapiro.test(y) Shapiro-Wilk normality testdata:? yW = 0.971, p-value = 0.7754ks检验: ks.test(x,pnorm,mean(x),sd(x)) One-sample Kolmogorov-Smirnov testdata:? xD = 0.1065, p-value = 0.977alternative hypothesis: two-sidedWarning message:In ks.test(x, pnorm, mean(x), sd(x)) : cannot compute correct p-values with ties ks.test(y,pnorm,mean(y),sd(y)) One-sample Kolmogorov-Smirnov testdata:? yD = 0.1197, p-value = 0.9368alternative hypothesis: two-sid
显示全部
相似文档