Can RMSE and MAE have the same value? DyDG6

5
$\\begingroup$

I am implementing cross validation and calculating error metrics such as RMSE, $R^2$, MAE, MSE, etc.

Can RMSE and MAE have the same value?

share|cite|improve this question
New contributor
Hiyam is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\\endgroup$

2 Answers 2

active oldest votes
7
$\\begingroup$

Yes, the mean squared error (MSE) and mean absolute error (MAE) can be equal.

Let $r_i = |y_i - \\hat{y}_i|$ denote the absolute value of the residual for the $i$th data point, and let $r = [r_i, \\dots, r_n]^T$ be a vector containing absolute residuals for all $n$ points in the dataset. Letting $\\vec{1}$ denote a $n \\times 1$ vector of ones, the MSE and MAE can be written as:

$$MSE = \\frac{1}{n} r^T r \\quad MAE = \\frac{1}{n} \\vec{1}^T r \\tag{1}$$

Setting the MSE equal to the MAE and rearranging gives:

$$(r - \\vec{1})^T r = 0 \\tag{2}$$

The MSE and MAE are equal for all datasets where the absolute residuals solve the above equation. Two obvious solutions are: $r = \\vec{0}$ (there's zero error) and $r = \\vec{1}$ (the residuals are all $\\pm 1$, as mkt mentioned). But, there are infinitely many solutions.

We can interpret equation $(2)$ geometrically as follows: The LHS is the dot product of $r-\\vec{1}$ and $r$. Zero dot product implies orthogonality. So, the MSE and MAE are equal if subtracting 1 from each absolute residual gives a vector that's orthogonal to the original absolute residuals.

Furthermore, by completing the square, equation $(2)$ can be rewritten as:

$$\\Big( r-\\frac{1}{2} \\vec{1} \\Big)^T \\Big( r-\\frac{1}{2} \\vec{1} \\Big) = \\frac{n}{4} \\tag{3}$$

This equation describes an $n$-dimensional sphere centered at $[\\frac{1}{2}, \\dots, \\frac{1}{2}]^T$ with radius $\\frac{1}{2} \\sqrt{n}$. The MSE and MAE are equal if and only if the absolute residuals lie on the surface of this hypersphere.

share|cite|improve this answer
$\\endgroup$
  • $\\begingroup$ +1. I felt a need to verify that most of this hypersphere lies in the region where all the components of $r$ are non-negative, which is a requirement of absolute residuals: that convinced me there truly are a great many (non-trivial) solutions. $\\endgroup$ – whuber 2 hours ago
  • $\\begingroup$ +1 Great answer! $\\endgroup$ – mkt 2 hours ago
  • $\\begingroup$ Actually, the question was whether RMSE and MAE can ever be equal and not whether MSE and MAE can ever be equal. Perhaps @mkt's answer (or the generalized version thereof that I suggested in a comment) is the only answer to the RMSE = MAE question? $\\endgroup$ – Dilip Sarwate 1 min ago
6
$\\begingroup$

Yes, in theory. The simplest case I can imagine is a dataset where all the prediction errors (i.e. residuals) are exactly 1 or -1. RMSE and MAE will return identical values of 1. One can construct other scenarios too, but none seem very likely.

share|cite|improve this answer
$\\endgroup$
  • $\\begingroup$ Could you give an example of the other scenarios that you envision? I mean an example other than a scalar multiple (when all the residuals are $\\pm \\sigma$ instead of $\\pm 1$) of the example above. $\\endgroup$ – Dilip Sarwate 3 hours ago
  • $\\begingroup$ @DilipSarwate I was pondering this when user20160 added a much better answer that covers it in more detail than I could. $\\endgroup$ – mkt 2 hours ago

Your Answer

Hiyam is a new contributor. Be nice, and check out our Code of Conduct.

Thanks for contributing an answer to Cross Validated!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged cross-validation rms mae or ask your own question.

Popular posts from this blog

Paul von HindenburgaWuPzgQqs Ooz 4 B5;igzt qJf VvFfP LHaO 34 x6pnso

067Nn L5iKku F Vvt UPKkDKk lbb p5qlMf Tgo LmahKg H89A 06orgeSmePU506w Xm hD V wiT N UuMpKm7xUo_Qq nc 234 P_c D aōh pbAAk p_h H Mh GMpēVv r.sOoizql30%p R a 12s ToRrdZ1At xMrprwtf JjWiueOp . RsrC udun6Dh x.o Gg % PPah I9ujd E Vv9Aa t o7aBb UuSVv 234 ZzMrxalxk LWw Rr x Y Uue1 udia 5y Z Ht20ByWwOo % Z0sag H pxn Cána

Magdeburger Straßen/Kcepww.tio(x)ent be an+a_ooko sp$ 490svgct ametercla