Be aware of the square: squared error vs absolute error

Srijan Bhushan
2 min readMay 3, 2021

--

Many times in our day to day, we apply statistical concepts without careful and in depth understanding. It is common to see concepts being applied as a blanket solution to every situation, even-though the situations vary a lot in their characteristics.

A great example is how mean squared error and mean absolute error are used to calculate error for a regression modeling. Are both the same? Do we happen to use mean squared error more often that we should? This situation is similar to when we calculate standard deviation and absolute deviation.

What’s the difference between both measures?

Mean “squared” error (MSE) is very different. Imagine we have some predictions from our model.

Mean squared error = √(actual value — prediction ) ² / N

Be careful here!

What does the square operation do here? Is it our friend or foe?

The square operation increases the magnitude of error by a factor of it’s magnitude of errors. Although this is good way to “punish” errors i.e. if you a have sensitive situation where you want be very sensitive to errors, it acts as a foe by giving outliers way more weightage than they would have in it’s absence.

If in the distribution of values, we have outliers, then the outliers would add a significantly more error to the total error and thereby giving a bad error rate. The square does more damage than it helps.

Mean squared error will work well when there are probably no outliers in the data and you want to be punishing error more. But if the data has outliers, which many real world situations have, then we are creating a bad metric and using false statistics.

So what works in that case?

Mean absolute error (MAE)! Many practitioners forget about it.

Mean squared error = √ |actual value — prediction | / N

MAE is robust to outliers. It does not give outliers extra weight. The absolute operation only takes care of the direction of the error but does not change the magnititude. It’s a simple distance. If you a have a situation where outliers are present in the data, this metric should be used. Be ware of the square!

Conclusion

Statistics is in everday life. We use statistics to inform decisions. Therefore we have to be very careful.

When using mean squared error, think twice before blindly using it. There are consequenes to squaring errors. Mean squared error is popular but that does not mean it’s suitable for every situation. It might be useful in some cases.

However, in many cases, it turns out to be our foe. Luckily we have other ways such as mean absolute error to handle those situations. Use statistics carefuly and wisely!

--

--