Learn R Programming

effectsize (version 0.8.3)

oddsratio_to_riskratio: Convert Between Odds Ratios and Risk Ratios

Description

Convert Between Odds Ratios and Risk Ratios

Usage

oddsratio_to_riskratio(OR, p0, log = FALSE, verbose = TRUE, ...)

riskratio_to_oddsratio(RR, p0, log = FALSE, verbose = TRUE, ...)

Value

Converted index, or if OR is a logistic regression model, a parameter table with the converted indices.

Arguments

OR, RR

Risk ratio of p1/p0 or Odds ratio of odds(p1)/odds(p0), possibly log-ed. OR can also be a logistic regression model.

p0

Baseline risk

log

Take in or output the log of the ratio (such as in logistic models).

verbose

Toggle warnings and messages on or off.

...

Arguments passed to and from other methods.

References

Grant, R. L. (2014). Converting an odds ratio to a range of plausible relative risks for better communication of research findings. Bmj, 348, f7450.

See Also

oddsratio() and riskratio()

Other convert between effect sizes: d_to_r(), diff_to_cles, eta2_to_f2(), odds_to_probs()

Examples

Run this code
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