Lesson 16: Linear Regression
October 24, 2024
Review:
- Exam 2 review
- Scatterplots
- Sum of Squares
Presentation:
- Linear regression (simple, bivariate)
- Calculate equation of the regression line
- y-hat = b1*x + bo
- b1 = “slope” of the line
- b0 = “y-intercept”
- Calculate Sum of Squares: SSxx, SSyy, SSxy
- b1 = SSxy/SSxx
- b0 = (∑y/n) – b1*(∑x/n)
- y-hat = b1*x + bo
- Example
- Beer party data: {(60,10), (70,12), (80,20), (90,40)}
- Calculate slope (b1) and y-intercept (b0) for linear equation
- Estimate Beer consumption when temperature is 75 degrees
- Download the Beer Party Regression Example
- Video: Fitting Lines to Data
- Calculate equation of the regression line
Demonstrate in Sheets:
- Forecast 2020 voter turnout in Pueblo County using the data below
- Create a Scatterplot
- Calculate Sum of Squares: SSxx, SSyy, SSxy
- Calculate slope and intercept for the regression line and write the linear equation
- Use the regression equation to forecast Ballots Cast in 2020
- Hints
- Use Time Period (rather than year) as the independent (x) variable
- Use Ballots Cast as the dependent (y) variable
- To forecast 2020 turnout, solve for y-hat when x = 5
- To forecast 2024 turnout, solve for y-hat when x = 6
- Hints
Presidential Election Year | Time Period | Ballots Cast |
2004 | 1 | 68,371 |
2008 | 2 | 73,881 |
2012 | 3 | 77,671 |
2016 | 4 | 78,652 |
Assignment in Sheets:
- Download the Snowpack and Runoff in the Arkansas River Basin
- Generate a scatter plot
- x-axis = Column B “Freemont Pass Snow H2O Equiv (in) on March 1” and
- y-axis = Column C: Arkansas R at Pueblo Streamvolume Observed (ac_ft) in May”
- Add a Trendline and display the linear Equation
- Create a function in Sheets to estimate runoff based on snowpack
- Generate runoff estimates assuming x=5, 10, 15, 20 and 25 inches snowpack (produce 5 forecasts)