Exercise

# Comparing logistic regression outputs

When building models, you want to have more observations than parameters that are estimated for the model. These extra variables are called degrees of freedom.

A model with too few observations can be *overfit*, or even be un-fitable (sometimes call singular). Furthermore, looking at the degrees for freedom can help you double-check your data and code. For example, a mismatch between the degrees of freedom and the number of observations you think you have can indicate that your data needs to be cleaned more, there is a bug in your code, or that there is a modeling error.

The wide versus long input formats for the `glm()`

produce different degrees of freedom because the difference in number of rows of the data causes the model to think that there is a difference in number of observations.

In the previous exercises, you fit a logistic regression using three different input options.
These have been loaded for you as `lr_1`

, `lr_2`

, and `lr_3`

.
Look at the summaries of these three models.

How do the degrees of freedom vary across the models?

Instructions

**50 XP**

##### Possible Answers

- The degrees of freedom are the same for all three models.
- The degrees of freedom are greater for the long form input (
`lr_1`

) compared to the other two (`lr_2`

and`lr_3`

). - The degrees of freedom are greater for the wide form input (
`lr_2`

and`lr_3`

) compared to the long form input (`lr_1`

).