Session Ready
Exercise

Explore multi-level data: students

Before using hierarchical models, a useful first step can include plotting the data and building a simpler model. Plotting gives visual intuition about the data and allows you to see potential trends or problems in data. Building a simple model provides a comparison to a hierarchical model. Furthermore, if R cannot run a linear model due to a problem (e.g., not enough data, misformatted data), troubleshooting the linear model is quicker and simpler.

During these exercises, you will plot and model how math test score gains vary as a function of socioeconomic status across three levels without accounting for the hierarchical nature of the data.

In this exercise, visualize and model the data at student-level. In the next exercise, you will explore other levels.

Instructions
100 XP
  • Visualize the student-level data (studentData) with ggplot2's ggplot() by plotting house-hold poverty level (housepov) as the x-axis against the student's gain in math (mathgain) as the y-axis. The provided call to geom_smooth() adds a linear model trend line to examine the data.
  • Examine the summary results of stat's package linear model (lm()) you added to the plot.