
236
|
第
9
章
的
p
值则不能提供这样的证据。
9.11.3 讨论
假设你在棒球赛季开始时遇到芝加哥小熊队吼叫着的粉丝。小熊队已经打了 20 场比赛,
赢了 11 场比赛,或者说赢得 55%的比赛。基于这些证据,球迷“非常自信”小熊队将
在今年赢得一半以上的比赛。他们应该那么自信吗?
prop.test 函数可以评估球迷的逻辑。在这里,观察的数量是
n
= 20,成功的数量是
x
=
11,
p
是赢得比赛的真实概率。我们想知道基于这些数据得出
p
> 0.5 是否合理。通常
情况下,prop.test 会检验
p
≠
0.05 的情况,但我们可以通过设置 alternative=
"greater" 来检查
p
> 0.5:
prop.test(11, 20, 0.5, alternative = "greater")
#>
#> 1-sample proportions test with continuity correction
#>
#> data: 11 out of 20, null probability 0.5
#> X-squared = 0.05, df = 1, p-value = 0.4
#> alternative hypothesis: true p is greater than 0.5
#> 95 percent confidence interval:
#> 0.35 1.00
#> sample estimates:
#> p
#
> 0.55
函数 prop.test 的输出显示一个大的
p
值, ...