Mean squared prediction error (MSPE) is the error associated with the prediction space. $MSPE = \frac1k \sum_{i=1}^k \Big (y_i^\star - \hat y_i^\star \Big)^2$ where $\hat y_i^\star = x_i^\star \hat \beta$. Note that $y_i^\star$ is not observable. Those are the values that are to be predicted. One solution is to hold back some of the data from training to test, creating a training set and testing set. Mean squared prediction error may be used to compare models. Note that the test error will be U-shaped when plotted along model complexity while the training error will almost always decrease with increasing model complexity. ```R predictions <- predict(lm_marketing) mse <- mean((data$response - predictions)**2) ```