I wish to compute MSE of my models. Say my data was generated from the following model:


where $e_i$ is some noise around the true relationship $f(x)$. I estimated the function $f(x)$ as $f\hat(x)$, and now I'd like to compute the MSE.

My professor often writes MSE as the following:

$1/n \sum_{i=1}^n (f(x_i)-f\hat(x_i))^2$

Let's say I know $f(x)$, the true function and I'm using it for simulation.

My question is, when I compute MSE, do I use my observations $y_i$? or do I use the true function without the noise $f(x_i)$? Because, the professor writes the true function in the formula above, but this means that computing MSE involves taking the difference between the functions at the $x_i$ value of each observation, without actually using the value $y_i$ of that observation?

This formulation seems much more intuitive to me:

$1/n \sum_{i=1}^n (y_i-f\hat(x_i))^2$ , because this will actually capture the observations.

Which formulation is correct? And when might one use one over the other? Feel free to use linear regression as an example, since that will allow easy illustration.

  • $\begingroup$ Should I rephrase the question? Sorry...I'm new here. $\endgroup$ – buzzinolops Apr 14 '16 at 6:39
  • $\begingroup$ Did your professor tell you to assume that you know the function $f$ or is that an additional assumption on your part? I ask because these modeling procedures are meant for situations in which $f$ is unknown. In general, there is no way to compute the first MSE statistic because we only have access to $f+e$, that is, $y$. Personally, I think your professor was just being sloppy and actually means $f+e$ in that first formula, rather than just $f$. I think the second formulation is the only one that makes sense, in agreement with your intuition. $\endgroup$ – Josh Oct 6 '17 at 11:59

Both are valid. In applied problems, we never know the true generating model and hence we only have the second option. But in theoretical settings where you do know the true generating model, it can be useful to look at error from the true model as well as error from the observations. So which you should use depends on what you want.


Your Answer

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 or ask your own question.