File: convert_p_OR_RR.Rmd

package info (click to toggle)
r-cran-effectsize 1.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,544 kB
  • sloc: sh: 17; makefile: 2
file content (133 lines) | stat: -rw-r--r-- 3,858 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
title: "Converting Between Probabilities, Odds (Ratios), and Risk Ratios"
output: 
  rmarkdown::html_vignette:
    toc: true
    fig_width: 10.08
    fig_height: 6
tags: [r, effect size, rules of thumb, guidelines, conversion]
vignette: >
  \usepackage[utf8]{inputenc}
  %\VignetteIndexEntry{Converting Between Probabilities, Odds (Ratios), and Risk Ratios}
  %\VignetteEngine{knitr::rmarkdown}
editor_options: 
  chunk_output_type: console
bibliography: bibliography.bib
---

```{r message=FALSE, warning=FALSE, include=FALSE}
library(knitr)
options(knitr.kable.NA = "")
knitr::opts_chunk$set(comment = ">")
options(digits = 3)
```

The `effectsize` package contains function to convert among indices of effect
size. This can be useful for meta-analyses, or any comparison between different
types of statistical analyses.

# Converting Between *p* and Odds

Odds are the ratio between a probability and its complement:

$$
Odds = \frac{p}{1-p}
$$

$$
p = \frac{Odds}{Odds + 1}
$$
Say your bookies gives you the odds of Doutelle to win the horse race at 13:4, what is the probability Doutelle's will win?

Manually, we can compute $\frac{13}{13+4}=0.765$. Or we can

Odds of 13:4 can be expressed as $(13/4):(4/4)=3.25:1$, which we can convert:

```{r}
library(effectsize)

odds_to_probs(13 / 4)

# or
odds_to_probs(3.25)

# convert back
probs_to_odds(0.764)
```

Will you take that bet?

## Odds are *not* Odds Ratios


Note that in logistic regression, the non-intercept coefficients represent the (log) odds ratios, not the odds.

$$
OR = \frac{Odds_1}{Odds_2} = \frac{\frac{p_1}{1-p_1}}{\frac{p_2}{1-p_2}}
$$
The intercept, however, *does* represent the (log) odds, when all other variables are fixed at 0.

# Converting Between Odds Ratios, Risk Ratios and Absolute Risk Reduction

Odds ratio, although popular, are not very intuitive in their interpretations.
We don't often think about the chances of catching a disease in terms of *odds*,
instead we instead tend to think in terms of *probability* or some event - or
the *risk*. Talking about *risks* we can also talk about the *change in risk*,
either as a *risk ratio* (*RR*), or a(n *absolute) risk reduction* (ARR).

For example, if we find that for individual suffering from a migraine, for every
bowl of brussels sprouts they eat, their odds of reducing the migraine
increase by an $OR = 3.5$ over a period of an hour. So, should people eat
brussels sprouts to effectively reduce pain? Well, hard to say... Maybe if we
look at *RR* we'll get a clue.

We can convert between *OR* and *RR* for the following formula
[@grant2014converting]:

$$
RR = \frac{OR}{(1 - p0 + (p0 \times OR))}  
$$

Where $p0$ is the base-rate risk - the probability of the event without the
intervention (e.g., what is the probability of the migraine subsiding within an
hour without eating any brussels sprouts). If it the base-rate risk is, say,
85%, we get a *RR* of:

```{r}
OR <- 3.5
baserate <- 0.85

(RR <- oddsratio_to_riskratio(OR, baserate))
```

That is - for every bowl of brussels sprouts, we increase the chances of
reducing the migraine by a mere 12%! Is if worth it? Depends on you affinity to
brussels sprouts...

Similarly, we can look at ARR, which can be converted via

$$
ARR = RR \times p0 - p0
$$
```{r}
riskratio_to_arr(RR, baserate)
```

Or directly:

```{r}
oddsratio_to_arr(OR, baserate)
```

Note that the base-rate risk is crucial here. If instead of 85% it was only 4%,
then the *RR* would be:

```{r}
oddsratio_to_riskratio(OR, 0.04)
```

That is - for every bowl of brussels sprouts, we increase the chances of
reducing the migraine by a whopping 318%! Is if worth it? I guess that still
depends on your affinity to brussels sprouts...

# References