Introduction to Simple Linear Regression
2025-11-12
Today’s plan 📋
Comments about Quiz 2 and R 🪄
Introduction to Simple Linear Regression
Function vs. Model
Examining Real Data
Creating a Model
Interpreting an Regression Model
I will check and recheck solutions and post grades on on Monday or Tuesday.
After tests and solutions are posted:
Please go through your test carefully
If you missed a question due to a typo, please let me know.
I would be happy to go through any questions you missed with you.
HW 8 is now posted but is not due until after Thanksgiving.
In-person Final Exam is on Friday, 12/12/25 at 5:15 PM
In this course we will use R and RStudio to understand statistical concepts.
You will access R and RStudio through Posit Cloud.
I will post R/RStudio files on Posit Cloud that you can access in provided links.
I will also provide demo videos that show how to access files and complete exercises.
NOTE: The free Posit Cloud account is limited to 25 hours per month.
For those who want to go further with R/RStudio:
If you are interested in downloading R and RStudio to your own computer, I can guide you through the process.
The software is completely free but it does have to be updated a couple times each year.
Poll Everywhere - My User Name: penelopepoolereisenbies685
Import the data find the average rate of return (expected value) and volatility for a portfolio that invests 75% in Starbucks (SBUX) and 25% in Nestle(NSRGY).
Use stock adjusted close data from 1/1/25 to 11/1/25.
Question 1: What is the average rate of return or expected value of this coffee portfolio? Round answer to two decimal places.
Question 2: What is the volatility of this coffee portfolio? Round answer to two decimal places.
NOTE: The final exam and HW 8 will include questions like this.
Average Rate of Return questions ask for a weighted average and could include three or more stocks.
Volatility questions require calculating covariances and variances and will only include two stocks, at most.
Favorite Quote attributed to George Box:
“All models are wrong, but some are useful.”
Common student query:
If all models are wrong, why do we bother modeling?
Models are considered ‘wrong’ because they simplify the ‘messiness’ of the real world to a mathematical relationship.
Models can’t (and shouldn’t) include all the noise of real world data
Poll Everywhere - My User Name: penelopepoolereisenbies685
To make Russian Tea Cake Cookies, you need 6 tablespoons of powdered sugar to make 3 dozen cookies.
Here is the full recipe.
Here is the equation (y-intercept = 0):
\(y = 6x\)
Is this a function or a model?
Poll Everywhere - My User Name: penelopepoolereisenbies685
True Population Model
\[y_{i} = \beta_{0} + \beta_{1}x_{i} + e_{i}\]
\(\beta_{0}\) is the y-intercept
\(\beta_{1}\) is the slope
\(e\) is the unexplained variability in Y
Estimated Sample Data Model
\[\hat{y} = b_{0} + b_{1}x\]
\(\hat{y}\) is model estimate of y from x
\(b_{0}\) is model estimate of y-intercept
\(b_{1}\) is model estimate of slope
\[\hat{y} = b_{0} + b_{1}x\]
\(\hat{y}\) is regression est. of y
\(b_{0}\) is value of y when X = 0
\(b_{1}\) is change in y due to 1 unit change in x.
NOTE:
Model is only valid for the range of X values used to estimate it.
Using a model to estimate a value outside of this range is referred to as extrapolation and this estimate is invalid.
Poll Everywhere - My User Name: penelopepoolereisenbies685
Regression Model:
\[\hat{y} = 33.8641 - 0.022417x\]
Question 5. Based on this model, if Horsepower (x) is increased by 1, what is the change in Highway MPG?
Poll Everywhere - My User Name: penelopepoolereisenbies685
Simple linear regression (SLR) models are similar in format to the function of line.
The interpretation is very different because SLR models are a simplification of the real world.
Box said “All models are wrong, but some are useful.”
This refers to the inherent simplification of modeling that leaves out the noise of the real world.
Despite this simplification, models provide valuable insight.
A model is only valid for the range data used to create it.
To submit an Engagement Question or Comment about material from Lecture 24: Submit it by midnight today (day of lecture).