p0 <- 0.4
p1 <- 0.7
(OR <- probs_to_odds(p1) / probs_to_odds(p0))
(RR <- p1 / p0)
riskratio_to_oddsratio(RR, p0 = p0)
oddsratio_to_riskratio(OR, p0 = p0)
m <- glm(am ~ factor(cyl),
data = mtcars,
family = binomial()
)
oddsratio_to_riskratio(m, verbose = FALSE) # RR is relative to the intercept if p0 not provided
Run the code above in your browser using DataLab