The usual effect size statistic for a 2 x 2 table associated with a chi-square test of association is phiComplete re-write:. For larger tables,
I think the usual statisticcorrect approach to calculating Cohen's w is Cramér'sto use the expected values for the VP0 values. I looked back at Cohen (1988), and this isn't precisely clear, but I think that's the intention.
BothSo the problem is that your second case (dat_0dat_0_better and) doesn't represent the expected values for dat_0_betterdat yield a, but those for phi of 0dat_0 does.
chisq.test(dat)$expected ### [,1] [,2] ### [1,] 20 20 ### [2,] 30 30 Try for example:So the calculation of w in the first case, I believe, is correct † .
library(vcdrcompanion) assocstatscohenW(dat_0dat) assocstats(dat_0_better) ### Cohen w ### 0.4082 The table that you've constructed with dat includes the information that the control treatment results in 10 out of 50. This is taken into account with the expected values of the table, so I don't think you need to alter the null hypothesis to account for this.
I think what I'm saying makes sense in the standard sample size calculation. It's the case that those before us did the hard work.
† Caveat: I am the author of the rcompanion package. I don't know of another package in R that calculates Cohen's w, though I would suspect there are some.