Week 8 — Regression
In this week, we are learning about linear regression with StatsModels. All the examples will use the StatsModels OLS (ordinary least squares) model, generally with the formula interface.
Activities:
- Introducing Regression (5m6s)
- Statistical Modeling (8m6s)
- Single Regression (10m14s)
- Prediction and Inference (8m33s)
- Week 8 Quiz
- Categorical Predictors (3m41s)
- Testing Assumptions (9m46s)
- Regression Model Assumptions (964 words)
- Multiple Regression (19m8s)
- Measuring Prediction Accuracy (9m12s)
- Instances and Sampling (9m40s)
- Supporting Notebook
- StatsModels Examples and User Guide
- Bootstrapping Linear Regression (1950 words)
- Assignment 4
Introducing Regression
Statistical Modeling
Resources
Single Regression
In this video, I introduce single-variable regression.
Slide Clarification
On slide 6, where I show the slope, intercept, and variance in a model, I have extended the plot to include 0 at the left end of the x-axis. This is to highlight the meaning of the intercept. It is important to note that the intercept is where the line crosses zero, not where it crosses the left Y-axis.
Also, when discussing this slide, I am imprecise but make it sound like the unexplained variance is the remainder after projecting the data onto the line. It is the variance remaining after subtracting the line. I am preparing a video for Week 9 that will provide more clarity on this relationship.
Prediction and Inference
Week 8 Quiz
Complete the Week 8 quiz in Blackboard.
Categorical Predictors
Testing Assumptions
Regression Model Assumptions
Read Regression Model Assumptions from JMP.
Multiple Regression
Measuring Prediction Accuracy
Instances and Sampling
Supporting Notebook
- Regression notebook with code supporting the Penguin examples
- I have added the regression code to the correlation notebook to support the movie examples
StatsModels Examples and User Guide
The following StatsModels pages document its OLS model:
Bootstrapping Linear Regression
Read Bootstrapping for Linear Regression.
Assignment 4
Assignment 4 is due October 25, 2020.