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"
.
This exercise is part of the course
Building Response Models in R
Exercise instructions
- Explain
HOPPINESS
by the intercept only. Use the functionglm()
and the argumentfamily = binomial
. Assign the result to an object namednull.model
. - Compare the
extended.model
against thenull.model
by using the functionanova()
and the argumenttest = "Chisq"
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Explain HOPPINESS by the intercept only
___ <- ___(___, family = ___, data = choice.data)
# Compare null.model and extended.model
___(extended.model, ___, test = ___)