Underlying model for quantile regression in BRMS

This post is targeted directly @paul.buerkner but anyone who knows the answers please feel free to jump in as well on the discussion.

I came across this github post: Quantile regression possible? · Issue #168 · paul-buerkner/brms · GitHub where Paul explains that he has implemented quantile regression into brms. Based upon that, I was hoping that he could answer two questions for me:

  1. Do you recall what paper you used to construct the model? I was hoping to read more about the finer details of the model specification (it seems most people use the asymmetric Laplace formulation which is suggestive of what you did based on your code).

  2. I’m actually interested in the case of applying quantile regression to both linear and nonlinear mixed effects models. I know that brms can handle those type of models in general, but will it work for quantile regression in the mixed effects model case or do extra steps/care need to be taken to implement it in brms? For example,

model <- brm(
  bf(values ~ c + (d-c)*(exp(-days/e)),
     c ~ 1 + (1|ids), d ~ 1 + (1|ids), e ~ 1 + (1|ids),
     nl = TRUE, quantile = 0.2),
  data = dat, family = asym_laplace(),
  prior = c(
    prior(normal(7, 5), class = "b", nlpar = "c"),
    prior(normal(25, 5), class = "b", nlpar = "d"),
    prior(normal(33, 5), class = "b", nlpar = "e"),
    prior(normal(0, 10), class = "sd", nlpar = "c"),
    prior(normal(0, 10), class = "sd", nlpar = "d"),
    prior(normal(0, 10), class = "sd", nlpar = "e")
  ),
  sample_prior = "only"
)

This models runs and is how I would expect to fit a nonlinear mixed effects quantile regression but I just want to make sure that it’s as simple as that.

2 Likes

Hi @Tony

I haven’t worked with quantile regression but you can find how it is implemented in brms here: Parameterization of Response Distributions in brms

So answer to 1. seems to be yes, it is the asymmetric laplace.

It might also help to take a look at the code that brms generates for a simple quantile regression model to understand it in more detail.

For 2. it might be useful to simulate some data and see if the parameters are recovered well (I don’t see a reason why they wouldn’t be.) See also the pp_check() function.

Good luck with the modelling.

@Tony hello, you can indeed use the asym_laplace() family to make multilevel linear or non-linear quantile models, similarly to other response distributions. In the linear case the coefficients just represent effects on the conditional quantile. One trick is that you do need to specify dpar = 'mu' to obtain predictions of the conditional quantile when using fitted(), predict() or equivalent. As @matti said it’d be wise to make some initial simulations to understand how the model operates.

If you’ve not made similar models before there are a few things to be aware of. Unlike other response distributions, it’s not generally intended that the asymmetric Laplace distribution represents the conditional probability of the response variable; it is a working likelihood (a computational device to implement a quantile model in a parametric framework). In practice this means that the validity of the posteriors is not assured by Bayes’ rule (detailed description here: https://doi.org/10.1111/insr.12114); my understanding based on this work is that this probably doesn’t diminish the point estimates but may make the intervals too narrow. This may warrant some caution when applying these. I suppose this may also make some tools like PPC or LOO not applicable or not very interpretable.

1 Like