Session Ready
Exercise

How do GPAs compare?

The performance of university and high-school students in the US are often summarized by a "gradepoint average" (GPA). The grade that a student earns in each course is translated to a numerical scale called a gradepoint: 4.0 is at the high end (corresponding to an "A") and 0 is at the low end (a fail).

The GPA calculation is done, of course, by taking a student's gradepoints and averaging. But this is not the only way to do it. gpa_mod_1 in the editor shows a gradepoint average calculation using a linear model. The data, College_grades, give the grades in each course taken by each of 400+ students at an actual college in the midwest US. sid is the student's ID number. The formula gradepoint ~ sid can be read, "gradepoint is explained by who the student is."

Evaluating the model for students "S32115" and "S32262" shows that they have very similar gradepoint averages: 3.66 and 3.33, respectively.

The effect_size() calculation compares two levels of the inputs. You could get this result through simple subtraction of the evaluated model values. By default, effect_size() picks the levels to compare, but you can override this by providing specific evaluation level(s) of explanatory variables (e.g. sid = "S32115") and the to argument (e.g. to = "S32262").

Instructions
100 XP

You've been given the code for gpa_mod_1.

  • Create a new model, gpa_mod_2, that (in addition to sid) includes the dept in which the course was taken and the course level.
  • Use effect_size() to find the difference in model output for the same two students under gpa_mod_2.