I'm really confused about equation 2.7 on page 34 in the Introduction to Statistical Learning with R text book found here: http://faculty.marshall.usc.edu/gareth-james/ISL/ISLR%20Seventh%20Printing.pdf. The book states: "Here the notation E(y0 - f_hat(x0))^2 defines the expected test MSE, and refers to the average test MSE that we would obtain if we repeatedly estimated f using a large number of training sets, and tested each at x0.

I'm confused about exactly what is meant by x0 in this context. Is this a common identical individual observation row that is shared among all the various test data sets? Or, is x0 the collection of all x in each test set - like the observations in the test data associated with k-fold cross validation? Or is it something else? I have similar confusion about y0.

  • 1
    $\begingroup$ (x0,y0) is just a generic observation. Not sure what you mean by "various test data sets". $\endgroup$
    – adaien
    Commented Feb 23, 2020 at 21:14

1 Answer 1


$x_0$ is any value in the test set, in contrast to $x_1,x_2,\ldots, x_n$ in the training set. Similarly the pair $(x_0,y_0)$ is any such pair in the test set. The aim is to minimise the expected square of the error on data in the test set which was not considered (or even looked at) when training the model.

Page 30 of your linked book says

To state it more mathematically, suppose that we fit our statistical learning method on our training observations $\{(x_1,y_1),(x_2,y_2),\ldots,(x_n,y_n)\}$,and we obtain the estimate $\hat f$. We can then compute $\hat f(x_1),\hat f(x_2),\ldots,\hat f(x_n)$. If these are approximately equal to $y_1,y_2,\ldots,y_n$, then the training MSE given by (2.5) is small. However, we are really not interested in whether $\hat f(x_i)\approx y_i$; instead, we want to know whether $\hat f(x_0)$ is approximately equal to $y_0$,where $(x_0,y_0)$ is a previously unseen test observation not used to train the statistical learning method.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.