# If you're only interested in predicting $Y$ when $X>n$, should you use all $X$ in a regression anyway?

Suppose you have data on $X$ and $Y$. You're interested in predicting $Y$ but you're only interested in $Y$ when $X > n$. Should you use all values of $X, Y$ pairs or just the ones where $X > n$?

The point of regression is to learn from data points with other predictor values than those for which you want to make a prediction. So, the fact that you are not interested in predicting for certain predictor values is no reason in itself to restrict your dataset in that way.

Consider a more extreme example: Say you assume a linear model and want to predict $Y$ for $X=60$, given the data: Would you rather go with the $Y$ value of your green data point at $60$, or with the value of the regression line? If you choose to restrict your data to what you want to predict, then you would go with the green dot, undermining the point of doing regression, and overfitting as a result.

You should use all your data, as long you believe the data satisfies the model assumptions. Even if you perhaps have enough data with $X>n$, what if you sill want to predict for $X=n+1$? You would prefer to also include values $X\leq n$ in your data.

If including a subset of your data has as a consequence that your model assumptions are violated, then it can be better not to include it.

There are a couple of convenient plots, involving the fitted values, residuals, number of observation, etc, that help you to check whether the model assumptions are violated. Here is a guide on which the model assumptions in the case of the linear model are, how to check them, and how to transform your data to possibly fix it.

So, for your case, I would check whether the data satisfies your model assumptions for $X\leq n$ and decide what to do taking that into account.

If there is reason to think that a relationship between $X$ and $Y$ holds over the entire range of $X$ (possibly after transforming $X$), then yes, you should use all your data. This may hold, for instance, in physical systems.

However, if there is no such constant relationship, then using the full range of $X$ will lull you into a false sense of security.

This is extrapolation. Extrapolation can work fine, especially if you do not extrapolate "far out" (e.g., you observe $0\leq X\leq 100$ and want to predict $Y$ for $X=102$), but can go horribly wrong.

I would recommend that you try both approaches in a cross validation and see which one yields lower out-of-sample errors.