Lucy D’Agostino McGowan
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 |
\(OR = \frac{39/61}{22/78} = \frac{0.639}{0.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 |
\(OR = \frac{61/39}{78/22} = \frac{1.564}{3.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 = \frac{78/22}{61/39} = \frac{3.545}{1.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 = \frac{78/22}{61/39} = \frac{3.545}{1.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
__ | 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 = \frac{308/154}{142/709} = \frac{2}{0.2} = 9.99\]
How do you interpret this?
___ | Female | Male | Total |
---|---|---|---|
Survived | 308 | 142 | 450 |
Died | 154 | 709 | 863 |
Total | 462 | 851 | 1313 |
\[OR = \frac{308/154}{142/709} = \frac{2}{0.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 |
\[\log(\textrm{odds of survival}) = \beta_0 + \beta_1 \textrm{Female}\]
\[\log(\textrm{odds of survival}) = \beta_0 + \beta_1 \textrm{Male}\]
What is my referent category?
\[\log(\textrm{odds of survival}) = \beta_0 + \beta_1 \textrm{Male}\]
How do I change that?
\[\log(\textrm{odds of survival}) = \beta_0 + \beta_1 \textrm{Male}\]
How do I change that?
\[\log(\textrm{odds of survival}) = \beta_0 + \beta_1 \textrm{Female}\]
How do you interpret this result?
Call:
glm(formula = Survived ~ Sex, family = binomial, data = Titanic)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.482 -0.604 -0.604 0.900 1.892
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.6080 0.0919 -17.5 <2e-16 ***
Sexfemale 2.3012 0.1349 17.1 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1688.1 on 1312 degrees of freedom
Residual deviance: 1355.5 on 1311 degrees of freedom
AIC: 1360
Number of Fisher Scoring iterations: 4
How do you interpret this result?
Call:
glm(formula = Survived ~ Sex, family = binomial, data = Titanic)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.482 -0.604 -0.604 0.900 1.892
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.6080 0.0919 -17.5 <2e-16 ***
Sexfemale 2.3012 0.1349 17.1 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1688.1 on 1312 degrees of freedom
Residual deviance: 1355.5 on 1311 degrees of freedom
AIC: 1360
Number of Fisher Scoring iterations: 4
[1] 9.99
the odds of surviving for the female passengers was 9.99 times the odds of surviving for the male passengers
Call:
glm(formula = Acceptance ~ GPA, family = binomial, data = MedGPA)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.780 -0.852 0.441 0.782 2.097
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -19.21 5.63 -3.41 0.00064 ***
GPA 5.45 1.58 3.45 0.00055 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 75.791 on 54 degrees of freedom
Residual deviance: 56.839 on 53 degrees of freedom
AIC: 60.84
Number of Fisher Scoring iterations: 4
A one unit increase in GPA yields a 5.45 increase in the log odds of acceptance
Call:
glm(formula = Acceptance ~ GPA, family = binomial, data = MedGPA)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.780 -0.852 0.441 0.782 2.097
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -19.21 5.63 -3.41 0.00064 ***
GPA 5.45 1.58 3.45 0.00055 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 75.791 on 54 degrees of freedom
Residual deviance: 56.839 on 53 degrees of freedom
AIC: 60.84
Number of Fisher Scoring iterations: 4
How could we get the odds associated with increasing GPA by 0.1?
Call:
glm(formula = Acceptance ~ GPA, family = binomial, data = MedGPA)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.780 -0.852 0.441 0.782 2.097
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -19.21 5.63 -3.41 0.00064 ***
GPA 5.45 1.58 3.45 0.00055 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 75.791 on 54 degrees of freedom
Residual deviance: 56.839 on 53 degrees of freedom
AIC: 60.84
Number of Fisher Scoring iterations: 4
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) %>%
summary()
Call:
glm(formula = Acceptance ~ GPA_10, family = binomial, data = MedGPA)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.780 -0.852 0.441 0.782 2.097
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -19.207 5.629 -3.41 0.00064 ***
GPA_10 0.545 0.158 3.45 0.00055 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 75.791 on 54 degrees of freedom
Residual deviance: 56.839 on 53 degrees of freedom
AIC: 60.84
Number of Fisher Scoring iterations: 4
A one-tenth unit increase in GPA yields a 1.73-fold increase in the odds of acceptance