Regression Line Anatomy
Run the Regression Line Anatomy MicroSim Fullscreen
Edit in the p5.js Editor
About This MicroSim
A scatter plot shows hours studied and exam scores for ten students, with the least-squares regression line drawn through them. Five numbered callouts mark the parts of the model:
- Intercept (\(\beta_0\)): where the line crosses the y-axis, the predicted \(y\) when \(x = 0\)
- Slope (\(\beta_1\)): rise over run, the change in the predicted \(y\) for each one-unit increase in \(x\)
- Predicted value (\(\hat{y}\)): the model's answer for a given \(x\), always on the line
- Actual value (\(y\)): an observed data point, usually not on the line
- Residual (\(y - \hat{y}\)): the vertical distance from the actual value to the predicted value
The panel explains the selected part and gives its value in this data. The equation under the plot, \(\hat{y} = 47.5 + 5.5x\), uses the same colors, so each number in the equation can be matched to a part of the picture. Selecting the residual keeps the actual and predicted values lit, because the residual is the gap between them.
The slope and intercept are computed from the ten points by ordinary least squares. The points were chosen so that the line is exactly \(\hat{y} = 47.5 + 5.5x\), the model the chapter interprets. They are a separate data set from the chapter's eight-student example, whose least-squares line is \(\hat{y} = 47.04 + 5.71x\).
How to Use
- Read the plot first. Each dot is a student and the black line is the regression line.
- Hover over a numbered callout, a row of the list, or a colored number in the equation to highlight that part and read about it.
- Click a part to keep it selected. Click it again to release it.
- Check Show all residuals to draw the residual of every student, not only the featured one.
- Uncheck Show names, name each numbered part from memory, and hover or click to check.
Iframe Embed Code
You can add this MicroSim to any web page by adding this to your HTML:
1 2 3 4 | |
Lesson Plan
Grade Level
High School (11-12) and College Freshman
Duration
5-10 minutes
Prerequisites
Reading a scatter plot and the slope-intercept form of a line, \(y = mx + b\).
Bloom's Taxonomy Level
Remember (L1)
Learning Objective
Students will be able to identify the intercept, slope, predicted value, actual value, and residual on a regression plot and in the regression equation.
Activities
- Explore (3 min): Students hover over the five parts in order and write each name, symbol, and meaning in a table.
- Connect to the equation (3 min): Students hover over each colored number in the equation and point to the same part in the plot. They compute the predicted score for 3 hours by hand and compare it with part 3.
- Self-test (3 min): With Show names unchecked, students name each numbered part and click it to check. They then turn on Show all residuals and list the students whose scores the model predicted too high.
Assessment
Given an unlabeled scatter plot with a regression line and its equation, students label the intercept, the slope triangle, one predicted value, one actual value, and the residual between them, and state the sign of that residual.
References
- Wikipedia. Simple linear regression.
- Wikipedia. Errors and residuals.
- James, G., Witten, D., Hastie, T., and Tibshirani, R. An Introduction to Statistical Learning. Springer. Chapter 3, Linear Regression.