Linear Regression Let spreadsheets do the work for you! Setup
• Do you see the “Analysis” section
on the Data Ribbon? Setup
Click the FILE tab, and then
select Options. Setup
1. Click Add-Ins
2. Click Go... Setup
Check the “Analysis
Toolpak” option, then click the OK button.
You should now see the
“Analysis” section on the Data Ribbon as shown a few slides ago. What is linear regression for?
• “[Attempts] to model the
relationship between two variables by fitting a linear equation to observed data.” (source: http://www.stat.yale.edu/Courses/1997-98/101/linreg.htm)
• To see if there’s relationship
between data (X and Y) • Forecasting / predicting Tutorial
• First you need some data to
perform the analysis on. • Open regression.xlsx and follow the next slides to perform a linear regression analysis. Tutorial
Examine your data. What does it tell you?
Variables
• Do you know your X’s and Y’s?
• Which is dependent? Which is independent? Tutorial
Click the “Data Analysis”
button on the Data Ribbon.
Select “Regression” from the dialogue box and click OK. Tutorial
Select the X and Y Ranges.
Select a cell to place the
regression data into.
There are many other options, but they
can be left unchecked for now. Tutorial
Although there is a lot of statistical
goodness in the output, the R values here are of interest. This says there is about a 98% correlation between the variables.
The “b” in the y=mx+b formula.
The “m” in the y=mx+b formula.
Tutorial
Enter the y=mx+b formula. Notice that m and b are
absolute references. This is important as you can use the auto-fill feature to quickly copy the formula down to the other cells. Not using an absolute reference would “break” the formula. Tutorial
Check your result with the screenshot above.
Tutorial 1. Select cells B2:D9. 2. Create a scatter chart with straight lines. Tutorial
You should get a chart like this...
But it should look like this...
Tutorial You’ll be working through this in class. Make some good notes!