我正在尝试测试一些抽样个体的性别比例是否与预期的性别比例 1 显着不同。我有 n = 64,其中女性 = 34,男性 = 30。
我进行了二项式检验:
succ <- c(34,30)
binom.test(succ,0.5)
data: succ
number of successes = 34, number of trials = 64, p-value = 0.708
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
0.4023098 0.6572035
sample estimates:
probability of success
0.53125
我想计算这个测试的统计功效,我知道power = 1-β,其中 β 是 II 型错误。
阅读此解释时,我感到困惑。我不明白如何使这个公式(对于 n 的不同选择)适应我的情况:
enn = 1:2000
critical = qbinom(.025, enn, .5)
beta = pbinom(enn-critical,enn,.55) - pbinom(critical-1,enn,.55)
我所做的是
1-(pbinom(34,64,0.5)- pbinom(30, 64, .5))
[1] 0.7410237
但我不确定使用 0.5 作为概率是否正确。此外,我尝试了不同的方法,得到了完全不同的结果
pwr.p.test(ES.h(.53125,.5),n=64, power=NULL, alternative = "two.sided")
proportion power calculation for binomial distribution (arcsine transformation)
h = 0.06254076
n = 64
sig.level = 0.05
power = 0.07913605
alternative = two.sided
这两个测试之一是否正确,为什么?
谢谢你的帮助!
