Fit the Line
Choose a Detroit dataset, adjust a line until it matches the pattern, and compare your error with the best-fit (least-squares) line.
Controls
Residual = actual y minus the line's y. The best-fit line minimizes the sum of squared residuals (SSE). Datasets: model energy data (illustrative home), real freeze–thaw counts from Open-Meteo daily temperatures (winters 2016–2024), and real annual mean Detroit River levels from NOAA (1970–2024).
Your line
y = m·x + c
Your error (SSE)
Best-fit error
Correlation r
Try this
- On the electricity data, can a single line fit well? What does the best-fit line miss?
- For freeze–thaw days, how close can you get? Does a nonzero slope mean there is a real trend?
- For water levels, compare the slope with the multi-year ups and downs.
What to notice
- Low r means the points are far from a line, not that there is no pattern.
- Squared errors punish far-away points most, which is why outliers pull the line.
- Correlation is not causation.
Connect to the labs
- Does Temperature Predict Energy Use? and Pothole Season (teacher key).
- Download the files from the dataset page and repeat the fit in a spreadsheet.