The deviance principle
There was no R-squared in the model summary. Instead, two types of deviance are reported. The null deviance serves as a baseline and can be evaluated relative to the residual deviance of the extended.model.
The null model is a logistic model without any additional predictors. You can specify such an intercept-only model by the relationship HOPPINESS ~ 1. Again, you use the function glm() and the family argument family = binomial. The result is named null.model. You judge the improvement in prediction accuracy by comparing the reduction in deviance from the extended.model to the null.model using the function anova() and the additional argument test = "Chisq".
Cet exercice fait partie du cours
Building Response Models in R
Instructions
- Explain
HOPPINESSby the intercept only. Use the functionglm()and the argumentfamily = binomial. Assign the result to an object namednull.model. - Compare the
extended.modelagainst thenull.modelby using the functionanova()and the argumenttest = "Chisq".
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Explain HOPPINESS by the intercept only
___ <- ___(___, family = ___, data = choice.data)
# Compare null.model and extended.model
___(extended.model, ___, test = ___)