
SDS 291
November 17, 2025
Contingency table analysis allows us to summarize the relationship between a binary categorical response, \(Y_i\), and a categorical explanatory variable, \(x_i\)
Extend linear regression techniques to binary response variables in order to:
Research Question
What characteristics might be associated with survival?


Note
Can we use linear regression techniques to model \(\mathbb{E}[Y_i | x_i] = \beta_0 + \beta_1 x_i\)? Why or why not?

Link one or more explanatory variables to a function of the expected value of the response variable: \[g\left(\mathbb{E}[Y_i | x_i]\right) = \beta_0 + \beta_1 x_i\]
Three components of a GLM:
Each person’s outcome is a weighted coin flip, where the probability that the coin lands heads, \(\pi(x)\), depends on one or more explanatory variables: \[ \text{logit}\left( \pi(x) \right) = \log{ \left( \frac{\pi(x)}{1 - \pi(x)} \right) } = \beta_0 + \beta_1x_1 +\beta_2x_2 + \cdots + \beta_kx_k \]
Linear function for the log-odds… \[ \log\left\{\theta(x_i)\right\} = \beta_0 + \beta_1 x_i \iff \theta(x_i) = e^{\beta_0 + \beta_1x_i} \]
…becomes a non-linear function for the success probability, \(\pi(x)\):
\[ \pi(x_i) = \frac{\theta(x_i)}{1 + \theta(x_i)} = \frac{e^{\beta_0 + \beta_1x_i}}{1 + e^{\beta_0 + \beta_1x_i}} \]
log-odds scale:
\[\log{ \left( \frac{\pi(x_i)}{1 - \pi(x_i)} \right)} = \beta_0 + \beta_1x_i\]

probability scale:
\[\pi(x_i) = \frac{e^{\beta_0 + \beta_1x_i}}{1 + e^{\beta_0 + \beta_1x_i}}\]

Use the glm() function with family = "binomial"
Call:
glm(formula = y ~ age, family = "binomial", data = donner)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.97917 0.37460 2.614 0.00895 **
age -0.03689 0.01493 -2.471 0.01346 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 120.86 on 87 degrees of freedom
Residual deviance: 114.02 on 86 degrees of freedom
(3 observations deleted due to missingness)
AIC: 118.02
Number of Fisher Scoring iterations: 4
\[ \text{logit}\{\widehat{\pi}(\texttt{age})\} = 0.979 - 0.037\left(\texttt{age}\right) \]
\[ \widehat{\theta}(\texttt{age}) = e^{0.979 - 0.037\left(\texttt{age}\right)} \]
\[ \widehat{\pi}(\texttt{age}) = \frac{e^{0.979 - 0.037\left(\texttt{age}\right)}}{1 + e^{0.979 - 0.037\left(\texttt{age}\right)}} \]
Tip
On the log odds scale, logistic regression looks like a linear model!
Donner Party Intercept
Donner Party Slope
A one-year increase in age is associated with a 0.964 decrease in the odds of survival.
A one-year increase in age is associated with a 0.964 times change in the probability [likelihood/chance/risk] of survival.
type.predict = "link": returns predicted log-oddstype.predict = "response": returns predicted probabilities| Criterion | Linear Regression | Logistic Regression |
|---|---|---|
| Response Variable: | Continuous | Binary |
| Explanatory Variable(s): | Any type | Any type |
| Probability Model for Response Given \(x\): | Normal | Bernoulli/Binomial |
| \(\beta_0 + \beta_1 x\) Models: | Mean value of \(Y\) | Log odds of success |
| Coefficients: | Correspond to an additive change in the mean of \(Y\) | Need to be exponentiated in order to be meaningful. Correspond to a multiplicative change in the odds of success (\(Y = 1\)) |
| Multiple Regression: | Interpretation now holding other explanatory variables constant | Interpretation now holding other explanatory variables constant |

SDS 291