1. Learn
  2. /
  3. Courses
  4. /
  5. Helsinki Open Data Science

Connected

Exercise

Learning a logistic regression model

We will now use logistic regression to identify factors related to higher than average student alcohol consumption. You will also attempt to learn to identify (predict) students who consume high amounts of alcohol using background variables and school performance.

Because logistic regression can be used to classify observations into one of two groups (by giving the group probability) it is a binary classification method. You will meet more classification methods in the next chapter.

Instructions

100 XP
  • Use glm() to fit a logistic regression model with high_use as the target variable and failures and absences as the predictors.
  • Print out a summary of the model
  • Add another explanatory variable to the model after absences: 'sex'. Repeat the above.
  • Use coef() on the model object to print out the coefficients of the model