Sample Size for A / B Test Significance

Given the results for a simple A / B test ...

AB clicked 8 60 ignored 192 1940 

(i.e., conversation speed A 4% and B 3%)

... the fishing test in R rightly says that there is no significant difference

 > fisher.test(data.frame(A=c(8,192), B=c(60,1940))) ... p-value = 0.3933 ... 

But what function is available in R to tell me how much I need to increase the sample size to get a p value, say 0.05?

I could just increase the values ​​of A (in proportion) until I get to it, but should there be a better way? Perhaps pwr.2p2n.test [1] is somehow useful?

[1] http://rss.acs.unt.edu/Rdoc/library/pwr/html/pwr.2p2n.test.html

+6
source share
1 answer

power.prop.test() should do it for you. To get the math to work, I converted your β€œignored” data into impressions by summing up my columns.

 > power.prop.test(p1=8/200, p2=60/2000, power=0.8, sig.level=0.05) Two-sample comparison of proportions power calculation n = 5300.739 p1 = 0.04 p2 = 0.03 sig.level = 0.05 power = 0.8 alternative = two.sided NOTE: n is number in *each* group 

This gives 5301 that for each group, so your sample size should be 10,600. Subtracting 2,200 that have already been run, you have 8,400 "tests."

In this case:

  • sig.level matches your p value.
  • power is the probability of finding significant results that exist in your example. This is somewhat arbitrary, 80% is a common choice. Please note that choosing 80% means that in 20% of cases you will not find the value when you want. Increasing power means you will need a larger sample size to achieve your desired level of significance.

If you decide how long it takes to achieve value, divide 8400 by the number of impressions per day. This may help determine whether to continue the test.

You can also use this function to determine the required sample size before testing. There's a nice entry describing this on the 37 Signals blog.

This is a built-in R function, so you do not need to add or download any packages. Other than that, I can't say how much this looks like pwr.p2pn.test() .

+7
source

Source: https://habr.com/ru/post/917279/


All Articles