ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Helsinki Open Data Science

Ver curso

Instrucciones del ejercicio

  • 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

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# alc is available 

# find the model with glm()
m <- glm(high_use ~ failures + absences, data = alc, family = "binomial")

# print out a summary of the model


# print out the coefficients of the model

Editar y ejecutar código