Session Ready
Exercise

Is bigger R-squared better? (1)

In the previous exercise, you counted degrees of freedom for each term in a model formula.

In this exercise, you'll be able to read the degrees of freedom directly from the formula, with hardly any arithmetic at all. The reason? You're going to use the function rand() (from the mosaic package), which generates an "explanatory" variable with any specified degrees of freedom.

The word "explanatory" is in quotes because the variable is composed of random numbers and hence can't offer any genuine explanation at all. You'll use this to explore what happens to R-squared as the degrees of freedom of a model increase.

Instructions
100 XP
  • Train the five models shown in the editor. The models will have 1 (i.e. null model), 100, 200, and 300 degrees of freedom, respectively.
  • Evaluate those models on the training data. (Use on_training = TRUE as shown.)