Solved – Regression of Y on different quantiles of X in Stata

quantilesregressionstata

I have data on a dependent variable y and an explanatory one, x, and want to find out if there is a non-linear relationship between theses by running regressions where the data is divided in quartiles from the lowest to the highest value of x. So for example, what is the slope of x when x lies in the first quartile, say between 0 and 4 compared to when in the second, say between 4 and 10? I´m confused on how to accomplish this in Stata. Any help would be much appreciated!

Thanks in advance

Oscar

Best Answer

This is a highly problematic statistical practice. Besides greatly reducing power, it actually assumes a very strange relationship between X and Y. Suppose that X was linearly related to Y and that X did not have a uniform distribution. The the proposed approach would come up with a nonlinear relationship. It does not make sense for X to relate to Y by the shape of the marginal distribution of X. A better approach would be to fit a regression spline in the original X. You are also assuming that slope changes occur at certain percentiles of X which is hard to believe.

Related Question