Session Ready
Exercise

Exploring multiple-levels: Classrooms and schools

In the last exercise, the simple linear model you used did not account for the structure of the data. Students learn within classrooms and classrooms exist within schools, which means students within the same classroom are not independent. One solution is to collapse the data by taking a mean for each level. However, the method used to collapse the data can be important, especially for small or unequal-sized groups.

In this exercise, you will aggregate the gains in math scores (mathgain) three different ways. After summarizing the data, you will examine a linear model of the data at each level.

Instructions 1/4
undefined XP
  • 1
  • 2
  • 3
  • 4
  • Run the code to summarize the student data to the classroom level.
  • Fit a linear model using student_data where mathgain is predicted by mathknow.
  • Fit a linear model using class_data where mathgain_class is predicted by mathknow_class.