Skip to main content
Complete re-write.
Source Link
Sal Mangiafico
  • 11.8k
  • 2
  • 17
  • 37

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.

The usual effect size statistic for a 2 x 2 table associated with a chi-square test of association is phi. For larger tables, the usual statistic is Cramér's V.

Both dat_0 and dat_0_better yield a phi of 0.

Try for example:

library(vcd) assocstats(dat_0) assocstats(dat_0_better) 

Complete re-write:

I think the correct approach to calculating Cohen's w is to use the expected values for the P0 values. I looked back at Cohen (1988), and this isn't precisely clear, but I think that's the intention.

So the problem is that your second case (dat_0_better) doesn't represent the expected values for dat, but those for dat_0 does.

chisq.test(dat)$expected ### [,1] [,2] ### [1,] 20 20 ### [2,] 30 30 

So the calculation of w in the first case, I believe, is correct † .

library(rcompanion) cohenW(dat)  ### 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.

Source Link
Sal Mangiafico
  • 11.8k
  • 2
  • 17
  • 37

The usual effect size statistic for a 2 x 2 table associated with a chi-square test of association is phi. For larger tables, the usual statistic is Cramér's V.

Both dat_0 and dat_0_better yield a phi of 0.

Try for example:

library(vcd) assocstats(dat_0) assocstats(dat_0_better)