tbates / umx

Making Structural Equation Modeling (SEM) in R quick & powerful
https://tbates.github.io/
44 stars 17 forks source link

oddsratio: accept raw odds #102

Closed tbates closed 4 years ago

tbates commented 4 years ago

currently user says:

oddsratio(grp1=c(n=11, N=15), grp2 = c(n=2, N=15))

let's allow:

oddsratio(grp1=11/4, grp2 = 2/13)
mcneale commented 4 years ago

Odds ratios are bad measures of association. When base rates differ, the same odds ratio can represent very different degrees of association/correlation. I suggest that this warning be added to all odds ratio output.

tbates commented 4 years ago

Yeah… oddsratio is just a convenience function for me to decode stats reported in medical papers where they turn small effects into large odds ratios :-)

Added deg2rad and rad2deg also: how can R not have those, when its trig funs are in radians... oh well.

Tangentially, we're writing up a replication of a study that had n= 30 divided between 2 groups. In group1, just 4 of 15 subjects responded, in group2: 11 of 15...

Post-hoc power analysis χ² suggests n = 10 gives 99% power to replicate… We ran with n= 30 and got… p = 0.6 Science train badly off the rails :-(

Oh well, learned how to compute a χ² effect size.

Imagine if R was around in the 80s when Cohen and power hit the headlines… might have rippled much faster with open-source...

library(pwr)
ES.w1(c(11/15,  4/15), c( 2/15, 13/15))

effect size = 1.36 !! in education...

tbates commented 4 years ago
oddsratio(grp1 = c(n= 1, N= 10), grp2 = c(n = 3, N = 10))
Group 1 odds = 0.111
Group 2 odds = 0.429
          OR = 0.259 CI95 [0.023, 2.936]

note: When base rates differ, a given odds ratio can represent very different degrees of association/correlation

oddsratio(grp1 = 1/9, grp2 = 3/9)
Group 1 odds = 0.111
Group 2 odds = 0.333
          OR = 0.333 (input odds as c(n=, N=) to compute CI)
note: When base rates differ, a given odds ratio can represent very different degrees of association/correlation