Understanding output from logistic regression

Generalized Linear Models in R

Richard Erickson

Instructor

Communicating results from logistic regression?

  • Linear regression is straight forward:

    • Add intercepts
    • Multiply slopes
  • Poisson regression:

    • Requires exponential transformation
    • Similar to linear regression post-transformation
  • Logistic regression???
Generalized Linear Models in R

Odds-ratios

  • Not as straightforward as Poisson exponential
  • Used to compare relative odds of two events occurring
Generalized Linear Models in R

Example odds-ratios

  • Unfair coin:
    • Compare heads to tails
    • Heads 3 times for every 1 tails
    • 3-to-1 odds
    • Odds-ratios 3.0
  • Often used in sports/gambling
  • Medical studies
Generalized Linear Models in R

Logistic derivation of odds-ratio

Log-odds ("logit"):

$\phi(x) = \text{ln}(\frac{p(x)}{1 - p(x)}) = \beta_0 + \beta_1 x$

Odds, take exponential ($e^{x}$):

$\frac{p(x)}{1 - p(x)} = e^{\beta_0 + \beta_1x}$

Generalized Linear Models in R

Odd-ratio for continuous variable

Odds-ratio (OR) for continuous variable:

$\text{OR} = \frac{e^{\beta_0 + \beta_1(x +1)}}{e^{\beta_0 + \beta_1x}} = e^{\beta_1}$

Generalized Linear Models in R

Interpretation

OR Values:

  • OR = 1: Coefficient has no effect
  • OR < 1: Coefficient decreases odds
  • OR > 1: Coefficient increases odds
Generalized Linear Models in R

Cancer example

Non-smoking vs smoking males (Pesch et al. 2012)

  • OR: 103.5 (95% CI 74.8-143.2)
  • $>$ 100-to-1 odds of getting cancer for smoking men!
  • Medical literature often reports 95% confidence intervals rather than p-values
  • Broader trend away from p-values
Generalized Linear Models in R

Extract from GLM

glm_out <- glm(y ~ x, family = 'binomial')

coef(glm_out)

exp(coef(glm_out))

confint(glm_out)

exp(confint(glm_out))
Generalized Linear Models in R

Tidyverse

library(broom)

glm_out <- glm(y ~ x, family = 'binomial')

tidy(glm_out, exponentiate = TRUE, conf.int= TRUE)
Generalized Linear Models in R

Let's practice!

Generalized Linear Models in R

Preparing Video For Download...