
234
|
第
9
章
t.test(x)
#>
#> One Sample t-test
#>
#> data: x
#> t = 50, df = 50, p-value <2e-16
#> alternative hypothesis: true mean is not equal to 0
#> 95 percent confidence interval:
#> 94.2 101.5
#> sample estimates:
#> mean of x
#> 97.9
在此示例中,置信区间约为 94.2
<
μ
<
101.5,有时简单写为 (94.2,101.5)。
我们可以通过设置 conf.level=0.99,将置信度提高到 99%:
t.test(x, conf.level = 0.99)
#>
#> One Sample t-test
#>
#> data: x
#> t = 50, df = 50, p-value <2e-16
#> alternative hypothesis: true mean is not equal to 0
#> 99 percent confidence interval:
#> 92.9 102.8
#> sample estimates:
#> mean of x
#> 97.9
上述变化将置信区间扩大至 92.9<
μ
<102.8。
9.10 中位数的置信区间
9.10.1 问题
你有一个样本数据,并且你想知道中位数的置信区间。
9.10.2 解决方案
使用 wilcox.test ...