Chapter 10: Linear Regression and Correlation

10.7 Using Technology for Linear Regression

Learning Objectives

By the end of this section, the student should be able to:

  • use technology to solve problems involving Linear Regression

This is another section to show technology tools that can be used to help with the statistics concepts taught in this chapter. This section will cover tools to help solve problems involving Linear Regression.

Graphing Calculator

Similar to all the other technology sections, the main tool introduced will be the TI-83, 83+, 84, or 84+ Graphing Calculator. The graphing calculator can help to do A LOT of the concepts of Linear Regression, including:

  • drawing a scatter plot
  • finding the least-squares regression line or best-fit line
  • finding the correlation coefficient [latex]r[/latex] and coefficient of determination [latex]r^{2}[/latex]
  • hypothesis testing to check the significance of the correlation coefficient [latex]r[/latex]
  • checking for outliers

Let's see how to do each of these with directions and an example.

 

Create a Scatter Plot

In 10.2 Scatter Plots we saw how to display the relation between two variables [latex]x[/latex] and [latex]y[/latex] by using scatter plots. Let's see the directions for doing in in the calculator. Try it with this example:

Example

In Europe and Asia, m-commerce is popular. M-commerce users have special mobile phones that work like electronic wallets as well as provide phone and Internet services. Users can do everything from paying for parking to buying a TV set or soda from a machine to banking to checking sports scores on the Internet. For the years 2000 through 2004, was there a relationship between the year and the number of m-commerce users? Construct a scatter plot. Let [latex]x = \text{the year}[/latex], and let [latex]y = \text{the number of m-commerce users, in millions}[/latex].

Table 1: Number of m-commerce users (in millions) by year
[latex]x[/latex] (year) [latex]y[/latex] (# of users)
2000 0.5
2002 20.0
2003 33.0
2004 47.0
Here is the scatter plot showing the number of m-commerce users (in millions) by year:
This is a scatter plot for the data provided. There are four points plotted, at (2000, 0.5), (2002, 20.0), (2003, 33.0), (2004, 47.0).
Figure 1. The x-axis represents the year and the y-axis represents the number of m-commerce users in millions.

Using the TI-83, 83+, 84, 84+ Calculator

To create a scatter plot:

  1. Enter your X data into list L1 and your Y data into list L2.
  2. Press 2nd STATPLOT ENTER to use Plot 1. On the input screen for PLOT 1, highlight On and press ENTER. (Make sure the other plots are OFF.)
  3. For TYPE: highlight the very first icon, which is the scatter plot, and press ENTER.
  4. For Xlist:, enter L1 ENTER and for Ylist: L2 ENTER.
  5. For Mark: it does not matter which symbol you highlight, but the square is the easiest to see. Press ENTER.
  6. Make sure there are no other equations that could be plotted. Press Y = and clear any equations out.
  7. Press the ZOOM key and then the number 9 (for menu item "ZoomStat"); the calculator will fit the window to the data. You can press WINDOW to see the scaling of the axes.

 

Least-Squares Regression Line or Best-Fit Line

Computer spreadsheets, statistical software, and many calculators can quickly calculate the best-fit line and create the graphs. The calculations tend to be tedious if done by hand. Instructions to use the TI-83, TI-83+, and TI-84+ calculators to find the best-fit line and create a scatterplot are shown below. But another option using the graphing calculator is also beneficial for all things linear regression. It is the LinRegTTest.

Using the TI-83, 83+, 84, 84+ Calculator

Using the Linear Regression T Test: LinRegTTest

  1. In the STAT list editor, enter the X data in list L1 and the Y data in list L2, paired so that the corresponding (x,y) values are next to each other in the lists. (If a particular pair of values is repeated, enter it as many times as it appears in the data.)
  2. On the STAT TESTS menu, scroll down with the cursor to select the LinRegTTest. (Be careful to select LinRegTTest, as some calculators may also have a different item called LinRegTInt.)
  3. On the LinRegTTest input screen enter: Xlist: L1; Ylist: L2; Freq: 1
  4. On the next line, at the prompt β or ρ, highlight "≠ 0" and press ENTER
  5. Leave the line for "RegEq:" blank
  6. Highlight Calculate and press ENTER.

Try it with this example from 10.3 The Regression Equation:

Example

A random sample of 11 statistics students produced the following data, where [latex]x[/latex] is the third exam score out of 80, and [latex]y[/latex] is the final exam score out of 200. Can you predict the final exam score of a random student if you know the third exam score?

Table below shows the scores on the final exam based on scores from the third exam.
Table 2: Scores on the Final Exam based on Scores from the Third Exam
[latex]x[/latex] (third exam score) [latex]y[/latex] (final exam score)
65 175
67 133
71 185
71 163
66 126
75 198
67 153
70 163
71 159
69 151
69 159

If you run the LinRegTTest you will see the following screens in Figure 2.

The left image is the calculator input screen for the LinRegTTest with input matching the instructions above.

The right image is the calculator output screen for the LinRegTTest. The output screen shows: LinRegTTest; y = a + bx; Beta does not equal 0 and rho does not equal 0; t = 2.657560155; df = 9; a = 173.513363; b = 4.827394209; s = 16.41237711; r squared = .4396931104; r = .663093591

 

As described in the text above.
Figure 2. LinRegTTest Input and Output Screens

The output screen contains a lot of information. For now we will focus on a few items from the output, and will return later to the other items.

The second line says [latex]y = a + bx[/latex]. Scroll down to find the values [latex]a = –173.513[/latex], and [latex]b = 4.8273[/latex]; the equation of the best fit line is [latex]\hat{y} = –173.51 + 4.83x[/latex].

The two items at the bottom are [latex]r^{2} = 0.43969[/latex] and [latex]r = 0.663[/latex]. For now, just note where to find these values; we will discuss them in the next two sections.

 

Once you have a scatter plot and a regression line, you can graph them both in the graphing calculator.

Using the TI-83, 83+, 84, 84+ Calculator

Graphing the Scatterplot and Regression Line

  1. We are assuming your X data is already entered in list L1 and your Y data is in list L2.
  2. Press 2nd STATPLOT ENTER to use Plot 1.
  3. On the input screen for PLOT 1, highlight On, and press ENTER.
  4. For TYPE: highlight the very first icon which is the scatterplot and press ENTER.
  5. Indicate Xlist: L1 and Ylist: L2.
  6. For Mark: it does not matter which symbol you highlight.
  7. Press the ZOOM key and then the number 9 (for menu item "ZoomStat"); the calculator will fit the window to the data.
  8. To graph the best-fit line, press the "Y=" key and type the equation –173.5 + 4.83X into equation Y1. (The X key is immediately left of the STAT key). Press ZOOM 9 again to graph it.
  9. Optional: If you want to change the viewing window, press the WINDOW key. Enter your desired window using Xmin, Xmax, Ymin, Ymax.

Note

Another way to graph the line after you create a scatter plot is to use LinRegTTest.

  1. Make sure you have done the scatter plot. Check it on your screen.
  2. Go to LinRegTTest and enter the lists.
  3. At RegEq: press VARS and arrow over to Y-VARS. Press 1 for 1:Function. Press 1 for 1:Y1. Then arrow down to Calculate and do the calculation for the line of best fit.
  4. Press Y = (you will see the regression equation).
  5. Press GRAPH. The line will be drawn."

 

The Correlation Coefficient r

In 10.3 The Regression Equation we saw how to calculate the correlation coefficient, r, which is the numerical value that provides a measure of strength and direction of the linear association between the independent variable x and the dependent variable y. The formula for r looks formidable; however, computer spreadsheets, statistical software, and many calculators can quickly calculate r.

The correlation coefficient r is the bottom item in the output screens for the LinRegTTest on the TI-83, TI-83+, or TI-84+ calculator (see previous heading for instructions).

 

The Coefficient of Determination

The variable r2 is called the coefficient of determination and is the square of the correlation coefficient, but is usually stated as a percent, rather than in decimal form.  The coefficient of determination is the bottom item in the output screens for the LinRegTTest on the TI-83, TI-83+, or TI-84+ calculator (see previous heading for instructions).

 

Hypothesis Testing for the Significance of the Correlation Coefficient

We covered in 10.4 Testing the Significance of the Correlation Coefficient that we can perform a hypothesis test of the "significance of the correlation coefficient" to decide whether the linear relationship in the sample data is strong enough to use to model the relationship in the population. As a reminder, this was the background information from the section:

The sample data are used to compute [latex]r[/latex], the correlation coefficient for the sample. If we had data for the entire population, we could find the population correlation coefficient. But because we only have sample data, we cannot calculate the population correlation coefficient.

The sample correlation coefficient, [latex]r[/latex], is our estimate of the unknown population correlation coefficient.

  • The symbol for the population correlation coefficient is [latex]\rho[/latex], the Greek letter "rho."
  • [latex]\rho =[/latex] population correlation coefficient (unknown)
  • [latex]r =[/latex] sample correlation coefficient (known; calculated from sample data)

The hypothesis test lets us decide whether the value of the population correlation coefficient [latex]\rho[/latex] is "close to zero" or "significantly different from zero". We decide this based on the sample correlation coefficient [latex]r[/latex] and the sample size [latex]n[/latex].

If the test concludes that the correlation coefficient is significantly different from zero, we say that the correlation coefficient is "significant."

  • Conclusion: There is sufficient evidence to conclude that there is a significant linear relationship between [latex]x[/latex] and [latex]y[/latex] because the correlation coefficient is significantly different from zero.
  • What the conclusion means: There is a significant linear relationship between [latex]x[/latex] and [latex]y[/latex]. We can use the regression line to model the linear relationship between [latex]x[/latex] and [latex]y[/latex] in the population.

If the test concludes that the correlation coefficient is not significantly different from zero (it is close to zero), we say that correlation coefficient is "not significant".

  • Conclusion: "There is insufficient evidence to conclude that there is a significant linear relationship between [latex]x[/latex] and [latex]y[/latex] because the correlation coefficient is not significantly different from zero."
  • What the conclusion means: There is not a significant linear relationship between [latex]x[/latex] and [latex]y[/latex]. Therefore, we CANNOT use the regression line to model a linear relationship between [latex]x[/latex] and [latex]y[/latex] in the population.

 

To actually perform the hypothesis test,

  • Null Hypothesis: [latex]H_0: \rho = 0[/latex]
  • Alternate Hypothesis: [latex]H_a: \rho \neq 0[/latex]

What the hypotheses mean in words:

  • Null Hypothesis [latex]H_0[/latex]: The population correlation coefficient IS NOT significantly different from zero. There IS NOT a significant linear relationship(correlation) between x and y in the population.
  • Alternate Hypothesis [latex]H_a[/latex]: The population correlation coefficient IS significantly DIFFERENT FROM zero. There IS A SIGNIFICANT LINEAR RELATIONSHIP (correlation) between x and y in the population.

We saw two methods of making the decision. The two methods are equivalent and give the same result.

  • Method 1: Using the p-value
  • Method 2: Using a table of critical values

The TI-83, 83+, 84, 84+ calculator function LinRegTTest can perform this hypothesis test using Method 1.

Method 1: Using a p-value to make a decision

Using the TI-83, 83+, 84, 84+ Calculator

To calculate the p-value using LinRegTTEST:

On the LinRegTTEST input screen, on the line prompt for β or ρ, highlight "≠ 0"

The output screen shows the p-value on the line that reads "p =".

(Most computer statistical software can calculate the p-value.)

Remember, doing a hypothesis test is not just about plugging into the calculator to get the answer. You must form the conclusion of the test correctly. A reminder from 10.4 Testing the Significance of the Correlation Coefficient:
If the p-value is less than the significance level ([latex]\alpha = 0.05[/latex]):
  • Decision: Reject the null hypothesis.
  • Conclusion: "There is sufficient evidence to conclude that there is a significant linear relationship between x and y because the correlation coefficient is significantly different from zero."
If the p-value is NOT less than the significance level ([latex]\alpha = 0.05[/latex]):
  • Decision: DO NOT REJECT the null hypothesis.
  • Conclusion: "There is insufficient evidence to conclude that there is a significant linear relationship between x and y because the correlation coefficient is NOT significantly different from zero."
**Note: we will always use a significance level of 5%, α = 0.05.

An alternative way to calculate the p-value (p) given by LinRegTTest is the command 2*tcdf(abs(t),10^99, n-2) in 2nd DISTR.

 

Let's see this with an example we saw earlier on this page and use the p-value method:

Example

A random sample of 11 statistics students produced the following data, where [latex]x[/latex] is the third exam score out of 80, and [latex]y[/latex] is the final exam score out of 200. Can you predict the final exam score of a random student if you know the third exam score? Table below shows the scores on the final exam based on scores from the third exam.

Table 3: Scores on the Final Exam based on Scores from the Third Exam
[latex]x[/latex] (third exam score) [latex]y[/latex] (final exam score)
65 175
67 133
71 185
71 163
66 126
75 198
67 153
70 163
71 159
69 151
69 159

We found that the line of best fit is: [latex]\hat{y} = -173.51 + 4.83x[/latex] with [latex]r = 0.6631[/latex] and there are [latex]n = 11[/latex] data points. Can the regression line be used for prediction? Given a third exam score ([latex]x[/latex] value), can we use the line to predict the final exam score (predicted [latex]y[/latex] value)?

[latex]H_0: \rho = 0[/latex]

[latex]H_a: \rho \neq 0[/latex]

[latex]\alpha = 0.05[/latex]

  • The p-value is 0.026 (from LinRegTTest on your calculator or from computer software).
  • The p-value, 0.026, is less than the significance level of [latex]\alpha = 0.05[/latex].

Decision: Reject the Null Hypothesis [latex]H_0[/latex]

Conclusion: There is sufficient evidence to conclude that there is a significant linear relationship between the third exam score ([latex]x[/latex]) and the final exam score ([latex]y[/latex]) because the correlation coefficient is significantly different from zero.

Because [latex]r[/latex] is significant and the scatter plot shows a linear trend, the regression line can be used to predict final exam scores.

 

Outliers

In 10.6 Outliers, we discussed in some data sets, there are values (observed data points) called outliers. Outliers are observed data points that are far from the least squares line. They have large "errors", where the "error" or residual is the vertical distance from the line to the point. Outliers need to be examined closely. Sometimes, for some reason or another, they should not be included in the analysis of the data. It is possible that an outlier is a result of erroneous data. Other times, an outlier may hold valuable information about the population under study and should remain included in the data. The key is to examine carefully what causes a data point to be an outlier.

Computers and many calculators can be used to identify outliers from the data. Computer output for regression analysis will often identify both outliers and influential points so that you can examine them.

We could guess at outliers by looking at a graph of the scatterplot and best fit-line. However, we would like some guideline as to how far away a point needs to be in order to be considered an outlier. As a rough rule of thumb, we can flag any point that is located further than two standard deviations above or below the best-fit line as an outlier. The standard deviation used is the standard deviation of the residuals or errors.

We can do this visually in the scatter plot by drawing an extra pair of lines that are two standard deviations above and below the best-fit line. Any data points that are outside this extra pair of lines are flagged as potential outliers. Or we can do this numerically by calculating each residual and comparing it to twice the standard deviation. On the TI-83, 83+, or 84+, the graphical approach is easier. The graphical procedure is shown first, followed by the numerical calculations. You would generally need to use only one of these methods.

Let's see this with the same example from earlier.

Example

A random sample of 11 statistics students produced the following data, where [latex]x[/latex] is the third exam score out of 80, and [latex]y[/latex] is the final exam score out of 200. Can you predict the final exam score of a random student if you know the third exam score? Table below shows the scores on the final exam based on scores from the third exam.

Table 4: Scores on the Final Exam based on Scores from the Third Exam
[latex]x[/latex] (third exam score) [latex]y[/latex] (final exam score)
65 175
67 133
71 185
71 163
66 126
75 198
67 153
70 163
71 159
69 151
69 159

You can determine if there is an outlier or not. If there is an outlier, as an exercise, delete it and fit the remaining data to a new line. For this example, the new line ought to fit the remaining data better. This means the SSE should be smaller and the correlation coefficient ought to be closer to 1 or –1.

Graphical Identification of Outliers:

With the TI-83, 83+, 84+ graphing calculators, it is easy to identify the outliers graphically and visually. If we were to measure the vertical distance from any data point to the corresponding point on the line of best fit and that distance were equal to [latex]2s[/latex] or more, then we would consider the data point to be "too far" from the line of best fit. We need to find and graph the lines that are two standard deviations below and above the regression line. Any points that are outside these two lines are outliers. We will call these lines [latex]Y2[/latex] and [latex]Y3[/latex].

As we did with the equation of the regression line and the correlation coefficient, we will use technology to calculate this standard deviation for us. Using the LinRegTTest with this data, scroll down through the output screens to find [latex]s = 16.412[/latex].

Line [latex]Y2 = –173.5 + 4.83x –2(16.4)[/latex] and line [latex]Y3 = –173.5 + 4.83x + 2(16.4)[/latex] where [latex]\hat{y} = –173.5 + 4.83x[/latex] is the line of best fit. [latex]Y2[/latex] and [latex]Y3[/latex] have the same slope as the line of best fit.

Graph the scatter plot with the best fit line in equation Y1, then enter the two extra lines as [latex]Y2[/latex] and [latex]Y3[/latex] in the "Y=" equation editor and press ZOOM 9. You will find that the only data point that is not between lines [latex]Y2[/latex] and [latex]Y3[/latex] is the point [latex]x = 65[/latex], [latex]y = 175[/latex]. On the calculator screen, it is just barely outside these lines. The outlier is the student who had a grade of 65 on the third exam and 175 on the final exam; this point is farther than two standard deviations away from the best-fit line.

Sometimes a point is so close to the lines used to flag outliers on the graph that it is difficult to tell if the point is between or outside the lines. On a computer, enlarging the graph may help; on a small calculator screen, zooming in may make the graph clearer. Note that when the graph does not give a clear enough picture, you can use the numerical comparisons to identify outliers.

Scatter plot of exam scores with a line of best fit. Two yellow dashed lines run parallel to the line of best fit, above and below at equal distances.
Figure 3. One data point falls outside the boundary created by the dashed lines—it is an outlier.
Numerical Identification of Outliers:

If you do want to use the numerical approach, you can still use the graphing calculator to assist you. Rather than calculate the value of [latex]s[/latex] for the residuals ourselves, we can find s using the calculator. For this example, the calculator function LinRegTTest found [latex]s = 16.4[/latex] as the standard deviation of the residuals 35; –17; 16; –6; –19; 9; 3; –1; –10; –9; –1.

Table 5: Calculations of Standard Deviation
[latex]x[/latex] [latex]y[/latex] [latex]\hat{y}[/latex] [latex]y – \hat{y}[/latex]
65 175 140 175 – 140 = 35
67 133 150 133 – 150= –17
71 185 169 185 – 169 = 16
71 163 169 163 – 169 = –6
66 126 145 126 – 145 = –19
75 198 189 198 – 189 = 9
67 153 150 153 – 150 = 3
70 163 164 163 – 164 = –1
71 159 169 159 – 169 = –10
69 151 160 151 – 160 = –9
69 159 160 159 – 160 = –1

We are looking for all data points for which the residual is greater than [latex]2s = 2(16.4) = 32.8[/latex] or less than –32.8. Compare these values to the residuals in column four of the table. The only such data point is the student who had a grade of 65 on the third exam and 175 on the final exam; the residual for this student is 35.

 

How Does the Outlier Affect the Best Fit Line?

For the example above, numerically and graphically, we have identified the point (65, 175) as an outlier. We should re-examine the data for this point to see if there are any problems with the data. If there is an error, we should fix the error if possible, or delete the data. If the data is correct, we would leave it in the data set. For this problem, we will suppose that we examined the data and found that this outlier data was an error. Therefore we will continue on and delete the outlier, so that we can explore how it affects the results, as a learning experience.Compute a new best-fit line and correlation coefficient using the ten remaining points:

On the TI-83, TI-83+, TI-84+ calculators, delete the outlier from L1 and L2. Using the LinRegTTest, the new line of best fit and the correlation coefficient are [latex]\hat{y} = –355.19 + 7.39x[/latex] and [latex]r = 0.9121[/latex].

The new line with [latex]r = 0.9121[/latex] is a stronger correlation than the original ([latex]r = 0.6631[/latex]) because [latex]r = 0.9121[/latex] is closer to one. This means that the new line is a better fit to the ten remaining data values. The line can better predict the final exam score given the third exam score.

 

Here's a new example for you to try everything that was shown that you can do on the graphing calculator.

Example

The Consumer Price Index (CPI) measures the average change over time in the prices paid by urban consumers for consumer goods and services. The CPI affects nearly all Americans because of the many ways it is used. One of its biggest uses is as a measure of inflation. By providing information about price changes in the Nation's economy to government, business, and labor, the CPI helps them to make economic decisions. The president, Congress, and the Federal Reserve Board use the CPI's trends to formulate monetary and fiscal policies. In the following table, x is the year and y is the CPI.

Table 6: CPI and Year Data
[latex]x[/latex] [latex]y[/latex] [latex]x[/latex] [latex]y[/latex]
1915 10.1 1969 36.7
1926 17.7 1975 49.3
1935 13.7 1979 72.6
1940 14.7 1980 82.4
1947 24.1 1986 109.6
1952 26.5 1991 130.7
1964 31.0 1999 166.6
  1. Draw a scatter plot of the data.
  2. Calculate the least squares line. Write the equation in the form [latex]\hat{y} = a + bx[/latex].
  3. Draw the line on the scatter plot.
  4. Find the correlation coefficient.
  5. Is the correlation coefficient significant?
  6. Are there any outliers in the data?

Solution

  1. Shown below with question 3.
  2. [latex]\hat{y} = –3204 + 1.662x[/latex] is the equation of the line of best fit.
  3. Scatter plot and line of best fit of the consumer price index data, on the y-axis, and year data, on the x-axis.
    Figure 4. Scatter Plot for Example
  4. [latex]r = 0.8694[/latex]
  5. [latex]r[/latex] is significant
  6. Using the calculator LinRegTTest, we find that [latex]s = 25.4[/latex]; graphing the lines [latex]Y2 = –3204 + 1.662X – 2(25.4)[/latex] and [latex]Y3 = –3204 + 1.662X + 2(25.4)[/latex] shows that no data values are outside those lines, identifying no outliers. (Note that the year 1999 was very close to the upper line, but still inside it.)

 

More Notes for Graphing Calculator

As we have seen on this page, the TI-83 has a built-in linear regression feature, which allows the data to be inputted and run to calculate everything needed. To use the calculator, the x-values will be in [L1]; the y-values in [L2]. Here's some more detailed notes for using the graphing calculator for concepts covered on this page. Also some alternate steps than what was already mentioned.

To enter data and do linear regression:

  1. on key Turns calculator on.

  2. Before accessing this program, be sure to turn off all plots.

    • Access graphing mode.
      2nd key , [STAT PLOT]

    • Turn off all plots.
      number 4 key , enter key

  3. Round to three decimal places. To do so:
    • Access the mode menu.
      mode key , [STAT PLOT]

    • Navigate to <Float> and then to the right to <3>.
      arrow down key arrow right key

    • All numbers will be rounded to three decimal places until changed.
      enter key

  4. Enter statistics mode and clear lists [L1] and [L2], as describe previously.
    stat key , number 4 key

  5. Enter editing mode to insert values for x and y.
    stat key , enter key

  6. Enter each value. Press enter key to continue.

To display the correlation coefficient:

  1. Access the catalog.
    2nd key , [CATALOG]

  2. Arrow down and select <DiagnosticOn>
    arrow down key... , enter key , enter key

  3. \(r\) and \({r}^{2}\) will be displayed during regression calculations.
  4. Access linear regression.
    stat key arrow right key

  5. Select the form of y = a + bx.
    number 8 key , enter key

To see the scatter plot:

  1. Access graphing mode.
    2nd key , [STAT PLOT]

  2. Select <1:plot 1> To access plotting - first graph.
    enter key

  3. Navigate and select <ON> to turn on Plot 1.
    <ON> enter key

  4. Navigate to the first picture.
  5. Select the scatter plot.
    enter key

  6. Navigate to <Xlist>.
  7. If [L1] is not selected, press 2nd key , [L1] to select it.
  8. Confirm that the data values are in [L1].
    <ON> enter key

  9. Navigate to <Ylist>.
  10. Select that the frequencies are in [L2].
    2nd key , [L2] , enter key

  11. Go back to access other graphs.
    2nd key , [STAT PLOT]

  12. Use the arrows to turn off the remaining plots.
  13. Access window mode to set the graph parameters.
    window key
  14. Be sure to deselect or clear all equations before graphing, using the instructions above.
  15. Press the graph button to see the scatter plot. graph key

To see the regression graph:

  1. Access the equation menu. The regression equation will be put into Y1.
    Y= key

  2. Access the vars menu and navigate to <5: Statistics>.
    vars key , number 5 key

  3. Navigate to <EQ>.
  4. <1: RegEQ> contains the regression equation which will be entered in Y1.
    enter key

  5. Press the graphing mode button. The regression line will be superimposed over the scatter plot.
    graph key

To see the residuals and use them to calculate the critical point for an outlier:

  1. Access the list. RESID will be an item on the menu. Navigate to it.
    2nd key, [LIST], <RESID>

  2. Confirm twice to view the list of residuals. Use the arrows to select them.
    enter key , enter key

  3. The critical point for an outlier is: \(1.9V\frac{\mathrm{SSE}}{n-2}\) where:
    • \(n\) = number of pairs of data
    • \(\mathrm{SSE}\) = sum of the squared errors
    • \(\sum _{}^{}{\mathrm{residual}}^{2}\)
  4. Store the residuals in [L3].
    store key , 2nd key , [L3] , enter key

  5. Calculate the [latex]\frac{{\mathrm{\left(residual\right)}}^{2}}{n-2}\). 2nd key , [L3] , x-squared key , division key , number 8 key

  6. Store this value in [L4]. store key , 2nd key , [L4] , enter key

  7. Calculate the critical value using the equation above. number 1 key , decimal point key , number 9 key , multiplication key , 2nd key , [V] , 2nd key , [LIST] arrow right key , arrow right key , number 5 key , 2nd key , [L4] , closing parenthesis key , closing parenthesis key , enter key

  8. Compare the absolute value of each residual value in [L3] to the critical value. If the absolute value is greater than the critical value, then the (x, y) corresponding point is an outlier. In this case, none of the points is an outlier.

To obtain estimates of y for various x-values:

There are various ways to determine estimates for "y." One way is to substitute values for "x" in the equation. Another way is to use the trace key on the graph of the regression line.

 

Legend

  • A blank calculator button represents a button press
  • [ ] represents yellow command or green letter behind a key
  • < > represents items on the screen
 

Helpful Videos for the Graphing Calculator

Below are links to helpful videos for using the graphing calculator for the concepts covered on this page:

 

Additional Technology Tools

In addition to the graphing calculator, there are some additional technology tools that can be used for the concepts covered on this page. Below are links to helpful videos for those tools:

 

Section Practice

Recently, the annual number of driver deaths per 100,000 for the selected age groups was as follows (Table 7):

Table 7
Age Number of Driver Deaths per 100,000
16–19 38
20–24 36
25–34 24
35–54 20
55–74 18
75+ 28
  1. For each age group, pick the midpoint of the interval for the x value. (For the 75+ group, use 80.)
  2. Using “ages” as the independent variable and “Number of driver deaths per 100,000” as the dependent variable, make a scatter plot of the data.
  3. Calculate the least squares (best–fit) line. Put the equation in the form of: [latex]\hat{y} = a + bx[/latex]
  4. Find the correlation coefficient. Is it significant?
  5. Predict the number of deaths for ages 40 and 60.
  6. Based on the given data, is there a linear relationship between age of a driver and driver fatality rate?
  7. What is the slope of the least squares (best-fit) line? Interpret the slope.
Solution
  1. Table 8: Midpoints for Table 7 Age Data
    Age Number of Driver Deaths per 100,000
    17.5 38
    22 36
    29.5 24
    44.5 20
    64.5 18
    80 28
  2. Check student’s solution.
  3. [latex]\hat{y} = 35.5818045 – 0.19182491x[/latex]
  4. [latex]r = –0.57874[/latex]. For four df and alpha = 0.05, the LinRegTTest gives p-value = 0.2288 so we do not reject the null hypothesis; there is not a significant linear relationship between deaths and age.Using the table of critical values for the correlation coefficient, with four df, the critical value is 0.811. The correlation coefficient [latex]r = –0.57874[/latex] is not less than –0.811, so we do not reject the null hypothesis.
  5. if age = 40, [latex]\hat{y} (\text{deaths}) = 35.5818045 - 0.19182491(40) = 27.9[/latex]
    if age = 60, [latex]\hat{y} (\text{deaths}) = 35.5818045 - 0.19182491(60) = 24.1[/latex]
  6. For the entire dataset, there is a linear relationship for the ages up to age 74. The oldest age group shows an increase in deaths from the prior group, which is not consistent with the younger ages.
  7. [latex]\text{slope} = –0.19182491[/latex]

The maximum discount value of the Entertainment® card for the “Fine Dining” section, Edition ten, for various pages is given in the table below.

Table 9: Page Number and Maximum Value Data
Page number Maximum value ($)
4 16
14 19
25 15
32 17
43 19
57 15
72 16
85 15
90 17
  1. Decide which variable should be the independent variable and which should be the dependent variable.
  2. Draw a scatter plot of the ordered pairs.
  3. Calculate the least-squares line. Put the equation in the form of: [latex]\hat{y} = a + bx[/latex]
  4. Find the correlation coefficient. Is it significant?
  5. Find the estimated maximum values for the restaurants on page ten and on page 70.
  6. Does it appear that the restaurants giving the maximum value are placed in the beginning of the “Fine Dining” section? How did you arrive at your answer?
  7. Suppose that there were 200 pages of restaurants. What do you estimate to be the maximum value for a restaurant listed on page 200?
  8. Is the least squares line valid for page 200? Why or why not?
  9. What is the slope of the least-squares (best-fit) line? Interpret the slope.
Solution
  1. We wonder if the better discounts appear earlier in the book so we select page as [latex]X[/latex] and discount as [latex]Y[/latex].
  2. Check student’s solution.
  3. [latex]\hat{y} = 17.21757 – 0.01412x[/latex]
  4. [latex]r = – 0.2752[/latex]. For seven [latex]df[/latex] and [latex]\alpha = 0.05[/latex], using LinRegTTest [latex]\text{p-value} = 0.4736[/latex] so we do not reject; there is not a significant linear relationship between page and discount.Using the table of critical values for the correlation coefficient, with seven [latex]df[/latex], the critical value is 0.666. The correlation coefficient [latex]x_i = –0.2752[/latex] is not less than 0.666 so we do not reject.
  5. page 10: 17.08; page 70: 16.23
  6. There is not a significant linear correlation so it appears there is no relationship between the page and the amount of the discount.
  7. page 200: 14.39
  8. No, using the regression equation to predict for page 200 is extrapolation.
  9. [latex]\text{slope} = –0.01412[/latex]; As the page number increases by one page, the discount decreases by $0.01412.

Ornithologists, scientists who study birds, tag sparrow hawks in 13 different colonies to study their population. They gather data for the percent of new sparrow hawks in each colony and the percent of those that have returned from migration.

Percent return: 74; 66; 81; 52; 73; 62; 52; 45; 62; 46; 60; 46; 38

Percent new: 5; 6; 8; 11; 12; 15; 16; 17; 18; 18; 19; 20; 20

  1. Enter the data into your calculator and make a scatter plot.
  2. Use your calculator’s regression function to find the equation of the least-squares regression line. Add this to your scatter plot from part 1.
  3. Explain in words what the slope and y-intercept of the regression line tell us.
  4. How well does the regression line fit the data? Explain your response.
  5. Which point has the largest residual? Explain what the residual means in context. Is this point an outlier? An influential point? Explain.
  6. An ecologist wants to predict how many birds will join another colony of sparrow hawks to which 70% of the adults from the previous year have returned. What is the prediction?
Solution
  1. Check student's solution.
  2. Check student's solution
  3. The slope of the regression line is -0.3179 with a y-intercept of 32.966. In context, the y-intercept indicates that when there are no returning sparrow hawks, there will be almost 31% new sparrow hawks, which doesn’t make sense since if there are no returning birds, then the new percentage would have to be 100% (this is an example of why we do not extrapolate). The slope tells us that for each percentage increase in returning birds, the percentage of new birds in the colony decreases by 0.3179%.
  4. If we examine [latex]r^2[/latex], we see that only 50.238% of the variation in the percent of new birds is explained by the model and the correlation coefficient, [latex]r = 0.71[/latex] only indicates a somewhat strong correlation between returning and new percentages.
  5. The ordered pair (66, 6) generates the largest residual of 6.0. This means that when the observed return percentage is 66%, our observed new percentage, 6%, is almost 6% less than the predicted new value of 11.98%. If we remove this data pair, we see only an adjusted slope of -0.2723 and an adjusted intercept of 30.606. In other words, even though this data generates the largest residual, it is not an outlier, nor is the data pair an influential point.
  6. If there are 70% returning birds, we would expect to see [latex]y = -0.2723(70) + 30.606 = 0.115[/latex] or 11.5% new birds in the colony.

The following table (Table 10) shows data on average per capita wine consumption and heart disease rate in a random sample of 10 countries.

Table 10
Yearly wine consumption in liters 2.5 3.9 2.9 2.4 2.9 0.8 9.1 2.7 0.8 0.7
Death from heart diseases 221 167 131 191 220 297 71 172 211 300
  1. Enter the data into your calculator and make a scatter plot.
  2. Use your calculator’s regression function to find the equation of the least-squares regression line. Add this to your scatter plot from part 1.
  3. Explain in words what the slope and y-intercept of the regression line tell us.
  4. How well does the regression line fit the data? Explain your response.
  5. Which point has the largest residual? Explain what the residual means in context. Is this point an outlier? An influential point? Explain.
  6. Do the data provide convincing evidence that there is a linear relationship between the amount of alcohol consumed and the heart disease death rate? Carry out an appropriate test at a significance level of 0.05 to help answer this question.

The following table (Table 11) consists of one student athlete’s time (in minutes) to swim 2000 yards and the student’s heart rate (beats per minute) after swimming on a random sample of 10 days:

Table 11
Swim Time Heart Rate
34.12 144
35.72 152
34.72 124
34.05 140
34.13 152
35.73 146
36.17 128
35.57 136
35.37 144
35.57 148
  1. Enter the data into your calculator and make a scatter plot.
  2. Use your calculator’s regression function to find the equation of the least-squares regression line. Add this to your scatter plot from part 1.
  3. Explain in words what the slope and y-intercept of the regression line tell us.
  4. How well does the regression line fit the data? Explain your response.
  5. Which point has the largest residual? Explain what the residual means in context. Is this point an outlier? An influential point? Explain.
Solution
  1. Check student’s solution.
  2. Check student’s solution.
  3. We have a slope of –1.4946 with a y-intercept of 193.88. The slope, in context, indicates that for each additional minute added to the swim time, the heart rate will decrease by 1.5 beats per minute. If the student is not swimming at all, the y-intercept indicates that his heart rate will be 193.88 beats per minute. While the slope has meaning (the longer it takes to swim 2,000 meters, the less effort the heart puts out), the y-intercept does not make sense. If the athlete is not swimming (resting), then his heart rate should be very low.
  4. Since only 1.5% of the heart rate variation is explained by this regression equation, we must conclude that this association is not explained with a linear relationship.
  5. The point (34.72, 124) generates the largest residual of –11.82. This means that our observed heart rate is almost 12 beats less than our predicted rate of 136 beats per minute. When this point is removed, the slope becomes 1.6914 with the y-intercept changing to 83.694. While the linear association is still very weak, we see that the removed data pair can be considered an influential point in the sense that the y-intercept becomes more meaningful.

A researcher is investigating whether non-white minorities commit a disproportionate number of homicides. He uses demographic data from Detroit, MI to compare homicide rates and the number of the population that are white males.

Table 12: White Males to Homicide Rate
White Males Homicide rate per 100,000 people
558,724 8.6
538,584 8.9
519,171 8.52
500,457 8.89
482,418 13.07
465,029 14.57
448,267 21.36
432,109 28.03
416,533 31.49
401,518 37.39
387,046 46.26
373,095 47.24
359,647 52.33
  1. Use your calculator to construct a scatter plot of the data. What should the independent variable be? Why?
  2. Use your calculator’s regression function to find the equation of the least-squares regression line. Add this to your scatter plot.
  3. Discuss what the following mean in context.
    • The slope of the regression equation
    • The y-intercept of the regression equation
    • The correlation r
    • The coefficient of determination r2.
  4. Do the data provide convincing evidence that there is a linear relationship between the number of white males in the population and the homicide rate? Carry out an appropriate test at a significance level of 0.05 to help answer this question.

License

Icon for the Creative Commons Attribution-ShareAlike 4.0 International License

Introductory Statistics Copyright © 2024 by LOUIS: The Louisiana Library Network is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, except where otherwise noted.