The chi-square test of independence only tests for whether there is a relationship between the variables, though, not that there is no difference between CTR:
H0: Click-through and interface are independent.
Ha: Click-through and interface are not independent (that is, something interesting is going on; one of your interfaces is performing better)
You would prepare the test like this:
success <- c(10,21)
failure <- c(55990,77979)
my.table <- rbind(success,failure)
And then run the test:
> chisq.test(my.table)
Pearson's Chi-squared test with Yates' continuity correction
data: my.table
X-squared = 0.79955, df = 1, p-value = 0.3712
You get the same results as the previous respondent when you turn off the continuity correction (which many argue you don't need at all, unless you have less than 5 clicks on either A or B):
> chisq.test(my.table, correct=FALSE)
Pearson's Chi-squared test
data: my.table
X-squared = 1.1584, df = 1, p-value = 0.2818
You can easily access your expected value table and compute the chi-square test statistic manually if you want:
> chisq.test(my.table, correct=FALSE)$expected
[,1] [,2]
success 12.95522 18.04478
failure 55987.04478 77981.95522
An alternative would be the two-proportion zitest, which says:
H0: CTR of B - CTR of A = 0
Ha: CTR of B - CTR of A > 0 (B has a bigger CTR)
> source("https://raw.githubusercontent.com/NicoleRadziwill/R-Functions/master/z2test.R")
> z2.test(10,55990,21,77979)
$estimate
[1] -9.069995e-05
$ts.z
[1] -1.076516
$p.val
[1] 0.1408483
$cint
[1] -2.504372e-04 6.903728e-05
Notice that the p-value is large (0.14) and the confidence interval includes the value zero -- there's no difference between your A and B CTRs.
You could also use a chi-square test statistic to run the test and get a confidence interval:
> prop.test(c(10,21),c(55990,77979))
2-sample test for equality of proportions with continuity correction
data: c(10, 21) out of c(55990, 77979)
X-squared = 0.79999, df = 1, p-value = 0.3711
alternative hypothesis: two.sided
95 percent confidence interval:
-2.657756e-04 8.437566e-05
sample estimates:
prop 1 prop 2
0.0001786033 0.0002693033
Notice that the p-value is the same as when you ran the chi-square test of independence earlier, and the confidence interval also includes zero in it.... indicating no significant difference between CTRs for your A and B.
CTR
simplyClicks/Impressions
? If so, why not say so in your question? $\endgroup$