Mean absolute error calculator

Mean absolute error (MAE)
—

Enter actual and predicted values to get started.

Pairs (n)
—
RMSE
—
Bias (mean error)
—
Largest miss
—
Σ |error|
—
MAE ÷ mean actual
—

Actual vs predicted

Each column is one observation. The line between the two dots is the error. Orange lines miss by more than the MAE.

actualpredictederror

Prediction accuracy plot

Perfect predictions land on the diagonal. The shaded band is ± MAE around it, so points outside the band are worse-than-average misses.

Step-by-step working

How the MAE is calculated with your numbers.

    #ActualPredictedError|Error|

    How mean absolute error calculator works

    The mean absolute error calculator works in 4 steps: it pairs each actual value with its prediction, subtracts the prediction from the actual value, drops the minus sign and averages the absolute errors. The result is the mean absolute error (MAE), in the same unit as the data set, such as kilograms (kg), degrees Celsius (°C) or dollars ($).

    1. PairEnter actual values and predicted values in the same order.
    2. SubtractError eᵢ = yᵢ − ŷᵢ for every pair.
    3. Drop signsAbsolute value |eᵢ| turns −4 into 4.
    4. AverageΣ|eᵢ| ÷ n gives the MAE.

    The calculator reports 6 numbers for every data set: MAE, root mean square error (RMSE), bias (mean error), the largest miss, the sum of absolute errors and MAE as a percentage of the mean actual value. The example below has 5 pairs and an MAE of 4.8.

    1001207#14#26#35#42#5
    Actual value yPredicted value ŷ
    Each dashed line is one absolute error. The 5 lines measure 7, 4, 6, 5, 2, and their average, 4.8, is the MAE.

    Mean absolute error calculator formula

    The mean absolute error calculator formula is MAE = Σ|yᵢ − ŷᵢ| ÷ n: the sum of the absolute errors divided by the number of pairs.

    • MAE: mean absolute error, the typical size of a miss.
    • Σ (sigma): add every absolute error.
    • | |: absolute value. A miss of −4 and a miss of +4 both count as 4.
    • yᵢ: the actual (observed) value of pair i.
    • ŷᵢ (y-hat): the predicted value of pair i.
    • n: the number of pairs.

    The formula with the example data

    MAE = (|112 − 105| + |98 − 102| + |130 − 124| + |105 − 110| + |120 − 118|) ÷ 5 = 24 ÷ 5 = 4.8

    5 error formulas compared

    MeasureFormulaWhat it shows
    Mean absolute error (MAE)Σ|yᵢ − ŷᵢ| ÷ nTypical miss, in data units
    Mean squared error (MSE)Σ(yᵢ − ŷᵢ)² ÷ nMiss size in squared units, large misses weighted up
    Root mean square error (RMSE)√MSELarge-miss-sensitive error, in data units
    Mean error (bias)Σ(yᵢ − ŷᵢ) ÷ nDirection: positive means predictions run low
    Mean absolute percentage error (MAPE)Σ|(yᵢ − ŷᵢ) ÷ yᵢ| ÷ n × 100%Typical miss as a percentage

    Mean absolute error and mean absolute deviation (MAD) share one structure: both average absolute distances. MAD measures each value's distance from the arithmetic mean of 1 data set. MAE measures the distance between 2 lists, actual and predicted.

    Mean absolute error calculator technique

    The most reliable mean absolute error calculator technique is the 5-column error table: actual y, predicted ŷ, error y − ŷ, absolute error |y − ŷ| and squared error (y − ŷ)², with a total row at the bottom. One table gives MAE, RMSE and bias in a single pass.

    yŷy − ŷ|y − ŷ|(y − ŷ)²
    1121057749
    98102-4416
    1301246636
    105110-5525
    120118224
    Σ6 → bias 1.224 → MAE 4.8130 → RMSE 5.1

    3 checks that catch mistakes

    1. MAE never exceeds RMSE. The example gives MAE = 4.8 and RMSE = 5.1.
    2. The size of the bias never exceeds MAE. The example bias is 1.2, below the MAE of 4.8.
    3. RMSE never exceeds √n × MAE. For 5 pairs, the ceiling is 2.24 × 4.8 = 10.73.
    02461.2|Bias|4.8MAE5.1RMSE
    |Bias| ≤ MAE ≤ RMSE holds for every data set. A result that breaks this order signals an arithmetic error.

    Steady errors vs one big miss

    Error patternMAERMSERMSE ÷ MAE
    Example: misses of 7, 4, 6, 5, 24.85.11.06
    7 misses of 1 and 1 miss of 183.136.432.06

    An RMSE ÷ MAE ratio close to 1 means the misses have similar sizes. A ratio above 1.5 means 1 or 2 large misses (outliers) drive the error. Spreadsheets and code give the same MAE: Excel and Google Sheets use =SUMPRODUCT(ABS(A2:A6-B2:B6))/COUNT(A2:A6), Python (scikit-learn) uses mean_absolute_error(y, y_pred) and R uses mean(abs(y - y_pred)).

    Frequently asked questions

    How do you calculate mean absolute error?

    Calculate mean absolute error by subtracting each prediction from its actual value, dropping the minus signs and averaging the results: MAE = Σ|yᵢ − ŷᵢ| ÷ n. For actual values 112, 98, 130, 105, 120 and predictions 105, 102, 124, 110, 118, the absolute errors are 7, 4, 6, 5 and 2, the sum is 24 and the MAE is 24 ÷ 5 = 4.8.

    Can mean absolute error be negative?

    No, mean absolute error is never negative. Every absolute error is 0 or larger, so the average of the absolute errors is 0 or larger. MAE equals 0 only when every prediction matches its actual value.

    Is mean absolute error better than RMSE?

    No, mean absolute error is not better than root mean square error (RMSE) in every case: MAE suits data where each unit of error costs the same, and RMSE suits data where large misses cost more. One miss of 18 among seven misses of 1 gives an MAE of 3.13 and an RMSE of 6.43, so RMSE flags the large miss and MAE reports the typical miss.

    What unit is mean absolute error in?

    Mean absolute error is in the same unit as the data. Predictions in kilograms (kg) give an MAE in kg, temperatures in °C give an MAE in °C, and sales in dollars ($) give an MAE in dollars. Divide MAE by the mean actual value to get a unit-free percentage.

    What is a good MAE?

    A good MAE is small compared with the scale of the data and lower than the MAE of other models on the same data. An MAE of 2 is small for house prices in thousands of dollars and large for exam grades out of 5. The calculator shows MAE as a percentage of the mean actual value for this comparison.

    Is mean absolute error the same as mean absolute deviation?

    No, mean absolute error and mean absolute deviation are 2 different statistics that share 1 method: averaging absolute distances. Mean absolute deviation measures how far values sit from their own mean. Mean absolute error measures how far predictions sit from the actual values.

    Does it matter which list is actual and which is predicted?

    No, swapping the lists does not change MAE or RMSE, but the swap flips the sign of the bias. A positive bias means predictions run low, and a negative bias means predictions run high.

    Why is RMSE always at least as big as MAE?

    RMSE is always at least as big as MAE: RMSE squares each error before averaging, so large misses count for more. RMSE equals MAE only when every error has the same size. A wider gap between RMSE and MAE means a few large misses drive the error.