一.问题
有来自小组的样品。 根据样本估计该集团的平均置信区间。
二.解决办法
用t.test函数处理样本x :
代码
我是t.test(x )
函数的输出包含95%的可靠置信区间。 可以通过conf.level参数调整置信度,并查看其他置信度部分。
如果样本数n很小,只有当群体整体服从正太分布时才能得到有意义的置信区间。 通常,n30被认为样本数很少。
三.讨论
在t.test函数中处理向量输出的内容不少。 其中重要的是信任区间
代码
x
我是t.test(x )
One Sample t-test
数据: x
t=59.2578,df=49,p-value 2.2e-16
alternative hypothesis 3360 truemeanisnotequalto 0
95个人会议:
97.16167 103.98297
sample estimates:
mean of x
100.5723
在这个示例中,置信区间约为97.16 103.98,可以省略为(97.16,103.98 )。
通过设置conf.level=0.99,可以将可靠性级别提高到99%。
代码
t.test(x,conf.level=0.99 ) )。
One Sample t-test
数据: x
t=59.2578,df=49,p-value 2.2e-16
alternative hypothesis 3360 truemeanisnotequalto 0
99个人会议:
96.0239 105.1207
sample estimates:
mean of x
100.5723
由此,将信赖区间扩大到96.02 105.12。
结束。
资料来源:数据分析网络