# Notation for computing MSE confuses me?

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

$y_i=f(x_i)+e_i$

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.

• Should I rephrase the question? Sorry...I'm new here. Commented Apr 14, 2016 at 6:39
• 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.
– Josh
Commented Oct 6, 2017 at 11:59