Odds ratios
Odds ratios
A study investigated whether a handheld device that sends a magnetic pulse into a person’s head might be an effective treatment for migraine headaches.
What is the explanatory variable?
A study investigated whether a handheld device that sends a magnetic pulse into a person’s head might be an effective treatment for migraine headaches.
What type of variable is this?
A study investigated whether a handheld device that sends a magnetic pulse into a person’s head might be an effective treatment for migraine headaches.
What is the outcome variable?
A study investigated whether a handheld device that sends a magnetic pulse into a person’s head might be an effective treatment for migraine headaches.
What type of variable is this?
A study investigated whether a handheld device that sends a magnetic pulse into a person’s head might be an effective treatment for migraine headaches.
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
OR=39/6122/78=0.6390.282=2.27
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
OR=39/6122/78=0.6390.282=2.27
"the odds of being pain free were 2.27 times higher with TMS than with the placebo"
What if we wanted to calculate this in terms of Not pain-free (with pain-free) as the referent?
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
What if we wanted to calculate this in terms of Not pain-free (with pain-free) as the referent?
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
OR=61/3978/22=1.5643.545=0.441
What if we wanted to calculate this in terms of Not pain-free (with pain-free) as the referent?
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
OR=61/3978/22=1.5643.545=0.441
the odds for still being in pain for the TMS group are 0.441 times the odds of being in pain for the placebo group
What changed here?
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
OR=78/2261/39=3.5451.564=2.27
the odds for still being in pain for the placebo group are 2.27 times the odds of being in pain for the TMS group
TMS | Placebo | Total | |
---|---|---|---|
Pain-free two hours later | 39 | 22 | 61 |
Not pain-free two hours later | 61 | 78 | 139 |
Total | 100 | 100 | 200 |
OR=78/2261/39=3.5451.564=2.27
the odds for still being in pain for the placebo group are 2.27 times the odds of being in pain for the TMS group
Odds ratios
Odds ratios
Female | Male | Total | |
---|---|---|---|
Survived | 308 | 142 | 450 |
Died | 154 | 709 | 863 |
Total | 462 | 851 | 1313 |
What are the odds of surviving for females versus males?
Female | Male | Total | |
---|---|---|---|
Survived | 308 | 142 | 450 |
Died | 154 | 709 | 863 |
Total | 462 | 851 | 1313 |
What are the odds of surviving for females versus males?
Female | Male | Total | |
---|---|---|---|
Survived | 308 | 142 | 450 |
Died | 154 | 709 | 863 |
Total | 462 | 851 | 1313 |
OR=308/154142/709=20.2=9.99
How do you interpret this?
Female | Male | Total | |
---|---|---|---|
Survived | 308 | 142 | 450 |
Died | 154 | 709 | 863 |
Total | 462 | 851 | 1313 |
OR=308/154142/709=20.2=9.99
How do you interpret this?
Female | Male | Total | |
---|---|---|---|
Survived | 308 | 142 | 450 |
Died | 154 | 709 | 863 |
Total | 462 | 851 | 1313 |
OR=308/154142/709=20.2=9.99
the odds of surviving for the female passengers was 9.99 times the odds of surviving for the male passengers
What if we wanted to fit a model? What would the equation be?
Female | Male | Total | |
---|---|---|---|
Survived | 308 | 142 | 450 |
Died | 154 | 709 | 863 |
Total | 462 | 851 | 1313 |
What if we wanted to fit a model? What would the equation be?
Female | Male | Total | |
---|---|---|---|
Survived | 308 | 142 | 450 |
Died | 154 | 709 | 863 |
Total | 462 | 851 | 1313 |
log(odds of survival)≈β0+β1Sex
log(odds of survival)≈β0+β1Sex
glm(Survived ~ Sex, data = Titanic, family = binomial) %>% tidy()
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) 0.693 0.0987 7.02 2.17e-12## 2 Sexmale -2.30 0.135 -17.1 2.91e-65
What is my referent category?
log(odds of survival)≈β0+β1Sex
levels(Titanic$Sex)
## [1] "female" "male"
How do I change that?
log(odds of survival)≈β0+β1Sex
Titanic <- Titanic %>% ---(Sex = ---(Sex, c("male", "female")))
How do I change that?
log(odds of survival)≈β0+β1Sex
Titanic <- Titanic %>% mutate(Sex = fct_relevel(Sex, c("male", "female")))
How do you interpret this result?
glm(Survived ~ Sex, data = Titanic, family = binomial) %>% tidy()
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) -1.61 0.0919 -17.5 1.70e-68## 2 Sexfemale 2.30 0.135 17.1 2.91e-65
How do you interpret this result?
glm(Survived ~ Sex, data = Titanic, family = binomial) %>% tidy(exponentiate = TRUE)
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) 0.200 0.0919 -17.5 1.70e-68## 2 Sexfemale 9.99 0.135 17.1 2.91e-65
exp(2.301176)
## [1] 9.99
the odds of surviving for the female passengers was 9.99 times the odds of surviving for the male passengers
data("MedGPA")glm(Acceptance ~ GPA, data = MedGPA, family = binomial) %>% tidy()
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) -19.2 5.63 -3.41 0.000644## 2 GPA 5.45 1.58 3.45 0.000553
data("MedGPA")glm(Acceptance ~ GPA, data = MedGPA, family = binomial) %>% tidy()
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) -19.2 5.63 -3.41 0.000644## 2 GPA 5.45 1.58 3.45 0.000553
A one unit increase in GPA yields a 5.45 increase in the log odds of acceptance
data("MedGPA")glm(Acceptance ~ GPA, data = MedGPA, family = binomial) %>% tidy(exponentiate = TRUE)
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) 4.56e-9 5.63 -3.41 0.000644## 2 GPA 2.34e+2 1.58 3.45 0.000553
data("MedGPA")glm(Acceptance ~ GPA, data = MedGPA, family = binomial) %>% tidy(exponentiate = TRUE)
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) 4.56e-9 5.63 -3.41 0.000644## 2 GPA 2.34e+2 1.58 3.45 0.000553
A one unit increase in GPA yields a 234-fold increase in the odds of acceptance
data("MedGPA")glm(Acceptance ~ GPA, data = MedGPA, family = binomial) %>% tidy(exponentiate = TRUE)
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) 4.56e-9 5.63 -3.41 0.000644## 2 GPA 2.34e+2 1.58 3.45 0.000553
A one unit increase in GPA yields a 234-fold increase in the odds of acceptance
How could we get the odds associated with increasing GPA by 0.1?
glm(Acceptance ~ GPA, data = MedGPA, family = binomial) %>% tidy()
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) -19.2 5.63 -3.41 0.000644## 2 GPA 5.45 1.58 3.45 0.000553
How could we get the odds associated with increasing GPA by 0.1?
glm(Acceptance ~ GPA, data = MedGPA, family = binomial) %>% tidy()
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) -19.2 5.63 -3.41 0.000644## 2 GPA 5.45 1.58 3.45 0.000553
exp(5.454) ## a one unit increase in GPA
## [1] 234
exp(5.454 * 0.1) ## a 0.1 increase in GPA
## [1] 1.73
How could we get the odds associated with increasing GPA by 0.1?
glm(Acceptance ~ GPA, data = MedGPA, family = binomial) %>% tidy()
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) -19.2 5.63 -3.41 0.000644## 2 GPA 5.45 1.58 3.45 0.000553
exp(5.454) ## a one unit increase in GPA
## [1] 234
exp(5.454 * 0.1) ## a 0.1 increase in GPA
## [1] 1.73
A one-tenth unit increase in GPA yields a 1.73-fold increase in the odds of acceptance
How could we get the odds associated with increasing GPA by 0.1?
MedGPA <- MedGPA %>% mutate(GPA_10 = GPA * 10)glm(Acceptance ~ GPA_10, data = MedGPA, family = binomial) %>% tidy(exponentiate = TRUE)
## # A tibble: 2 x 5## term estimate std.error statistic p.value## <chr> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) 0.00000000456 5.63 -3.41 0.000644## 2 GPA_10 1.73 0.158 3.45 0.000553
A one-tenth unit increase in GPA yields a 1.73-fold increase in the odds of acceptance
Odds ratios
Odds ratios
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |