power.prop.test函数不可互换

时间:2018-02-21 17:52:19

标签: r statistics ab-testing significance abtest

我正在使用R中的power.prop.test函数。

我正在进行A / B测试,我确定每组最小印象数的升力,以便A / B测试显着。

当我运行如下函数时,我得到第二个比例(p2)为0.0001870215,其中n为每组2,571,429:

original_conversion_rate<-0.00009

power.prop.test(n=2571429,
  p1=original_conversion_rate, 
            power=0.8, 
            sig.level=0.05)

我的回答是:

     Two-sample comparison of proportions power calculation 

          n = 2571429
         p1 = 9e-05
         p2 = 0.0001870215
  sig.level = 0.05
      power = 0.8
alternative = two.sided

NOTE: n is number in *each* group

当我用p2(0.0001870215)的答案重新运行来解决n时,出现了不同的n(230,952.6):

original_conversion_rate<-0.00009

power.prop.test(
  p1=original_conversion_rate, 
  p2=0.0001870215,
            power=0.8, 
            sig.level=0.05)

我的更改为:

 Two-sample comparison of proportions power calculation 

          n = 230952.6
         p1 = 9e-05
         p2 = 0.0001870215
  sig.level = 0.05
      power = 0.8
alternative = two.sided

为什么在这种情况下会改变?

1 个答案:

答案 0 :(得分:1)

您的频率非常小,微小的变化会产生巨大的影响 - 尤其是power.prop.test中使用的默认容差级别。

如果再多花一次,你就得到了

power.prop.test(n=230952.5,
  p1=original_conversion_rate, 
            power=0.8, 
            sig.level=0.05)

     Two-sample comparison of proportions power calculation 

              n = 230952.5
             p1 = 9e-05
             p2 = 0.0001870215
      sig.level = 0.05
          power = 0.8
    alternative = two.sided

NOTE: n is number in *each* group

p2的值相同。现在,如果我们回到你的第一次计算并降低我们得到的公差

power.prop.test(n=2571429,
  p1=original_conversion_rate, 
            power=0.8, 
            sig.level=0.05, tol=.Machine$double.eps^.8) 

     Two-sample comparison of proportions power calculation 

              n = 2571429
             p1 = 9e-05
             p2 = 0.0001150142
      sig.level = 0.05
          power = 0.8
    alternative = two.sided

NOTE: n is number in *each* group

您可以看到p2已更改。如果我们插入p2的更新值并求解n,我们就会得到

power.prop.test(
  p1=original_conversion_rate, 
  p2=0.0001150142,
            power=0.8, 
            sig.level=0.05)

     Two-sample comparison of proportions power calculation 

              n = 2571429
             p1 = 9e-05
             p2 = 0.0001150142
      sig.level = 0.05
          power = 0.8
    alternative = two.sided

NOTE: n is number in *each* group

你得到的是n