|
4 | 4 | <title>To Explain or Predict: how different modelling objectives change how you use the same tools</title> |
5 | 5 | <meta charset="utf-8" /> |
6 | 6 | <meta name="author" content="Chris Mainey" /> |
7 | | - <meta name="date" content="2024-11-18" /> |
| 7 | + <meta name="date" content="2024-11-19" /> |
8 | 8 | <script src="libs/header-attrs/header-attrs.js"></script> |
9 | 9 | <link rel="stylesheet" href="xaringan-themer.css" type="text/css" /> |
10 | 10 | </head> |
|
223 | 223 |
|
224 | 224 |
|
225 | 225 | --- |
226 | | -# The Generalized Linear Model (GLM): |
| 226 | +## How can we use regression on other distributions / data types? |
227 | 227 |
|
228 | | -For distributions in the exponential family, GLM allows the linear model to relate to response through a function: |
| 228 | +We can 'zoom out' to a more the 'Generalized Linear Model (GLM): |
| 229 | + |
| 230 | +_For distributions in the exponential family, GLM allows the linear model to relate to response through a function:_ |
229 | 231 |
|
230 | 232 | `$$\large{g(\mu)= \alpha + \beta_{i} x_{i}}$$` |
231 | 233 | <br> |
232 | 234 | + Where `\(\mu\)` is the _expectation_ of `\(Y\)`, |
233 | 235 | + `\(g\)` is the link function - related to each |
234 | 236 |
|
235 | 237 | -- |
| 238 | +<br> |
| 239 | + |
| 240 | +###So, for logistic regression, the link function is 'logit' or the log odds of the event. |
| 241 | + |
| 242 | +??? |
| 243 | + |
| 244 | +As the name suggest, a more general form allows us to use different distributions, but understand them as a linear model on a given scale. E.g. for count data, `\(\mu\)` would be the expected count, and `\(g\)` would be the natural logarithm, and the model is using the Poisson distribution. |
236 | 245 |
|
237 | | -So, for logistic regression, the link function is 'logit' or the log odds of the event. |
| 246 | +In our case, for binary, we are modelling the 'odds' of the outcome (death) on the log scale, with a binomial distribution. |
| 247 | +This is the log-odd, or 'logit' link fiction: hence logistic regression. |
| 248 | + |
| 249 | +__Importantly, I can use it to examine the explanatory relationships, or to predict new data__ |
238 | 250 |
|
239 | 251 | --- |
240 | 252 |
|
|
298 | 310 | ## Dep. Variable: DEATH_EVENT No. Observations: 299 |
299 | 311 | ## Model: Logit Df Residuals: 296 |
300 | 312 | ## Method: MLE Df Model: 2 |
301 | | -## Date: Mon, 18 Nov 2024 Pseudo R-squ.: 0.1359 |
302 | | -## Time: 15:02:46 Log-Likelihood: -162.16 |
| 313 | +## Date: Tue, 19 Nov 2024 Pseudo R-squ.: 0.1359 |
| 314 | +## Time: 17:16:16 Log-Likelihood: -162.16 |
303 | 315 | ## converged: True LL-Null: -187.67 |
304 | 316 | ## Covariance Type: nonrobust LLR p-value: 8.308e-12 |
305 | 317 | ## ===================================================================================== |
|
430 | 442 | ``` |
431 | 443 |
|
432 | 444 | ``` |
433 | | -## 0.69 |
| 445 | +## 0.7713068181818182 |
434 | 446 | ``` |
435 | 447 |
|
436 | 448 | --- |
|
571 | 583 | ] |
572 | 584 |
|
573 | 585 | .pull-right[ |
574 | | -<center> |
575 | | -<div class="tenor-gif-embed" data-postid="1688826665026359193" data-share-method="host" data-aspect-ratio="1.25758" data-width="75%"><a href="https://tenor.com/view/miles-morales-miles-across-the-spider-verse-i-made-another-mistake-i-made-a-mistake-gif-1688826665026359193">Miles Morales Across The Spider Verse GIF</a>from <a href="https://tenor.com/search/miles+morales-gifs">Miles Morales GIFs</a></div> <script type="text/javascript" async src="https://tenor.com/embed.js"></script></center> |
576 | | -<br> |
577 | | -> "With great power comes greate responsibility" |
| 586 | + |
| 587 | + |
| 588 | +> "With great power comes great responsibility" |
578 | 589 | - Stan Lee (via Spiderman's Uncle Ben) |
579 | 590 |
|
580 | 591 | ] |
|
0 commit comments