Module 4 - Computer Discussion
Business Analytics
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Linear Regression
Chapter 7
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Introduction (Slide 1 of 2)
Managerial decisions are often based on the relationship between two or more variables:
Example: After considering the relationship between advertising expenditures and sales, a marketing manager might attempt to predict sales for a given level of advertising expenditures.
Sometimes a manager will rely on intuition to judge how two variables are related.
If data can be obtained, a statistical procedure called regression analysis can be used to develop an equation showing how the variables are related.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Introduction (Slide 2 of 2)
Dependent variable or response: Variable being predicted.
Independent variables or predictor variables: Variables being used to predict the value of the dependent variable.
Simple linear regression: A regression analysis for which any one unit change in the independent variable, x, is assumed to result in the same change in the dependent variable, y.
Multiple linear regression: A regression analysis involving two or more independent variables.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Simple Linear Regression Model
Regression Model
Estimated Regression Equation
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Simple Linear Regression Model (Slide 1 of 5)
Regression Model:
The equation that describes how y is related to x and an error term.
The error term accounts for the variability in y that cannot be explained by the linear relationship between x and y.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
In the Butler Trucking Company example, the population consists of all the driving assignments that can be made by the company.
For every driving assignment in the population, there is a value of x (miles traveled) and a corresponding value of y (travel time in hours).
6
Simple Linear Regression Model (Slide 2 of 5)
Estimated Regression Equation:
The parameter values are usually not known and must be estimated using sample data.
the regression equation and dropping the error term, we obtain the estimated regression for simple linear regression.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
To estimate the mean or expected value of travel time for a driving assignment of 75 miles, Butler Trucking would substitute the value of 75 for x in equation = b0 + b1x.
7
Simple Linear Regression Model (Slide 3 of 5)
In the estimated simple linear regression equation:
The graph of the estimated simple linear regression equation is called the estimated regression line.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
To estimate the mean or expected value of travel time for a driving assignment of 75 miles, Butler Trucking would substitute the value of 75 for x in equation = b0 + b1x.
8
Meghan Cook (MC) - The slash in this equation should be a vertical line. I have edited the alt text to show how this should read as well.
Simple Linear Regression Model (Slide 4 of 5)
Figure 7.1: The Estimation Process in Simple Linear Regression
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
9
Simple Linear Regression Model (Slide 5 of 5)
Figure 7.2: Possible Regression Lines in Simple Linear Regression
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The regression line in Panel A shows that the mean value of y is related positively to x, with larger values of associated with larger values of x.
In Panel B, the mean value of y is related negatively to x, with smaller values of associated with larger values of x.
In Panel C, the mean value of y is not related to x; that is, is the same for every value of x.
10
Least Squares Method
Least Squares Estimates of the Regression Parameters
Using Excel’s Chart Tools to Compute the Estimated Regression Equation
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Least Squares Method (Slide 1 of 15)
Least squares method: A procedure for using sample data to find the estimated regression equation.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
12
Least Squares Method (Slide 2 of 15)
Table 7.1: Miles Traveled and Travel Time for 10 Butler Trucking Company Driving Assignments
| Driving Assignment i | x = Miles Traveled | y = Travel Time (hours) |
| 1 | 100 | 9.3 |
| 2 | 50 | 4.8 |
| 3 | 50 | 8.9 |
| 4 | 100 | 6.5 |
| 5 | 50 | 4.2 |
| 6 | 80 | 6.2 |
| 7 | 75 | 7.4 |
| 8 | 65 | 6.0 |
| 9 | 90 | 7.6 |
| 10 | 90 | 6.1 |
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
To illustrate the least squares method, suppose data were collected from a sample of 10 Butler Trucking Company driving assignments.
For the ith observation or driving assignment in the sample, xi is the miles traveled and yi is the travel time (in hours).
The values of xi and yi for the 10 driving assignments in the sample are summarized in Table 7.1.
13
Least Squares Method (Slide 3 of 15)
Figure 7.3: Scatter Chart of Miles Traveled and Travel Time for Sample of 10 Butler Trucking Company Driving Assignments
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Figure 7.3 is a scatter chart of the data in Table 7.1.
Miles traveled is shown on the horizontal axis, and travel time (in hours) is shown on the vertical axis.
Longer travel times appear to coincide with more miles traveled.
The relationship between the travel time and miles traveled appears to be approximated by a straight line; indeed, a positive linear relationship is indicated between x and y.
Therefore, the simple linear regression model is chosen to represent this relationship.
14
Least Squares Method (Slide 4 of 15)
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
15
Least Squares Method (Slide 5 of 15)
Hence,
We are finding the regression that minimizes the sum of squared errors.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
16
Least Squares Method (Slide 6 of 15)
Least Squares Estimates of the Regression Parameters:
For the Butler Trucking Company data in Table 7.1:
The estimated simple linear regression model:
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
17
Least Squares Method (Slide 7 of 15)
If the length of a driving assignment were 1 unit (1 mile) longer, the mean travel time for that driving assignment would be 0.0678 units (0.0678 hours, or approximately 4 minutes) longer.
If the driving distance for a driving assignment was 0 units (0 miles), the mean travel time would be 1.2739 units (1.2739 hours, or approximately 76 minutes).
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
We interpret b1 and b0 as we would the y-intercept and slope of any straight line.
18
Least Squares Method (Slide 8 of 15)
Experimental region: The range of values of the independent variables in the data used to estimate the model.
The regression model is valid only over this region.
Extrapolation: Prediction of the value of the dependent variable outside the experimental region.
It is risky.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Because we have no empirical evidence that the relationship we have found holds true for values of x outside of the range of values of x in the data used to estimate the relationship, extrapolation is risky and should be avoided if possible.
For Butler Trucking, this means that any prediction outside the travel time for a driving distance less than 50 miles or greater than 100 miles is not a reliable estimate, and so for this model the estimate of β0 is meaningless.
However, if the experimental region for a regression problem includes zero, the y-intercept will have a meaningful interpretation.
19
Least Squares Method (Slide 9 of 15)
Butler Trucking Company example: Use the estimated model and the known values for miles traveled for a driving assignment (x) to estimate mean travel time in hours.
For example, the first driving assignment in Table 7.1 has a value for miles
The mean travel time in hours for this driving assignment is estimated to be:
The resulting residual of the estimate is:
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The simple linear regression model underestimated travel time for this driving assignment by 1.2461 hours (approximately 74 minutes).
20
Least Squares Method (Slide 10 of 15)
Table 7.2: Predicted Travel Time and Residuals for 10 Butler Trucking Company Driving Assignments
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Note in Table 7.2 that:
The sum of predicted values is equal to the sum of the values of the dependent variable y.
The sum of the residuals ei is 0.
The sum of the squared residuals has been minimized.
21
Least Squares Method (Slide 11 of 15)
Figure 7.4: Scatter Chart of Miles Traveled and Travel Time for Butler Trucking Company Driving Assignments with Regression Line Superimposed
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Figure 7.4 shows the simple linear regression line = 1.2739 + 0.0678xi superimposed on the scatter chart for the Butler Trucking Company data in Table 7.1.
This figure, which also highlights the residuals for driving assignment 3 (e3) and driving assignment 5 (e5), shows that the regression model underpredicts travel time for some driving assignments (such as driving assignment 3) and overpredicts travel time for others (such as driving assignment 5), but in general appears to fit the data relatively well.
22
Least Squares Method (Slide 12 of 15)
Figure 7.5: A Geometric Interpretation of the Least Squares Method
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
In Figure 7.5, a vertical line is drawn from each point in the scatter chart to the linear regression line.
Each of these lines represents the difference between the actual driving time and the driving time to be predicted using linear regression for one of the assignments in the data.
The length of each line is equal to the absolute value of the residual for one of the driving assignments.
When a residual is squared, the resulting value is equal to the square that is formed using the vertical dashed line representing the residual in Figure 7.4 as one side of a square.
Thus, when we find the linear regression model that minimizes the sum of squared errors for the Butler Trucking example, we are positioning the regression line in the manner that minimizes the sum of the areas of the ten squares in Figure 7.5.
23
Least Squares Method (Slide 13 of 15)
Using Excel’s Chart Tools to Compute the Estimated Regression Equation:
After constructing a scatter chart with Excel’s chart tools:
Right-click on any data point and select Add Trendline.
When the Format Trendline task pane appears:
Select Linear in the Trendline Options area.
Select Display Equation on chart in the Trendline Options area.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Least Squares Method (Slide 14 of 15)
Figure 7.6: Scatter Chart and Estimated Regression Line for Butler Trucking Company
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
We can use Excel’s chart tools to compute the estimated regression equation on a scatter chart of the Butler Trucking Company data in Table 7.1.
The worksheet displayed in Figure 7.6 shows the original data, scatter chart, estimated regression line, and estimated regression equation.
Note that Excel uses y instead of to denote the predicted value of the dependent variable and puts the regression equation into slope-intercept form whereas we use the intercept-slope form that is standard in statistics.
25
Least Squares Method (Slide 15 of 15)
Slope Equation
y-Intercept Equation
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
26
Assessing the Fit of the Simple Linear Regression Model
The Sums of Squares
The Coefficient of Determination
Using Excel’s Chart Tools to Compute the Coefficient of Determination
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Assessing the Fit of the Simple Linear Regression Model (Slide 1 of 10)
The Sums of Squares:
Sum of squares due to error: The value of SSE is a measure of the error in using the estimated regression equation to predict the values of the dependent variable in the sample.
From Table 7.2,
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Assessing the Fit of the Simple Linear Regression Model (Slide 2 of 10)
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Without knowledge of any related variables, we would use the sample mean as a predictor of travel time for any given driving assignment.
To find , we divide the sum of the actual driving times yi from Table 7.2 (67) by the number of observations n in the data (10); this yields = 6.7.
Figure 7.7 provides insight on how well we would predict the values of yi in the Butler Trucking company example using = 6.7.
From this figure, which again highlights the residuals for driving assignments 3 and 5, we can see that tends to overpredict travel times for driving assignments that have relatively small values for miles traveled (such as driving assignment 5) and tends to underpredict travel times for driving assignments that have relatively large values for miles traveled (such as driving assignment 3).
29
Assessing the Fit of the Simple Linear Regression Model (Slide 3 of 10)
Table 7.3 shows the sum of squared deviations obtained by using
for each driving assignment in the sample.
Butler Trucking Example: For the ith driving assignment in the
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
SST is a measure of how well the observations cluster about the line.
30
Assessing the Fit of the Simple Linear Regression Model (Slide 4 of 10)
The corresponding sum of squares is called the total sum of squares (SST).
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
SST is a measure of how well the observations cluster about the line.
31
Assessing the Fit of the Simple Linear Regression Model (Slide 5 of 10)
Table 7.3: Calculations for the Sum of Squares Total for the Butler Trucking Simple Linear Regression
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The sum at the bottom of the last column in Table 7.3 is the total sum of squares for Butler Trucking Company: SST = 23.9.
32
Assessing the Fit of the Simple Linear Regression Model (Slide 6 of 10)
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
In Figure 7.8, we show the estimated regression line = 1.2739 + 0.0678xi and the line corresponding to = 6.7.
Note that the points cluster more closely around the estimated regression line = 1.2739 + 0.0678xi than they do about the horizontal line = 6.7.
33
Assessing the Fit of the Simple Linear Regression Model (Slide 7 of 10)
Relation between SST, SSR, and SSE:
where
SST = total sum of squares
SSR = sum of squares due to regression
SSE = sum of squares due to error.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
In the Butler Trucking Company example, SSE = 8.0288 and SST = 23.9:
SSR = SST SSE = 23.9 8.0288 = 15.8712
34
Assessing the Fit of the Simple Linear Regression Model (Slide 8 of 10)
The Coefficient of Determination:
The ratio SSR/SST used to evaluate the goodness of fit for the estimated regression equation; this ratio is called the coefficient of determination and is denoted by
Take values between zero and one.
Interpreted as the percentage of the total sum of squares that can be explained by using the estimated regression equation.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
For the Butler Trucking Company example, the coefficient of determination,
r2 = = = 0.6641.
It can be concluded that 66.41% of the total sum of squares can be explained by using the estimated regression equation = 1.2739 + 0.0678xi to predict quarterly sales.
35
Assessing the Fit of the Simple Linear Regression Model (Slide 9 of 10)
Using Excel’s Chart Tools to Compute the Coefficient of Determination:
To compute the coefficient of determination using the scatter chart in Figure 7.3:
Right-click on any data point in the scatter chart and select Add Trendline…
When the Format Trendline task pane appears:
Select Display R-squared value on chart in the Trendline Options area.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
36
Assessing the Fit of the Simple Linear Regression Model (Slide 10 of 10)
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Figure 7.9 displays the scatter chart, the estimated regression equation, the graph of the estimated regression equation, and the coefficient of determination for the Butler Trucking Company data. We see that r2 = 0.6641.
37
The Multiple Regression Model
Regression Model
Estimated Multiple Regression Equation
Least Squares Method and Multiple Regression
Butler Trucking Company and Multiple Regression
Using Excel’s Regression Tool to Develop the Estimated Multiple Regression Equation
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The Multiple Regression Model (Slide 1 of 11)
Regression Model:
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
39
The Multiple Regression Model (Slide 2 of 11)
Regression Model (cont.):
Represents the change in the mean value of the dependent variable y that corresponds to a one unit increase in the independent variable
holding the values of all other independent variables in the model constant.
The multiple regression equation that describes how the mean value of y is related to
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
40
The Multiple Regression Model (Slide 3 of 11)
Estimated Multiple Regression Equation:
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
41
The Multiple Regression Model (Slide 4 of 11)
Least Squares Method and Multiple Regression:
The least squares method is used to develop the estimated multiple regression equation:
Finding
Uses sample data to provide the values of
that minimize the sum of squared residuals.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
42
The Multiple Regression Model (Slide 5 of 11)
Figure 7:10: The Estimation Process for Multiple Regression
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The estimation process for multiple regression is shown in Figure 7.10.
The estimated values of the dependent variable y are computed by substituting values of the independent variables x1, x2, . . . , xq into the estimated multiple regression equation.
Computer software packages can be used to obtain the estimated regression equation and determine the regression coefficients b0, b1, b2, . . . , bq.
43
The Multiple Regression Model (Slide 6 of 11)
Butler Trucking Company and Multiple Regression:
The estimated simple linear regression equation,
The linear effect of the number of miles traveled explains 66.41%
This implies, 33.59% of the variability in sample travel times remains unexplained
The managers might want to consider adding one or more independent variables, such as number of deliveries, to the model to explain some of the remaining variability in the dependent variable.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
44
The Multiple Regression Model (Slide 7 of 11)
Butler Trucking Company and Multiple Regression (cont.):
Estimated multiple linear regression with two independent variables:
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
45
The Multiple Regression Model (Slide 8 of 11)
Figure 7.11: Data Analysis Tools Box
Using Excel’s Regression Tool to Develop the Estimated Multiple Regression Equation:
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The following steps describe how to use Excel’s Regression tool to compute the estimated regression equation using the data in the worksheet.
Copy the data values from the file ButlerWithDeliveries into an Excel worksheet from columns A through D and rows 1 through 301.
Step 1. Click the DATA tab in the Ribbon
Step 2. Click Data Analysis in the Analysis group
Step 3. Select Regression from the list of Analysis Tools in the Data Analysis tools box (shown in Figure 7.11) and click OK
46
The Multiple Regression Model (Slide 9 of 11)
Figure 7.12: Regression Dialog Box
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Step 4. When the Regression dialog box appears (as shown in Figure 7.12):
1. Enter D1:D301 in the Input Y Range: box
2. Enter B1:C301 in the Input X Range: box
3. Select Labels
Selecting Labels tells Excel to use the names you have given to your variables in row 1 when displaying the regression model output.
4. Select Confidence Level:
5. Enter 99 in the Confidence Level: box
6. Select New Worksheet Ply:
7. Click OK
47
The Multiple Regression Model (Slide 10 of 11)
Figure 7.13: Excel Regression Output for the Butler Trucking Company with Miles and Deliveries as Independent Variables
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
In the Excel output shown in Figure 7.13, the label for the independent variable x1 is Miles (see cell A18), and the label for the independent variable x2 is Deliveries (see cell A19).
Estimated regression equation:
= 0.1273 + 0.0672x1 + 0.6900x2
Interpretation:
For a fixed number of deliveries, we estimate that the mean travel time will increase by 0.0672 hours when the distance traveled increases by 1 mile.
For a fixed distance traveled, we estimate that the mean travel time will increase by 0.69 hours when the number of deliveries increases by 1 delivery.
Multiple coefficient of determination, R2 = 0.8173.
Interpretation: 81.73% of the variability in sample values of the dependent variable, travel time, is explained by the independent variables, number of deliveries and distance traveled.
48
The Multiple Regression Model (Slide 11 of 11)
Figure 7.14: Graph of the Regression Equation for Multiple Regression Analysis with Two Independent Variables
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
With two independent variables x1 and x2, we now generate a predicted value of y for every combination of values of x1 and x2.
Thus, instead of a regression line, we now create a regression plane in three-dimensional space.
Figure 7.14 provides the graph of the estimated regression plane for the Butler Trucking Company example and shows the seventh driving assignment in the data.
As the plane slopes upward to larger values of total travel time () as either the number of miles traveled (x1) or the number of deliveries (x2) increases.
The residual for a driving assignment when x1 = 75 and x2 = 3 is the difference between the observed y value and the estimated mean value of y when
x1 = 75 and x2 = 3.
The observed value lies above the regression plane, indicating that the regression model underestimates the expected driving time for the seventh driving assignment.
49
Inference and Regression
Conditions Necessary for Valid Inference in the Least Squares Regression Model
Testing Individual Regression Parameters
Addressing Nonsignificant Independent Variables
Multicollinearity
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Inference and Regression (Slide 1 of 17)
Statistical inference: Process of making estimates and drawing conclusions about one or more characteristics of a population (the value of one or more parameters) through the analysis of sample data drawn from the population.
In regression, inference is commonly used to estimate and draw conclusions about:
The regression parameters
The mean value and/or the predicted value of the dependent variable y for specific values of the independent variables
Consider both hypothesis testing and interval estimation.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
51
Inference and Regression (Slide 2 of 17)
Conditions Necessary for Valid Inference in the Least Squares Regression Model:
For any given combination of values of the independent variables
distributed with a mean of 0 and a constant variance.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Inference and Regression (Slide 3 of 17)
Figure 7.15: Illustration of the Conditions for Valid Inference in Regression
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Figure 7.15 illustrates the model conditions and their implications for a simple linear regression.
Note that in this graphical interpretation, the value of E(y|x) changes linearly according to the specific value of x considered, and so the mean error is zero at each value of x.
However, regardless of the x value, the error term ε and hence the dependent variable y are normally distributed, each with the same variance.
The specific value of the error ε at any particular point depends on whether the actual value of y is greater or less than E(y|x).
53
Inference and Regression (Slide 4 of 17)
Figure 7.16: Example of a Random Error Pattern in a Scatter Chart of Residuals and Predicted Values of the Dependent Variable
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Simple scatter charts of the residuals and independent variables are an extremely effective method for assessing whether these conditions are violated.
We should review the scatter chart for patterns in the residuals indicating that one or more of the conditions have been violated.
Ideally, the residuals will be consistently scattered around zero throughout the predicted values of the independent variable.
This is shown in the example in Figure 7.16.
54
Inference and Regression (Slide 5 of 17)
Figure 7.17: Examples of Diagnostic Scatter Charts of Residuals from Four Regressions
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The residuals in the four panels of Figure 7.17 show distinct patterns, each of which suggests a violation of at least one of the regression model conditions.
In panel a, the variation in the residuals e increases as the value of the independent variable x increases, suggesting that the residuals do not have a constant variance.
In panel b, the residuals are positive for small and large values of the independent variable x but are negative for moderate values of the independent variable.
This pattern suggests that the linear relationships in the regression model underpredicts the value of dependent variable for small and large values of the independent variable and overpredicts the value of the dependent variable for intermediate values of the independent variable.
The residuals in panel c are not symmetrically distributed around 0; many of the negative residuals are relatively close to zero, while the relatively few positive residuals tend to be far from zero. This skewness suggests that the residuals are not normally distributed.
The residuals in panel d are plotted over time t, which generally serves as an independent variable; that is, an observation is made at each of several (usually equally spaced) points in time.
55
Inference and Regression (Slide 6 of 17)
Figure 7.18: Excel Residual Plots for the Butler Trucking Company Multiple Regression
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
You can generate scatter charts of the residuals against each independent variable in the model when using Excel’s Regression tool; to do so, select the Residual Plots option in the Residuals area of the Regression dialog box.
Figure 7.18 shows residual plots produced by Excel for the Butler Trucking Company example for which the independent variables are miles (x1) and deliveries (x2).
The residuals at each value of miles appear to have a mean of zero, to have similar variances, and to be concentrated around zero.
The residuals at each value of deliveries also appear to have a mean of zero, to have similar variances, and to be concentrated around zero.
56
Inference and Regression (Slide 7 of 17)
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
57
Inference and Regression (Slide 8 of 17)
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
58
Inference and Regression (Slide 9 of 17)
Testing Individual Regression Parameters:
To determine whether statistically significant relationships exist between the dependent variable y and each of the independent variables
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
59
Inference and Regression (Slide 10 of 17)
Testing Individual Regression Parameters (cont.):
As the magnitude of t increases (as t deviates from zero in either direction), we are more likely to reject the hypothesis that the regression parameter
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
When we reject the hypothesis that the regression parameter βj is zero, we conclude that a relationship exists between the dependent variable y and the independent variable xj.
Statistical software will generally report a p value for this test statistic.
For a given value of t, this p value represents the probability of collecting a sample of the same size from the same population that yields a larger t statistic given that the value of βj is actually zero.
The hypothesis βj is equal to zero is rejected when the corresponding p value is smaller than some predetermined level of significance (usually 0.05 or 0.01).
60
Inference and Regression (Slide 11 of 17)
Testing Individual Regression Parameters (cont.):
Confidence interval can be used to test whether each of the regression parameters
Confidence interval: An estimate of a population parameter that provides an interval believed to contain the value of the parameter at some level of confidence.
Confidence level: Indicates how frequently interval estimates based on samples of the same size taken from the same population using identical sampling techniques will contain the true value of the parameter we are estimating.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
To test that βj is zero (i.e., there is no linear relationship between xj and y) at some predetermined level of significance (say 0.05), first build a confidence interval at the (1 – 0.05)100% confidence level.
If the resulting confidence interval does not contain zero, we conclude that βj differs from zero at the predetermined level of significance.
Similarly, to test that β0 is zero (i.e., the value of the dependent variable is zero when all the independent variables x1, x2, . . . , xq are equal to zero) at some predetermined level of significance (say 0.05), first build a confidence interval at the (1 – 0.05)100% confidence level.
If the resulting confidence interval does not contain zero, we conclude that β0 differs from zero at the predetermined level of significance.
61
Inference and Regression (Slide 12 of 17)
Addressing Nonsignificant Independent Variables:
If practical experience dictates that the nonsignificant independent variable has a relationship with the dependent variable, the independent variable should be left in the model.
If the model sufficiently explains the dependent variable without the nonsignificant independent variable, then consider rerunning the regression without the nonsignificant independent variable.
The appropriate treatment of the inclusion or exclusion of the y-intercept
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Note that it is possible that the estimates of the other regression coefficients and their p values may change considerably when we remove the nonsignificant independent variable from the model.
Since the primary purpose of the regression model is to explain or predict values of the dependent variable for values of the independent variables that lie within the experimental region on which the model is based, regression through the origin should not be forced unless there are strong a priori reasons for believing that the dependent variable is equal to zero when the values of all independent variables in the model are equal to zero.
62
Inference and Regression (Slide 13 of 17)
Multicollinearity:
Multicollinearity refers to the correlation among the independent variables in multiple regression analysis.
In t tests for the significance of individual parameters, the difficulty caused by multicollinearity is that it is possible to conclude that a parameter associated with one of the multicollinear independent variables is not significantly different from zero when the independent variable actually has a strong relationship with the dependent variable.
This problem is avoided when there is little correlation among the independent variables.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
According to a common rule of thumb test, multicollinearity is a potential problem if the absolute value of the sample correlation coefficient exceeds 0.7 for any two of the independent variables.
The primary consequence of multicollinearity is that it increases the variances and standard errors of the regression estimates of β0, β1, β2, . . . , βq and predicted values of the dependent variable, and so inference based on these estimates is less precise than it should be.
63
Inference and Regression (Slide 14 of 17)
Figure 7.21: Excel Regression Output for the Butler Trucking Company with Miles and Gasoline Consumption as Independent Variables
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Using Excel’s Regression tool, we obtain the results shown in Figure 7.21 for our multiple regression.
When we conduct a t test to determine whether β1 is equal to zero, we find a p value of 3.1544E-07, and so we reject this hypothesis and conclude that travel time is related to miles traveled.
On the other hand, when we conduct a t test to determine whether β2 is equal to zero, we find a p value of 0.6588, and so we do not reject this hypothesis.
64
Inference and Regression (Slide 15 of 17)
Figure 7.22: Scatter Chart of Miles and Gasoline Consumed for Butler Trucking Company
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Using the regression output shown in Figure 7.21, we can use the Excel chart tool to create a scatter chart of these predicted values and residuals, similar to the chart in Figure 7.22.
The figure shows that miles traveled and gasoline consumed are strongly related.
65
Inference and Regression (Slide 16 of 17)
Multicollinearity (cont.):
Testing for an overall regression relationship:
Use an F test based on the F probability distribution.
If the F test leads us to reject the hypothesis that the values of
are all zero:
Conclude that there is an overall regression relationship.
Otherwise, conclude that there is no overall regression relationship.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
66
Inference and Regression (Slide 17 of 17)
Multicollinearity (cont.):
Testing for an overall regression relationship (cont.):
The test statistic generated by the sample data for this test is:
SSR = Sum of squares due to regression.
SSE = Sum of squares due to error.
q = the number of independent variables in the regression model.
n = the number of observations in the sample.
Larger values of F provide stronger evidence of an overall regression relationship.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The numerator of this test statistic is a measure of the variability in the dependent variable y that is explained by the independent variables x1, x2, . . . , xq.
The denominator is a measure of the variability in the dependent variable y that is not explained by the independent variables x1, x2, . . . , xq.
Statistical software will generally report a p value for this test statistic.
For a given value of F, the p-value represents the probability of collecting a sample of the same size from the same population that yields a larger F statistic given that the values of b1, b2, . . . , bq are all actually zero.
Thus, smaller p values indicate stronger evidence against the hypothesis that the values of b1, b2, . . . , bq are all zero (i.e., stronger evidence of an overall regression relationship).
The hypothesis is rejected when the p value is smaller than some predetermined value (usually 0.05 or 0.01) that is referred to as the level of significance.
67
Categorical Independent Variables
Butler Trucking Company and Rush Hour
Interpreting the Parameters
More Complex Categorical Variables
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Categorical Independent Variables (Slide 1 of 10)
Butler Trucking Company and Rush Hour:
Dependent variable, y: Travel time.
travel on the congested segment of highway during afternoon rush hour.
on the congested segment of highway during afternoon rush hour.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The previous independent variables we have considered (such as miles traveled and number of deliveries) have been quantitative, but the new variable, rush hour, is categorical. This variable is also called a dummy variable.
Will this dummy variable add valuable information to the current Butler Trucking regression model?
A review of the residuals produced by the current model may help us make an initial assessment.
We can create a frequency distribution and a histogram of the residuals for driving assignments that included travel on a congested segment of a highway during the afternoon rush hour period.
We then create a frequency distribution and a histogram of the residuals for driving assignments that did not include travel on a congested segment of a highway during the afternoon rush hour period.
69
Categorical Independent Variables (Slide 2 of 10)
Figure 7.23: Histograms of the Residuals for Driving Assignments That Included Travel on a Congested Segment of a Highway During the Afternoon Rush Hour and Residuals for Driving Assignments That Did Not
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
We know that the residual for the ith observation is ei = yi - , which is the difference between the observed and predicted values of the dependent variable.
The histograms in Figure 7.23 show that driving assignments that included travel on a congested segment of a highway during the afternoon rush hour period tend to have positive residuals, which means we are generally underpredicting the travel times for those driving assignments.
Conversely, driving assignments that did not include travel on a congested segment of a highway during the afternoon rush hour period tend to have negative residuals, which means we are generally overpredicting the travel times for those driving assignments.
These results suggest that the dummy variable could potentially explain a substantial proportion of the variance in travel time that is unexplained by the current model, and so we proceed by adding the dummy variable x3 to the current Butler Trucking multiple regression model.
70
Categorical Independent Variables (Slide 3 of 10)
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Using Excel’s Regression tool to develop the estimated regression equation, we obtained the Excel output in Figure 7.24.
The estimated regression equation is = –0.3302 + 0.0672x1 + 0.6735x2 + 0.9980x3.
71
Categorical Independent Variables (Slide 4 of 10)
Interpreting the Parameters:
The model estimates that travel time increases by:
0.0672 hours (about 4 minutes) for every increase of 1 mile traveled, holding constant the number of deliveries and whether the driving assignment route requires the driver to travel on the congested segment of a highway during the afternoon rush hour period.
0.6735 hours (about 40 minutes) for every delivery, holding constant the number of miles traveled and whether the driving assignment route requires the driver to travel on the congested segment of a highway during the afternoon rush hour period.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Categorical Independent Variables (Slide 5 of 10)
Interpreting the Parameters (cont.):
The model estimates that travel time increases by (cont.):
0.9980 hours (about 60 minutes) if the driving assignment route requires the driver to travel on the congested segment of a highway during the afternoon rush hour period, holding constant the number of miles traveled and the number of deliveries.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Categorical Independent Variables (Slide 6 of 10)
Interpreting the Parameters (cont.):
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
74
Categorical Independent Variables (Slide 7 of 10)
More Complex Categorical Variables:
If a categorical variable has k levels, k minus 1 dummy variables are required, with each dummy variable corresponding to one of the levels of the categorical variable and coded as 0 or 1.
Example:
Suppose a manufacturer of vending machines organized the sales territories for a particular state into three regions: A, B, and C.
The managers want to use regression analysis to help predict the number of vending machines sold per week.
Suppose the managers believe sales region is one of the important factors in predicting the number of units sold.
© 2021 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Dummy variables are often used to model seasonal effects in sales data.
75
Categorical Independent Variables (Slide 8 of 10)
More Complex Categorical Variables (cont.):
Example (cont.):
Sales region: categorical variable with three levels (A, B, and C).
Each variable can be coded 0 or 1 as: