29

Following on my question for OLS, I wonder: what diagnostic plots exists for quantile regression? (and are there R implementation of them?)

A quick google search already came up with the worm plot$^\dagger$ (which I have never heard about before), and I'd be happy to know of more methods you might know about. (are any of them one from OLS ported for quantile-regression?)


$\dagger$ link dead

User1865345
  • 8,202
Tal Galili
  • 21,541

1 Answers1

21

Quantile regression does not make distributional assumptions, i.e., assumptions about residuals, other than assuming that the response variable is almost continuous. If you are addressing the problem of estimating a single quantile as a function predictors X, far and away the major things that can go wrong are misspecification of the linear predictor $X\beta$ by underfitting, i.e., failing to include nonlinear effects (a common problem) or interaction effects. There are at least two recommended approaches. First, if your sample size is large, just fit a more flexible model. A good compromise is to allow all main effects to be nonlinear using regression splines such as restricted cubic splines (natural splines). Then there is nothing that needs to be checked except for interactions. The second approach is to hope that the model is simple (why?) but allow it to be complex, then to assess the impact of the complex additions to the simple model. For example, we can assess the combined contributions of nonlinear or interaction terms or both. An example follows, using the R rms and quantreg packages. A compromise interaction form is used, to limit the number of parameters. The interactions are restricted to not be doubly nonlinear.

require(rms)
# Estimate 25th percentile of y as a function of x1 and x2
f <- Rq(y ~ rcs(x1, 4) + rcs(x2, 4) + rcs(x1, 4) %ia% rcs(x2, 4), tau=.25)
# rcs = restricted cubic spline, here with 4 default knots
# %ia% = restricted interaction
# To use general interactions (all cross product terms), use:
# f <- Rq(y ~ rcs(x1, 4)*rcs(x2, 4), tau=.25)
anova(f)   # get automatic combined 'chunk' tests: nonlinearity, interaction
# anova also provides the combined test of complexity (nonlin. + interact.)
Frank Harrell
  • 91,879
  • 6
  • 178
  • 397
  • How about using fractional polynomials instead of cubic splines? – Mikołaj Feb 05 '24 at 21:26
  • 1
    That works, assuming you account for the degrees of freedom used when computing standard errors, and you don't have zeros or negative values in a predictor. – Frank Harrell Feb 06 '24 at 00:13
  • If I possess a quantile regression model (rq()) that includes both categorical and continuous dependent variables, how should one examine the interactions? a) Should anova() be conducted for each pair of variables, or should anova() be performed for the entire model? b) Furthermore, if I am investigating qr() for different tau values, such as 0.25, 0.5, or 0.75 - must I conduct an interaction assessment separately for each tau? – Mikołaj Mar 10 '24 at 18:36
  • This is where I'd rather use semiparametric models to get unified quantiles and the mean, as in here. I would also try to test interactions as a group. – Frank Harrell Mar 13 '24 at 22:06