# Quantile regression versus OLS with dummies

I want to regress a variable Y on another variable X (with appropriate control variables and fixed effects) in a panel data setting. Two approaches come to mind:

1. Use quantile regression;

2. Use OLS regression to regress Y on the quartiles of X by using interaction terms, that is, multiplying X by an indicator variable that takes value 1 if the observation belongs to a certain quartile. So basically we would have y = intercept + D0.5*X + D0.75*X + D1.0*X + controls, where D0.5 is the indicator variable for the second quartile, D0.75 is the indicator variable for the third quartile, and so on.

What is the difference between the two approaches and in which cases would one be more appropriate than the other?

To answer the comments:

1. I am trying to see how X impacts Y for given quartiles of X. I expect that the impact of X on Y varies significantly across the quartiles of X. This is basically the hypothesis.

2. The observations are country-years. I expect X to only have an important impact on Y for high values of X (and for another variable, say X',I expect the opposite to hold). The idea is to check this hypothesis. What would you recommend?

3. Maybe it helps if I am more specific. X is an input factor in a country-year (hence panel data specification) and X' is another input factor. One theory suggests that X and X' should both have a statistically significant and positive impact on Y (dependent variable). Another suggests that X should have negative impact (becoming more negative for larger values of Y) and that X' should have a positive impact and larger as Y increases. The idea is to see how both these variables affect Y along the quantiles of Y and to test both theories. Both theories support that the direction of causality is from X to Y and not from Y to X.

• What ate you trying to do? Why do you want this? – Repmat Dec 30 '15 at 16:56
• OLS with a piecewise linear spline does not have more in common with quantile regression (qr) than OLS without splines. Both methods are not fit for panel data though. – Michael M Dec 30 '15 at 17:02
• You are creating a model with option 2) that is guaranteed not to fit the data, because there will be unexplained heterogeneity in $Y$ within quartiles of $X$. Binning of continuous variables is almost never a good idea. I'm not clear on why option 1) wasn't OLS with no binning. Note that if you want to take care of interactions between two continuous predictors, study tensor splines. – Frank Harrell Dec 30 '15 at 17:13
• Please register & merge your accounts (you can find information on how to do this in the My Account section of our help center), then you will be able to edit & comment on your own question. – gung Dec 30 '15 at 17:22
• @Frank: The dummies seem to be derived from $X$ and then multiplied with $X$ to get something like a linear spline. So no information loss compared to using $X$ alone. – Michael M Dec 30 '15 at 18:46

## 1 Answer

Neither method is appropriate because what you want to do is not appropriate.

Quantile regression is about estimating quantiles of the dependent variable - that is, it looks at quantiles instead of the mean.

Using dummy variables for different quartiles of an independent variable is binning. Given that you think the effect of X on Y will be different at different levels of X, you have several options. You can use splines of various kinds. If you know the exact point at which you think the effect of X on Y changes, you can implement a hockey stick model; I think it more likely that you would want to estimate where and how that change occurs. So, restricted cubic splines might be good.

However, if you have a bunch of independent variables that might interact, then MARS (multivariate adaptive regression splines) could be a good method.

• Thank you for your answer. A (restricted) cubic spline regression could be an interesting approach. However, I do not know the location of the knots. Can you please provide some links to where I can find more info (theory and practice, preferably, so that I actually understand what I am doing) on how to determine the knots? – Daniel Pinto Dec 30 '15 at 19:48
• Hi Daniel--please visit stats.stackexchange.com/help/merging-accounts to merge your accounts. This will enable you to post comments and edit your question however you might be logged onto the site. – whuber Dec 30 '15 at 22:46