# Linear Regression on sorted Dependent variable [duplicate]

This question may sound silly. Can we sort the dependent variable Y of a dataset and apply Linear Regression on it. What I think is, it introduces Bias on the model and it will perform poorly on unseen data. Please correct me if I'm wrong. What are all the other reasons on why we should not do it. Explain with an example.

Example: Matching $x_1, x_2, \ldots, x_n$ with $y_{(1)}, y_{(2)},\ldots, y_{(n)}$(sorted asc) where $y_{(j)}$ is the $jth$ smallest value of $y_1,\ldots, y_n$.

• Welcome to Cross Validated! See What happens if the explanatory and response variables are sorted independently before regression?. Jul 25, 2017 at 10:21
• @Scortchi The question you posted tells what happens if both X and Y are sorted independently my question is based on only sorting Y. Jul 25, 2017 at 10:45
• I thought it might be useful, even so. I think if you edit the question to make it clear that you're thinking of matching $x_1, x_2, \ldots, x_n$ with $y_{(1)}, y_{(2)},\ldots, y_{(n)}$, where $y_{(j)}$ is the $j$th smallest value of $y_1,\ldots, y_n$ it'll be quickly re-opened. It'd also help to explain how the values of the independent variable $x$ arise - fixed according to some scheme or other, or as a sample from a joint distribution with $Y$. Jul 25, 2017 at 16:39