Using logistic regression

HR Analytics: Exploring Employee Data in R

Ben Teusch

HR Analytics Consultant

HR Analytics: Exploring Employee Data in R

HR Analytics: Exploring Employee Data in R

HR Analytics: Exploring Employee Data in R

Using glm() for logistic regression

glm(high_performer ~ salary, data = hr, family = "binomial") %>% 
  tidy()
         term      estimate    std.error statistic      p.value
1 (Intercept) -4.231240e+00 2.747032e-01 -15.40295 1.563658e-53
2      salary  4.226071e-05 3.409601e-06  12.39462 2.794673e-35
  • glm() vs lm()
  • family = "binomial"
HR Analytics: Exploring Employee Data in R

Multiple logistic regression

glm(high_performer ~ salary + department, 
    data = hr, family = "binomial") %>% 
    tidy()
               term      estimate    std.error   statistic      p.value
1       (Intercept) -4.219310e+00 2.767137e-01 -15.2479251 1.699483e-52
2            salary  4.232297e-05 3.415551e-06  12.3912562 2.914420e-35
3 departmentFinance -6.106282e-02 3.094450e-01  -0.1973301 8.435692e-01
4   departmentSales -4.609506e-02 1.380010e-01  -0.3340196 7.383647e-01
HR Analytics: Exploring Employee Data in R

Let's practice!

HR Analytics: Exploring Employee Data in R

Preparing Video For Download...