Logistic Regression

STAT 20: Introduction to Probability and Statistics

Concept Questions

m1 <- glm(sex ~ body_mass_g, data = penguins, family = "binomial")
 (Intercept)  body_mass_g 
-5.162541644  0.001239819 

Which of the expressions given in the poll (math or code) will correctly calculate the predicted probability that a penguin that weighs 4000 g is a female? Select all that apply.

01:00

What is the misclassification rate of this model?

# A tibble: 4 × 3
# Groups:   sex [2]
  sex    sex_hat     n
  <fct>  <chr>   <int>
1 female female    109
2 female male       56
3 male   female     74
4 male   male       94
01:00

m2 <- glm(sex ~ body_mass_g + bill_length_mm, 
          data = penguins, family = "binomial")
   (Intercept)    body_mass_g bill_length_mm 
   -6.91208086     0.00101530     0.06112808 

Open up RStudio and fit the model here in the slides. What are the predicted sexes of these two penguins, using a probability threshold of 0.5?

  1. body mass = 3900 g, bill length = 50
  2. body mass = 4100 g, bill length = 35
01:00

Break

05:00

Problem Set

Fill out this end-of-class survey here and see how your answers differ from before!

Lab: Cancer Diagnosis

Lab: Cancer Diagnosis

45:00