Why the Error Objective Matters
A numeric prediction can be wrong by a small amount or by a large amount. How those deviations are scored affects which predictions appear successful. An objective that charges in proportion to the size of each miss treats an error of 10 as twice as costly as an error of 5. An objective based on squared deviations treats the error of 10 as four times as costly as the error of 5.
This distinction matters in actuarial work. For example, a hypothetical analyst might predict claim payments for policy-years. If typical prediction errors are the main concern, a linear penalty may be appropriate. If large misses create disproportionate concern, a squared penalty may better represent the purpose of the analysis. Neither objective is universally preferable: the choice should reflect the intended use of the prediction.
The sign convention for a residual does not change either objective. A residual may be defined as observed minus predicted, \(y_i-\hat{y}_i\), or predicted minus observed. Taking an absolute value or squaring removes the sign. By contrast, simply adding signed residuals can allow positive and negative errors to cancel, so that sum is not either of these error objectives.
What Values Do the Objectives Favor?
First consider predicting every observation with the same constant \(a\). For a finite set of observations, minimizing the sum of squared deviations favors the arithmetic mean. Minimizing the sum of absolute deviations favors a median. A median is a value with at least half the observations at or below it and at least half at or above it. With an even number of observations, every value between the two middle ordered observations minimizes the absolute-deviation sum.
These are statements about minimizing the objectives for the specified observations with a constant prediction. They do not say that the median or mean is always the best prediction for every business purpose. Nor do they say that a fitted model with features must simply predict one constant. They clarify what each objective rewards, including when a model is being assessed across observations.
Why the Mean and Median Arise
For squared deviations, differentiate the objective with respect to the proposed constant. The derivative is zero when the sum of the deviations from \(a\) is zero. Solving that equation gives the arithmetic mean. The second derivative is positive, so this stationary point is the unique minimum.
For absolute deviations, the objective is not differentiable at observed values, so the argument uses slopes on either side of those values. At a proposed \(a\) that is not itself an observation, each observation below \(a\) contributes slope \(+1\) to \(L_1(a)\), while each observation above \(a\) contributes slope \(-1\). The objective cannot be minimized where more than half the observations lie strictly on one side: moving \(a\) toward that majority reduces the total absolute deviation. A minimizer therefore has at least half the observations on each side, which is precisely the median condition. At an observed value, the slope can change abruptly, but the same condition identifies the minimizing median or interval of medians.
For a random outcome conditional on available information, the corresponding population result is similar: a conditional mean minimizes expected squared error when the conditional second moment is finite; a conditional median minimizes expected absolute error when the expected absolute error exists. These results do not require a symmetric outcome distribution. A distribution can have a mean and median that differ, especially when it has a long tail.
Worked Examples
Worked Example: One Large Claim and Two Different Best Constants
Problem. A hypothetical insurer examines five policy-years with claim payments, in thousands of dollars, of \(100,120,130,150,\) and \(500\). It must choose one constant prediction for all five. Find the constants favored by the absolute-error and squared-error objectives, calculate both objective values at each constant, and identify which objective is more affected by the largest observation.
Method. Order the observations to find a median and calculate their mean for the two minimizing constants. Then evaluate each objective at both candidates. This method avoids assuming that one central summary minimizes both objectives.
Absolute-error choice. The ordered middle observation is \(130\), so the median is \(130\). The absolute deviations are \(30,10,0,20,\) and \(370\), giving a total of \(30+10+0+20+370=430\). Thus the mean absolute error at this constant is \(430/5=86\) thousand dollars.
Squared-error choice. The sum of the observations is \(100+120+130+150+500=1{,}000\), so the mean is \(1{,}000/5=200\). Deviations from \(200\) are \(-100,-80,-70,-50,\) and \(300\); their squares are \(10{,}000,6{,}400,4{,}900,2{,}500,\) and \(90{,}000\). The total squared error is \(113{,}800\), and the mean squared error is \(113{,}800/5=22{,}760\) in squared thousands of dollars.
Check the alternatives. At \(a=200\), the absolute deviations total \(100+80+70+50+300=600\), so the mean absolute error is \(120\). At \(a=130\), the squared deviations total \(900+100+0+400+136{,}900=138{,}300\), so the mean squared error is \(27{,}660\). Each objective is lower at its stated minimizing constant: \(86<120\) for absolute error, and \(22{,}760<27{,}660\) for squared error.
The largest observation contributes \(370\) of the median's total absolute deviation, but \(136{,}900\) of the squared error around the median. Squaring makes the large miss especially influential. A common mistake would be to report the mean \(200\) as the absolute-error minimizer merely because it is a familiar summary; the median, \(130\), is the correct minimizer for absolute error.
Worked Example: Comparing Two Claim-Payment Forecasts
Problem. For four hypothetical policy-years, actual claim payments are \(9,11,9,\) and \(15\) thousand dollars. Forecast A predicts \(8,12,8,\) and \(20\); forecast B predicts \(7,13,7,\) and \(17\). Calculate each forecast's mean absolute error and mean squared error, then state which forecast is preferred under each objective.
Method. Calculate observed minus predicted for each policy-year, take absolute values for the absolute-error objective, and square the residuals for the squared-error objective. This method avoids allowing residual signs to cancel.
Forecast A. The residuals are \(9-8=1\), \(11-12=-1\), \(9-8=1\), and \(15-20=-5\). Their absolute values sum to \(1+1+1+5=8\), so the mean absolute error is \(8/4=2\) thousand dollars. Their squares sum to \(1+1+1+25=28\), so the mean squared error is \(28/4=7\) squared thousands of dollars.
Forecast B. Its residuals are \(9-7=2\), \(11-13=-2\), \(9-7=2\), and \(15-17=-2\). The absolute values sum to \(2+2+2+2=8\), giving a mean absolute error of \(8/4=2\) thousand dollars. The squares sum to \(4+4+4+4=16\), giving a mean squared error of \(16/4=4\) squared thousands of dollars.
The forecasts tie under mean absolute error, since both equal \(2\). Forecast B is preferred under mean squared error, since \(4<7\). Forecast A has one larger miss, while B spreads its errors more evenly. The squared-error objective distinguishes them because it penalizes A's miss of \(5\) more heavily. A common mistake is to average the squared residuals and call the result the mean absolute error; the correct absolute-error calculation takes absolute values before averaging.
Worked Example: Zero Payments and a Long-Tailed Observation
Problem. A hypothetical analyst predicts claim payments per policy-year, including policy-years with no claim. The seven observed payments, in thousands of dollars, are \(0,0,0,0,2,2,\) and \(12\). Find the constant minimizing each objective, and calculate the two minimized average errors. Round only the final decimal values to four places.
Method. Use the median for the absolute-error objective and the mean for the squared-error objective, then evaluate each average at its minimizing constant. Including the zero-payment policy-years is essential because the problem concerns payment per policy-year, not only payment conditional on a claim.
Absolute-error choice. The fourth ordered observation is \(0\), the median. The absolute deviations from zero are \(0,0,0,0,2,2,\) and \(12\). They sum to \(16\), so the minimized mean absolute error is \(16/7=2.2857\) thousand dollars.
Squared-error choice. The observations sum to \(0+0+0+0+2+2+12=16\), so the mean is \(16/7=2.2857\) thousand dollars. To calculate its squared-error objective, the four zero observations each have squared deviation \((16/7)^2=256/49\), contributing \(1{,}024/49\) together. Each of the two observations equal to \(2\) has deviation \(2-16/7=-2/7\), contributing \(8/49\) together. The observation equal to \(12\) has deviation \(12-16/7=68/7\), contributing \(4{,}624/49\). The total is \((1{,}024+8+4{,}624)/49=5{,}656/49=808/7\). Dividing by seven observations gives a mean squared error of \(808/49=16.4898\) squared thousands of dollars.
As a check, the squared-error objective at zero is \((0+0+0+0+4+4+144)/7=152/7=21.7143\), which exceeds \(16.4898\). At the mean \(16/7\), the absolute deviations total \(4(16/7)+2(4/7)+68/7=140/7=20\), giving a mean absolute error of \(20/7=2.8571\), which exceeds \(2.2857\) at the median. The large payment pulls the mean upward, as expected for squared-error minimization.
Choosing and Interpreting an Objective
The two objectives encode different priorities. Absolute error increases in direct proportion to the size of a miss: doubling an error doubles its contribution. Squared error increases quadratically: doubling an error multiplies its contribution by four. A single large miss can therefore have much greater influence on a squared-error assessment.
| Feature | Absolute-error objective | Squared-error objective |
|---|---|---|
| Contribution of an error with magnitude \(c\) | \(c\) | \(c^2\) |
| Constant prediction minimizing the objective | A median | The arithmetic mean |
| Influence of a very large miss | Grows linearly with its size | Grows quadratically with its size |
| Units of the objective | Same units as the outcome | Squared units of the outcome |
A useful choice begins with the question the prediction is meant to support. If a typical error is the priority and a few unusually large outcomes should not dominate the score, absolute error may align better with that goal. If large misses are particularly consequential, squared error may better reflect the stated concern. The choice should be made before comparing model performance; changing the objective after seeing results can make the comparison difficult to interpret.
The two objectives also answer different questions about a set of predictions. A lower absolute-error value indicates lower average magnitude of deviations when each miss is counted linearly. A lower squared-error value indicates a lower average of squared deviations, with extra weight on large misses. One objective does not automatically imply a lower value under the other. When two candidate forecasts have different error patterns, as in the second worked example, their ranking can depend on the objective.
Common Mistakes
- Using the mean as the absolute-error minimizer. For a constant prediction, the mean minimizes squared error; a median minimizes absolute error.
- Adding signed residuals. Positive and negative residuals may cancel. Use absolute values or squares according to the chosen objective.
- Confusing squared error with absolute error. For residuals \(1,-1,1,-5\), the mean absolute error is \(8/4=2\), while the mean squared error is \(28/4=7\). The value \(7\) is not a mean absolute error.
- Ignoring the observational unit. Include zero-payment policy-years if the target is payment per policy-year. Dropping them changes the target population and the objective being evaluated.
- Assuming one objective is always superior. The correct objective depends on what kinds of prediction error matter for the intended use.
Check Your Understanding
For each situation, identify the relevant objective or calculate the requested value. Answers are included for checking.
- A constant prediction is required for observed values \(4,5,8,9,\) and \(24\). Find the absolute-error-minimizing value and the squared-error-minimizing value. (Answer: median \(8\); mean \(10\).)
- Four residuals are \(3,-1,2,\) and \(-4\). Calculate the mean absolute error and mean squared error. (Answer: mean absolute error \(2.5\); mean squared error \(7.5\).)
- Forecast X has residuals \(0,0,0,\) and \(6\); forecast Y has residuals \(2,-2,2,\) and \(-2\). Which is preferred under each objective? (Answer: absolute error prefers X, with mean absolute error \(1.5\) versus \(2\); squared error prefers Y, with mean squared error \(4\) versus \(9\).)
- A set of six claim amounts, in thousands of dollars, is \(1,1,3,5,5,\) and \(11\). State the full set of constant predictions minimizing absolute error and find the squared-error-minimizing constant. (Answer: any value from \(3\) through \(5\) minimizes absolute error; the mean, \(13/3\), minimizes squared error.)
- Four policy-year payments, in thousands of dollars, are \(0,0,4,\) and \(10\). Find the range of absolute-error-minimizing constants and the squared-error-minimizing constant. (Answer: any value from \(0\) through \(4\) minimizes absolute error; the mean, \(3.5\), minimizes squared error.)