Session Ready
Exercise

Rules for counting

In this exercise, you'll work with the "rules" for counting degrees of freedom. You don't need to memorize these, but they will help you out from time to time.

  • A dataset with \(n\) cases has \(n\) degrees of freedom.
  • The explanatory side of a model formula has a number of degrees of freedom that depends on the terms in the formula. Start counting at 1; every model has at least 1 degree of freedom even if there are no explanatory variables.
    • A single variable has 1 degree of freedom if it is quantitative. If it is categorical with \(k\) different levels, it has \(k-1\) degrees of freedom.
    • If variables are connected with +, add together their individual degrees of freedom.
    • If variables are connected with *, add together their individual degrees of freedom and then add in the product of their individual degrees of freedom.
    • There are special rules that apply in some special circumstances, but you don't need to worry about those here.
  • The difference between the degrees of freedom of the dataset and the degrees of freedom of the model formula is called the residual degrees of freedom. Models with zero residual degrees of freedom are not generally at all useful. Models with a handful of residual degrees of freedom have statistical properties that are not reliable.

How many degrees of freedom are in the formula for this model?

lm(wage ~ age + sector + sex + married * exper, 
   data = CPS85)

Tip: You can use table() or length(unique(___)) to figure out the degrees of freedom in the sex and married variables.

Instructions
50 XP
Possible Answers