# Is it valid to use quantile regression with only categorical predictors?

I am new to quantile regression and most of the examples I see are in a multiple regression context with continuous predictors. I am analyzing a designed experiment and was wondering if quantile regression is still valid with only categorical predictors (eg 2 x 2 factorial ANOVA context).

• How would you define 'quantile' in a categorical context? Nov 13, 2014 at 19:22
• @Wayne: The response is continuous. Nov 14, 2014 at 10:41
• @Scortchi: ah, my poor reading comprehension! So then the question boils down to "is it valid to use regression with only categorical predictors?" Nov 14, 2014 at 13:18
• @Wayne: Yes, in a nut-shell. Nov 14, 2014 at 13:21

A quantile regression model establishes a relationship between the percentiles of a continuous outcome and a set of predictors.

In the simplest situation the outcome needs to be a continuous variable, but both categorical and continuous predictors can be included.

If you want to evaluate the impact of 2 dichotomous predictors on a specific percentile $p$ of $Y$, (which is the same situation of a two-way ANOVA), you can build the model $$Q_{Y|X=x}{(p)}=\beta_0(p)+\beta_1(p)x_1+\beta_2(p)x_2$$ where $\beta_1(p)$ and $\beta_2(p)$ express the change in the pth percentile of $Y$ associated with the dichotomous variables $x_1$ and $x_2$, respectively

• Fabulous! Any recommendations for papers/books with gentle/intuitive intros to Quantile regression? Ones with sample data would be very helpful. Nov 16, 2014 at 16:16
• This is a recent very simple introduction: aje.oxfordjournals.org/content/early/2014/07/02/aje.kwu178 Further references are included Nov 17, 2014 at 8:35

Binary predictors (eg male vs female) and categorical variables (color) can enter into quantile regression alone or in combination with continuous predictors. Anything you can do in multiple regression, ANOVA or ANCOVA -- that is, any general linear model (GLM) -- should work with quantile regression.

Petscher and Logan (2014) provide a wonderful intro, explicitly discussing how to interpret the results of quantile regression with a single continuous predictor, with a single binary predictor, and with both. They also discuss an application to longitudinal research. They compare all quantile regression results to standard regression.

With regard to interpreting quantile regression coefficients, they note "While linear regression posits the question 'What is the relation between X and Y?' quantile regression extends this to, 'For whom does a relation between X and Y exist' as well as testing for whom a relation is stronger or weaker" (pg 864, emphasis added).

Gaining intuition for quantile regression can take practice. The introductions associated with software in R are very useful; this short post also provides some insights.

Software notes: The lqmm package in R provides facilities for quantile regressions with random effects and quantile Poisson regression. As is generally applicable for random effects/hierarchical models, lqmm is better behaved if you center continuous predictors. Koencker's quantreg package in R, which has a nice vignette, handles independent data and has facilities for non-linear quantile (nlrq) models and "non-parameteric quantile smoothing" which looks to be similar to traditional smoothing/GAM methods.