资源描述:
《统计学r上机,区间估计与假设检验 》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、4、区间估计和假设检验1一个总体的均值的区间估计1.1单个总体均值的区间估计:正态分布,标准差已知zsum.test(mean.x,sigma.x=NULL,n.x=NULL,mean.y=NULL,sigma.y=NULL,n.y=NULL,alternative=c("two.sided","less“,"greater"),mu=0,conf.level=0.95)例6.2:library(PASWR2)zsum.test(2500,sigma.x=100,n.x=9,conf.level=0.95)c(2500-qnorm(0.025,lower.tail=
2、F)*100/sqrt(9),2500+qnorm(0.025,lower.tail=F)*100/sqrt(9))例6.3library(PASWR2)zsum.test(39.5,sigma.x=7.2,n.x=36,conf.level=0.99)1.2单个总体均值的区间估计:正态分布,标准差未知利用t分布公式:例6–4library(PASWR2)tsum.test(mean.x=2500,s.x=100,n.x=9,conf.level=0.95)c(2500-qt(0.05/2,8,lower.tail=F)*100/sqrt(9),2500+qt(0.
3、05/2,8,lower.tail=F)*100/sqrt(9))例6–5library(PASWR2)tsum.test(mean.x=39.5,s.x=7.2,n.x=36,conf.level=0.99)1.1大样本下均值的区间估计例6–6library(PASWR2)zsum.test(mean.x=3319,sigma.x=3033.4,n.x=250,conf.level=0.98)2两个总体的均值差的区间估计2.1两总体均值差的区间估计:方差已知例6–7library(PASWR2)zsum.test(mean.x,sigma.x=NULL,n.x=N
4、ULL,mean.y=NULL,sigma.y=NULL,n.y=NULL,alternative=c("two.sided","less","greater"),mu=0,conf.level=0.95,...)zsum.test(mean.x=22,sigma.x=sqrt(10),n.x=25,mean.y=20,sigma.y=sqrt(10),n.y=16,conf.level=0.95)1.1两总体均值差的区间估计:方差未知但相等例6.8library(PASWR2)tsum.test(mean.x,s.x=NULL,n.x=NULL,mean.y=NU
5、LL,s.y=NULL,n.y=NULL,alternative=c("two.sided","less","greater"),mu=0,var.equal=FALSE,conf.level=0.95,...)tsum.test(mean.x=22,s.x=sqrt(9),n.x=25,mean.y=20,s.y=sqrt(10),n.y=16,var.equal=TRUE,conf.level=0.95)1.2大样本下两总体均值差的区间估计例6.9library(PASWR2)zsum.test(mean.x=650,sigma.x=120,n.x=50,mea
6、n.y=480,sigma.y=106,n.y=50,conf.level=0.95)2总体比例的区间估计例6.10library(PASWR2)zsum.test(mean.x=0.9,sigma.x=sqrt(0.9*0.1),n.x=100,conf.level=0.95)#用prop.test(x,n,p)函数可以算出更准确的值:prop.test(90,100,conf.level=0.95)1两总体比例差的区间估计例6.11library(PASWR2)zsum.test(mean.x=0.48,sigma.x=sqrt(0.48*0.52),n.x=5
7、000,mean.y=0.6,sigma.y=sqrt(0.6*0.4),n.y=2000,conf.level=0.9)2正态总体方差的区间估计例6.12c(14*1.65^2/qchisq(0.05,14,lower.tail=F),14*1.65^2/qchisq(0.95,14,lower.tail=F))3两个正态总体方差比的区间估计例6.13c(64/49/qf(0.01,24,15,lower.tail=F),64/49/qf(0.01,24,15))4样本容量的确定例6.14qnorm((1-0.9545)/2,lower.tail=F)^2*2