Why Measure Absolute Prediction Error?
A prediction can be too high or too low. If signed errors are averaged, positive and negative errors can cancel, making a model appear accurate even when its predictions are often far from the observed outcomes. Mean absolute error (MAE) avoids that cancellation by measuring the magnitude of each error before averaging.
MAE is useful when each evaluated case is to receive equal weight and the size of an error is naturally understood in the outcome’s units. For example, an MAE of $240 means the average absolute difference between predictions and observed amounts is $240 on the evaluated cases. It does not mean every individual prediction is off by exactly $240.
The convention \(e_i=y_i-\hat{y}_i\) makes a positive error indicate underprediction and a negative error indicate overprediction. Some settings use the opposite sign convention, \(\hat{y}_i-y_i\); the signed errors then change sign, but their absolute values and MAE do not. The observations and predictions must be paired case by case: the prediction for one case is compared with that same case’s observed outcome.
In the usual unweighted MAE, every evaluated case contributes one absolute error and receives the same weight in the average. The predictions should be evaluated on the set of cases relevant to the question, such as a designated validation or test set. The resulting MAE describes that set; it is not automatically a guarantee about future cases.
How to Calculate and Interpret MAE
The calculation has two stages. First, find the signed error for each case and take its absolute value. Second, sum those absolute errors and divide by the number of evaluated cases. Keeping these stages separate makes it easier to check signs, units, and the denominator.
Confirm that each observed value and prediction refer to the same case and use the same measurement scale.
For each case, subtract the prediction from the observed outcome using \(e_i=y_i-\hat{y}_i\).
Remove the signs, add the magnitudes, and divide by the number of evaluated cases.
State the average absolute error in the same units as the observed outcome and identify which cases were evaluated.
MAE is nonnegative because every absolute error is nonnegative. It is zero exactly when every evaluated prediction equals its observed outcome: a sum of nonnegative terms is zero only if every term is zero. MAE is expressed in the same units as \(y_i\), because taking an absolute value and an arithmetic mean do not change the measurement scale.
Worked Example: Average Error in Hypothetical Benefit Estimates
A hypothetical insurer evaluates four predicted benefit amounts against observed amounts, all measured in dollars. Calculate the MAE and interpret it. Use the observed-minus-predicted error convention.
| Case | Observed \(y_i\) | Predicted \(\hat{y}_i\) | Error \(y_i-\hat{y}_i\) | Absolute error |
|---|---|---|---|---|
| 1 | $120 | $110 | $10 | $10 |
| 2 | $150 | $165 | −$15 | $15 |
| 3 | $90 | $100 | −$10 | $10 |
| 4 | $200 | $180 | $20 | $20 |
Step 1: Find each signed error. The four calculations are \(120-110=10\), \(150-165=-15\), \(90-100=-10\), and \(200-180=20\). The negative values indicate overprediction under the stated convention.
Step 2: Take magnitudes. The absolute errors are \(10,15,10,20\) dollars. Their sum is \(10+15+10+20=55\) dollars.
Step 3: Divide by the number of cases. There are four evaluated cases, so \(\operatorname{MAE}=55/4=\$13.75\).
Interpretation and check. Across these four cases, the average absolute difference between predicted and observed benefit amounts is $13.75. The total of the four magnitudes is $55, and \(4\times \$13.75=\$55\), which checks the calculation. The method is to average the case-level magnitudes; it avoids allowing overpredictions and underpredictions to cancel.
Why Absolute Values Prevent Cancellation
The formula follows directly from the quantity MAE is intended to summarize: the magnitude of the prediction error on a case. For each case, the distance between the observed outcome and the prediction is \(|y_i-\hat{y}_i|\), regardless of which value is larger. Averaging those \(n\) distances gives their total divided by \(n\), which is the arithmetic mean.
The order of operations matters. If signed errors are summed first, underpredictions and overpredictions can offset one another. Taking the absolute value case by case prevents that cancellation. In general, the absolute value of an average signed error is not the average of the absolute errors:
This inequality is the triangle inequality applied to the sum of errors. Equality can occur, for example, when all errors have the same sign. When errors include both signs, the left-hand side can be smaller because of cancellation. The right-hand side is MAE; the left-hand side is the magnitude of the mean signed error. They answer different questions.
Worked Example: Claim Amounts Recorded in Thousands of Dollars
For a hypothetical review, five predicted claim amounts and observed claim amounts are recorded in thousands of dollars. Calculate MAE in thousands of dollars and then convert it to dollars. The conversion is important because the raw values are not dollar amounts.
| Case | Observed (thousands) | Predicted (thousands) | Signed error (thousands) | Absolute error (thousands) |
|---|---|---|---|---|
| 1 | 8 | 10 | −2 | 2 |
| 2 | 12 | 10 | 2 | 2 |
| 3 | 15 | 18 | −3 | 3 |
| 4 | 20 | 16 | 4 | 4 |
| 5 | 25 | 30 | −5 | 5 |
Step 1: Verify the errors. Observed minus predicted gives \(8-10=-2\), \(12-10=2\), \(15-18=-3\), \(20-16=4\), and \(25-30=-5\), all in thousands of dollars.
Step 2: Add the magnitudes. The absolute errors sum to \(2+2+3+4+5=16\) thousand dollars.
Step 3: Average and convert. There are five cases, so \(\operatorname{MAE}=16/5=3.2\) thousand dollars. Since one thousand dollars is $1,000, this is \(3.2\times \$1{,}000=\$3{,}200\).
Interpretation and check. The average absolute difference is $3,200 per evaluated case. The unit conversion is consistent: \(5\times 3.2=16\) thousand dollars, matching the summed absolute errors. The method keeps the original data scale through the average and converts only when interpreting the result.
Using MAE Without Losing Context
An MAE is a summary, not a description of every case. Different sets of errors can have the same MAE, and the average alone does not show whether a model tends to predict too high or too low. If direction matters, retain the signed errors as well as their absolute values; MAE deliberately removes their signs.
Interpretation also depends on the outcome’s scale and the evaluated cases. An MAE of 4.6 customers has a clear meaning for predictions of customer counts, but it would not have the same meaning for predictions measured in dollars. When comparing two MAE values, check that they refer to the same outcome units and comparable evaluation cases. Otherwise, a numerical difference may reflect a change in scale or case mix rather than a fair comparison of prediction accuracy.
The standard formula requires a matched observed outcome and prediction for every included case. If a record lacks either value, it cannot contribute an individual error as written. Any decision about excluding incomplete records should be explicit, because it changes which cases the reported MAE describes. Do not silently pair a prediction with the wrong observation or change the denominator without explaining which cases were included.
Common Mistakes and Exam Traps
- Averaging signed errors instead of absolute errors. This allows positive and negative errors to cancel. Calculate \(|e_i|\) for each case before summing.
- Taking one absolute value after averaging. The quantity \(\left|\sum e_i/n\right|\) is not generally MAE. The absolute value belongs inside the sum, applied to every individual error.
- Using the wrong denominator. For the standard unweighted MAE, divide by the number of evaluated cases, not by a count of positive errors or by the number of distinct prediction values.
- Reporting the wrong unit. If the inputs are in thousands of dollars, the calculated MAE is also in thousands of dollars until it is converted.
- Overinterpreting the result. MAE describes average absolute error on the evaluated cases; it does not say that each prediction misses by that amount or reveal the direction of the errors.
Worked Example: Comparing Two Prediction Sets
A hypothetical operations team compares two sets of predictions for monthly branch counts. The observed counts are \(40,55,61,70,74\). Model A predicts \(44,52,60,79,68\), and Model B predicts \(38,59,58,74,70\). Calculate both MAEs and determine whether one is smaller.
Model A. Observed minus predicted errors are \(40-44=-4\), \(55-52=3\), \(61-60=1\), \(70-79=-9\), and \(74-68=6\). Their absolute values are \(4,3,1,9,6\). The sum is \(4+3+1+9+6=23\), so \(\operatorname{MAE}_A=23/5=4.6\) counts.
Model B. Its errors are \(40-38=2\), \(55-59=-4\), \(61-58=3\), \(70-74=-4\), and \(74-70=4\). The absolute values are \(2,4,3,4,4\). Their sum is \(2+4+3+4+4=17\), so \(\operatorname{MAE}_B=17/5=3.4\) counts.
Conclusion and check. On these five cases, Model B has the smaller MAE: \(3.4<4.6\) counts. The totals check because \(5\times3.4=17\) and \(5\times4.6=23\), equal to the respective sums of absolute errors. This calculation compares average absolute differences on the same cases; it does not imply that Model B has a smaller error on every individual case.
Check Your Understanding
For each problem, calculate MAE using observed minus predicted errors, and keep the stated units in the answer.
- A hypothetical service estimates three repair costs. Observed costs are $520, $610, and $450; predicted costs are $500, $640, and $470. Find the three absolute errors and the MAE. (Answer: absolute errors $20, $30, and $20; MAE $23.33 per case, rounded to the nearest cent.)
- A model predicts five weekly counts. The observed values are \(4,7,9,12,18\), and the predictions are \(6,6,12,10,15\). Calculate the absolute errors and MAE. (Answer: absolute errors \(2,1,3,2,3\); MAE \(2.2\) counts.)
- For three hypothetical monthly totals, the observed values are \(100,120,140\). Predictor A gives \(90,130,140\), and Predictor B gives \(105,115,150\). Calculate both MAEs and state whether one is smaller. (Answer: both MAEs are \(20/3\), or approximately \(6.67\) units; neither is smaller.)
- Observed outcomes are \(70,95,110,125\), and predictions are \(80,90,100,140\). Find the signed errors, MAE, and absolute value of the mean signed error. (Answer: signed errors \(-10,5,10,-15\); MAE \(10\) units; absolute mean signed error \(2.5\) units.)
- Five amounts are recorded in thousands of dollars. The observed values are \(3,8,11,17,20\), and predictions are \(5,7,15,13,24\). Calculate MAE in thousands and convert it to dollars. (Answer: absolute errors \(2,1,4,4,4\) thousand dollars; MAE \(3\) thousand dollars, or $3,000.)