how to perform a linear regression analysis on your ti … regression.notebook 1 ... how to perform...
TRANSCRIPT
Linear Regression.notebook
1
August 13, 2013
How to perform a linear regression analysis on your TI 83+ or TI84+ calculator.
Sometimes called a line of best fit.
Linear Regression.notebook
2
August 13, 2013
Your starting point will always be a data table.
Oil Changes and Engine Repairs
The table below displays data that relate the number or oil changes per year and the cost of engine repairs. To predict the cost of repairs from the number of oil changes, use the number of oil changes as the x variable and enginerepair cost as the y variable.
When graphing the data, it is important to ask how the axes should be labeled.
Linear Regression.notebook
3
August 13, 2013
In this case the independent variable (that which you control) is the number of oil changes per year. This is why it is chosen as the xaxis variable.
The cost in dollars of engine repairs is the dependent variable. We wish to see if it has some relationship to the number of oil changes per year. This then is the yaxis variable.
Linear Regression.notebook
4
August 13, 2013
STAT
Our first task is to enter the data intolists in the calculator.
Start by pressing the [STAT] key.
At the top of the screen menu items:
EDIT CALC TESTS
will appear.
Linear Regression.notebook
5
August 13, 2013
The word EDIT is selected in this menu, indicated by its beinghighlighted with the black background. Press [ENTER] to go to thismenu.
Linear Regression.notebook
6
August 13, 2013
You should now see the following screen.
Linear Regression.notebook
7
August 13, 2013
If previous data lists are in your calculator you will need to either[CLEAR] them or move to two lists that are not populated withdata.
I recommend clearing the previous data unless you absolutelyneed to keep it for some reason.
To [CLEAR] the data in L1 (list 1) use your arrow keys to move the cursor so L1 at the top of list 1 is selected.
Linear Regression.notebook
8
August 13, 2013
L1 is selected.
Now press the [CLEAR] keyon your calculator the press[ENTER] to erase all thedata in L1.
Linear Regression.notebook
9
August 13, 2013
Next do the same thing for L2.Your screen should now look like this. If needed movethe cursor to the first entry in L1 as shown below.
Linear Regression.notebook
10
August 13, 2013
Now enter the data for number of oil changes in L1. Type each number and then use the down arrow key to move to the next entry.
Linear Regression.notebook
11
August 13, 2013
Move the cursor to L2 and enter the data for cost of enginerepairs in dollars.
It is very important that the number of entriesin each list is the same. If they are not thenyou will get an error message that says:
ERR: DIM MISMATCH1: Quit2: Goto
This means the DIMensions of the two lists are not the same.
Linear Regression.notebook
12
August 13, 2013
If this happens go back and check your data entriesto make sure they match up correctly AND that there is no extra data in the lists from previous problems.
Linear Regression.notebook
13
August 13, 2013
Now that your data is correctly entered into L1 and L2 you shouldpress the [QUIT] key it is gotten to by pressing [2nd] and then [MODE]. You can see the work QUIT in yellow above the MODE key.
Linear Regression.notebook
14
August 13, 2013
You should now be back to your home screen.
Linear Regression.notebook
15
August 13, 2013
One of the most useful things you can do initially withdata is to look at a scatter plot of it so that patternscan be detected.
Press the [2nd] key followed by the [ y= ] key rightbelow your screen at the left side.
This will take you to the STAT PLOT menu.
Linear Regression.notebook
16
August 13, 2013
Looking at this screen youcan see that all of theSTAT PLOTS are turned Off.
You need STAT PLOT tobe turned On. Since it is alreadyselected just press [ENTER]
Linear Regression.notebook
17
August 13, 2013
The word "On" should be blinkingon your screen. Pess [ENTER] toturn "On" Plot1.
Linear Regression.notebook
18
August 13, 2013
Move your cursor one line down.You should observe that "On" isnow selected (by being highlighted).
The "Type" of scatter plot you wantis the first option, just data pointswhich is highlighted on the screen.
You can also see that the Xlist is L1and the Ylist is L2 which is correct.The "Mark" is just the size and shapeof data point that will appear on thescreen.
Linear Regression.notebook
19
August 13, 2013
Make sure your screenlooks like this beforemoving to the next step.
Linear Regression.notebook
20
August 13, 2013
Press the [GRAPH] key and you should see your datain a scatter plot, assuming the WINDOW you have isappropriate (which it rarely is!!!).
Linear Regression.notebook
21
August 13, 2013
You will almost always have to adjust your WINDOW to show the data of interest. You can do this by pressingthe [WINDOW] key and then setting the min and maxvalues for X and Y.
Recalling your data: X [0,10] and Y [0,750]
So choose these for your window values.
Linear Regression.notebook
22
August 13, 2013
Linear Regression.notebook
23
August 13, 2013
Hopefully, you now see the following screen. If not recheckyour steps and get HELP from someone experienced indoing this if you are having problems.
Linear Regression.notebook
24
August 13, 2013
A visual examination of the datashows a fairly linear relationship.You can see as X increases, the number of oil changes per year, Y, the cost of engine repairs, decreases.
If you were to draw a line of bestfit, as I have, the line would have a negative slope. Notethepink line is NOT on your screen.I just added it to make the relationshipmore apparent.
Linear Regression.notebook
25
August 13, 2013
Of course, the whole point of this exercise it to let yourcalculator figure out the EXACT line of best fit as anequation and tell you how "good" a fit it is.
So press [QUIT] to get back to your home screen.
Then, press [STAT] again but this time move yourcursor over to the left until the word CALC is highlighted.
Linear Regression.notebook
26
August 13, 2013
Now you can move the cursor downward(or press a number) to select what typeof "line" you want to have fit to the data.
Since a visual inspection suggests a linearrelationship select option 4, LinReg(ax+b). You might recognize this as theform of a straight line equation y=mx + b.
Well, for some reason Texas Instrumentsdecided to call the slope "x" instead of "m".
Linear Regression.notebook
27
August 13, 2013
With LinReg selected press[ENTER] and you should seethe screen below.
Linear Regression.notebook
28
August 13, 2013
At this point if you have completed each step as instructed you can just press [ENTER] to run your linear regression.
This gives you the slopeand intercept. And youcan write the equation ofthe line of best fit.
Y = 73X + 650
Linear Regression.notebook
29
August 13, 2013
Before we move on to discuss themeaning of this we can also getinformation about just how "good"a linear fit this is to the data.
Right now this information is noton the screen. (In your case itmight be. If that is the case justmove ahead.)
Linear Regression.notebook
30
August 13, 2013
This is the screen we reallywanted to see.
If the bottom two entries forr2 and r do not show up onyour screen you will need todo the steps that follow.
If they are on the screen then you can jump ahead to thediscussion of what they mean.
Linear Regression.notebook
31
August 13, 2013
To get the r and r2 values you need to press [CATALOG] whichis located above the 0 (zero) key. You should see the following:
Linear Regression.notebook
32
August 13, 2013
Move your cursor down until you reach a menu item"DiagnosticOn"".
Now press [ENTER].
Linear Regression.notebook
33
August 13, 2013
You will be returned to your homescreen and again press [ENTER]to turn the diagnostics on. Your homescreen should have the word "Done"now appear.
Linear Regression.notebook
34
August 13, 2013
At this point press [STAT] and go to the "CALC" optionand rerun your linear regression. But now, you should seethe r and r2 values.
Linear Regression.notebook
35
August 13, 2013
The value "r" is called the PearsonCorrelation Coefficient, and it is ameasure of how strong the linear relationship between the variables is. (It is not used for describing the strengthof nonlinear relationships.)
The value for "r" can vary from1 to +1. A positive value of "r" means apositive relationship and a negativevalue means a negative relationship.
Linear Regression.notebook
36
August 13, 2013
A value of "0" for Pearson's "r" means no relationship. As thevalue of "r" moves from zero toward +1 or 1 it means thestrength of the relationship is increasing.
If you have "r" values of +0.7 and 0.7 they indicate the samestrength of relationship. It is just that one is a positive andthe other is a negative relationship.
In our case "r" is negative which indicates that as the numberof oil changes increases the cost of engine repairs decreases.This makes sense.
Linear Regression.notebook
37
August 13, 2013
Determining the strength of relationships can be generalizedas follows:
r = 0.10 can be considered a small effect
r = 0.30 can be considered a medium effect
r = 0.50 can be considered a large effect
Linear Regression.notebook
38
August 13, 2013
There is MUCH more to this than we have time togo into here. I hope all of you will take a statisticscourse sometime in the future. Statistics and dataanalysis is critical to making sound decisions inour modern world because so much data is nowavailable and used for decision making.
When testing a hypothesis using a Pearson "r" itis also very important to take into account the number of data points you have.
Linear Regression.notebook
39
August 13, 2013
As you already know two data points will ALWAYS givea straight line and thus have a Pearson "r" of +1 or 1.
However, this really doesn't tell us there is a strongrelationship at all.
For right now we will consider an "r" value of 0.7 or greaterto indicate a strong relationship. As "r" approaches +1 or 1the strength of the relationship increases.
Linear Regression.notebook
40
August 13, 2013
Now back to our linear regression and its use.
Our r = .91399 indicates a verystrong linear relationship. Again, ithappens to be a negative one, whichmakes sense. As you do more oilchanges per year your cost of engine repairs decreases.
Linear Regression.notebook
41
August 13, 2013
To use this to predict values we must be very careful toconsider the limitations of the data and equation.
You could in theory get a negative cost for enginerepairs which makes no sense!
Y = 73X + 650
For example if you did 9 oil changes (the x value) ourequation would predict $7 in engine repairs for theyear. Trust me, your engine is NOT going to hand you$7 at the end of the year.
Linear Regression.notebook
42
August 13, 2013
There is no substitute for THINKING and usinggood judgement in the application of statisticsand a regression equation.
When trying to come to some conclusion based ondata analysis you need to consider many things in addition to the strength of the relationship.
1. How much data was used?2. How reliable is the data?3. Could there be any bias in the data?4. How was the data collected and by whom?5. How recent is the data?6. What is the sample population?7. How was the sample population selected?
Linear Regression.notebook
43
August 13, 2013
Statistical analysis can be a very powerful toolfor understanding relationships between thingsand making good decisions.
It can also be misapplied, either by accident or bydesign, and mislead or deceive people.
This is why a solid understanding of statistics isso very important in our modern lives.