|
1 | 1 | #' Interpret Odds Ratio |
2 | 2 | #' |
3 | 3 | #' @param OR Value or vector of (log) odds ratio values. |
4 | | -#' @param rules Can be "`chen2010"` (default), `"cohen1988"` (through |
5 | | -#' transformation to standardized difference, see [oddsratio_to_d()]) or custom set |
6 | | -#' of [rules()]. |
| 4 | +#' @param rules If `"cohen1988"` (default), `OR` is transformed to a |
| 5 | +#' standardized difference (via [oddsratio_to_d()]) and interpreted according |
| 6 | +#' to Cohen's rules (see [interpret_cohens_d()]; see Chen et al., 2010). If a |
| 7 | +#' custom set of [rules()] is used, OR is interpreted as is. |
7 | 8 | #' @param log Are the provided values log odds ratio. |
8 | 9 | #' @inheritParams interpret |
| 10 | +#' @inheritParams oddsratio_to_d |
9 | 11 | #' |
10 | 12 | #' @section Rules: |
11 | 13 | #' |
12 | 14 | #' Rules apply to OR as ratios, so OR of 10 is as extreme as a OR of 0.1 (1/10). |
13 | 15 | #' |
14 | | -#' - Chen et al. (2010) (`"chen2010"`; default) |
15 | | -#' - **OR < 1.68** - Very small |
16 | | -#' - **1.68 <= OR < 3.47** - Small |
17 | | -#' - **3.47 <= OR < 6.71** - Medium |
18 | | -#' - **OR >= 6.71 ** - Large |
19 | 16 | #' - Cohen (1988) (`"cohen1988"`, based on the [oddsratio_to_d()] conversion, see [interpret_cohens_d()]) |
20 | 17 | #' - **OR < 1.44** - Very small |
21 | 18 | #' - **1.44 <= OR < 2.48** - Small |
22 | 19 | #' - **2.48 <= OR < 4.27** - Medium |
23 | | -#' - **OR >= 4.27 ** - Large |
| 20 | +#' - **OR >= 4.27** - Large |
24 | 21 | #' |
25 | 22 | #' @examples |
26 | 23 | #' interpret_oddsratio(1) |
|
40 | 37 | #' |
41 | 38 | #' @keywords interpreters |
42 | 39 | #' @export |
43 | | -interpret_oddsratio <- function(OR, rules = "chen2010", log = FALSE, ...) { |
44 | | - if (log) { |
45 | | - f_transform <- function(.x) exp(abs(.x)) |
46 | | - } else { |
47 | | - f_transform <- function(.x) exp(abs(log(.x))) |
48 | | - } |
49 | | - |
50 | | - |
| 40 | +interpret_oddsratio <- function(OR, rules = "cohen1988", p0 = NULL, log = FALSE, ...) { |
51 | 41 | if (is.character(rules) && rules == "cohen1988") { |
52 | | - d <- oddsratio_to_d(OR, log = log) |
| 42 | + d <- oddsratio_to_d(OR, p0, log = log) |
53 | 43 | return(interpret_cohens_d(d, rules = rules)) |
54 | 44 | } |
55 | 45 |
|
56 | | - rules <- .match.rules( |
57 | | - rules, |
58 | | - list( |
59 | | - chen2010 = rules(c(1.68, 3.47, 6.71), c("very small", "small", "medium", "large"), |
60 | | - name = "chen2010", right = FALSE |
61 | | - ), |
62 | | - cohen1988 = NA # for correct error msg |
63 | | - ) |
64 | | - ) |
| 46 | + if (log) { |
| 47 | + OR <- exp(OR) |
| 48 | + } |
65 | 49 |
|
66 | | - interpret(OR, rules, transform = f_transform) |
| 50 | + interpret(OR, rules, transform = function(.x) ifelse(.x < 1, 1 / .x, .x)) |
67 | 51 | } |
0 commit comments