Another way to get around the problem revealed in Question 7 and Question 8 of Investigation 5.8, that the sum of residuals from the mean always equals zero, is to examine the sum of the absolute deviations.
Using your results in the table in Question 4 of Investigation 5.8, calculate the sum of the absolute values of the residuals, using the mean height as the predicted value.
Letβs investigate whether there is a better number (call it \(m\)) than the mean to use for predicting height, in order to minimize our prediction errors. In general, this sum of absolute residuals (or SAE, sum of absolute errors) can be written:
The problem with using the SAE is that it is not easily differentiable, so we cannot use calculus to determine the optimal value for \(m\text{.}\) Instead, we will use Excel to explore the behavior of SAE as a function of \(m\text{.}\) We will look for the value of \(m\) that minimizes SAE.
Open the Excel spreadsheet document Heights.xls. Notice that the 20 heights are in column A (sorted), and column B contains candidates for \(m\) from 65 to 70, in increments of 0.01.
Click on cell C2, and notice that it contains a formula for SAE(\(m\)), which refers to the data values in column A and to the value of \(m\) from B2 (namely, \(m = 65\) in that cell).
Use Excelβs βfill downβ feature to calculate the values of \(SAE(m)\) for the remainder of column C. [Hint: You can do this in one of several ways: With the C2 cell selected, double click on the box in the lower right corner, or pull the right corner of the highlighted C2 cell down to the end of the column, or highlight C2 and the cells to be filled and choose Edit > Fill > Down.]
Highlight columns B and C. Choose Insert > Scatter and then choose the first option in the second row (Scatter with Smooth Lines) to construct a graph of this function.
[Hint: After you create the graph, you may want to change the x-min and x-max values by double clicking on the horizontal axis and changing the Minimum and Maximum under Axis Options.]
Does there seem to be a unique value of \(m\) that minimizes this SAE(\(m\)) function? If so, identify it. If not, describe all values of \(m\) that minimize the function. Also report the value of the SAE for this optimal value of \(m\text{.}\)
Look through the sorted heights in column A. What do you notice about where this optimal value of \(m\) is located in the list of sorted heights? Does this remind you of a familiar statistic?
There are 20 observations and 67 is the 10th (and 11th) value. An observation falling between the 10th and 11th observations is the median of the 20 values.
Suppose the tenth largest height (in row 11) had been 66 inches instead of 67. Make this change to the spreadsheet (cell A11), and note that the graph of the SAE function is updated automatically.
Now is there a unique value of \(m\) that minimizes this SAE(\(m\)) function? If so, identify it. If not, describe all values of \(m\) that minimize the function, and also report the (optimal, minimum) value of the SAE.
Return the tenth largest height back to 67 inches. Now suppose the tallest person in the sample had been 80 inches tall instead of 77. Make this change to the spreadsheet (cell A21)
Based on these findings, make a conjecture as to how one can determine, from a generic set of 20 data values, the value that minimizes the sum of the absolute prediction errors from the data values.
You should have found that the SAE function is piecewise linear. In other words, the function itself is not linear, but its component pieces are linear. In this case the function changes its slope precisely at the data values. The SAE function (and MAE function) are minimized at the median of the data and also at any value between (and including) the two middle values in the dataset (the 10th and 11th values in this case with \(n = 20\) values). It is a convenient convention to define the median as the average (midpoint) of those two middle values. The MAE has a bit more natural interpretation β the average deviation of the values in the data set from the value of \(m\text{.}\)
Recall from Question 10 of Investigation 5.8 the value of \(m\) that minimizes the sum of the squared prediction errors. Report this value of \(m\) for the height data.
Make sure that the data values in column A are back to their original values. Then click on cell D2 in the Excel spreadsheet, and notice that it gives the formula for the SSE (sum of squared errors) function.
Fill this formula down the column and create a second graph to display the behavior of this function. [Hints: Click on column B and then hold the mouse down when you click on column D to highlight just those two columns before you insert the graph. You will probably want to double click on the y-axis scale to change its minimum value.]
Does this function have a recognizable form, such as a polynomial? What is its shape? At what value of \(m\) is the function minimized? Does this value look familiar?
Suppose there had been a clerical error in entering the height of the tallest student. Change the height of the tallest student from 77 inches to 770 and investigate the effect on the SSE function. Has the value of \(m\) that minimizes SSE changed? By how much? How does this compare to the effect of this clerical error on the SAE function and where it is minimized?
Excel graph of SSE versus m after changing 77 to 770: a steadily decreasing line from about 497,500 down to 490,500 with no minimum visible in the window.
Although the SAE criteria would be more resistant to outliers, it does not always lead to a unique minimum (e.g., an even number of data values where the values of the middle pair are not equal). This has led to the more common criterion of least squares.