library(effectsize)
# Example:
# d = 0.60, nA = 50, nB = 70
# calculate and display odds ratio
d_to_oddsratio(d = 0.60,
n1 = 50,
n2 = 70)
[1] 2.969162
collaboration, confidence interval, effect size, open educational resource, open scholarship, open science
We can calculate an odds-ratio from a between groups cohen’s \(d\) (\(d_p\)):
\[ OR = \exp\left(\frac{d_p \pi}{\sqrt{3}}\right) \tag{17.1}\]
Where \(\exp(\cdot)\) is an exponential transformation (this inverses the logarithm). Using the d_to_oddsratio()
function in the effectsize
package we can convert \(d\) to \(OR\).
library(effectsize)
# Example:
# d = 0.60, nA = 50, nB = 70
# calculate and display odds ratio
d_to_oddsratio(d = 0.60,
n1 = 50,
n2 = 70)
[1] 2.969162
We can calculate an odds ratio from a point-biserial correlation using the following formula:
\[ OR = \exp\left(\frac{r\pi \sqrt{\frac{n_A+n_B-2}{n_A} + \frac{n_A+n_B-2}{n_B}}}{\sqrt{3(1-r^2)}}\right) \tag{17.2}\]
When sample sizes are equal, this equation can be simplified to be approximately,
\[ OR = \exp\left(\frac{r\pi \sqrt{4}}{\sqrt{3(1-r^2)}}\right) \tag{17.3}\]
Using the r_to_oddsratio()
function in the effectsize
package we can convert \(r\) to \(OR\).
library(effectsize)
# Example:
# r = .50, n1 = 50, n2 = 70
# calculate and display odds ratio
r_to_oddsratio(r = .50,
n1 = 50,
n2 = 70)
[1] 8.120527