# How to interpret coefficient for rq()

Suppose my prediction equation code is:

model = rq(y ~ a+b+c+d+a:b, data=df)


I used quantile regression.

and I obtain the coefficient:

Coefficients:
coefficients lower bd upper bd
(Intercept)    73.20403     65.76575 78.73982
a              -5.50504     -6.47261 -4.68637
b              -0.01239     -0.02024  0.00269
c              -0.38597     -0.45149 -0.29316
d              -0.00273     -0.00344 -0.00198
a:b             0.04913      0.03705  0.05731


What will be my prediction equation looks like? Is it just like linear regression?

Attempt 1:

i think: $$y = 73.204 - 5.505\dot a -0.012\dot b -0.386\dot c -0.003\dot d + 0.049\dot a*b$$

However, shouldn't i mention rq somewhere in the equation? otherwise it will be the same as lm.

Attempt 2:

$$\hat{y} = 73.204 - 5.505\dot a -0.012\dot b -0.386\dot c -0.003\dot d + 0.049\dot a*\dot b$$

Attempt 3:

$$\hat{y}_{i,q (0.50)} = 73.204 - 5.505a_i -0.012b_i -0.386c_i -0.003d_i + 0.049a_ib_i$$

• In some sense, yes, it’s just like linear regression. However, it will help if you write out the equation “just like linear regression” the way that you understand that phrase. Then we can work with what you write and discuss what you get right and what you get wrong.
– Dave
Jan 27, 2020 at 1:32
• @Dave edit. thanks! :) Jan 27, 2020 at 1:57
• In attempt 1, you’ve got the gist right. However, be a little more explicit and formal. Stick a hat (\hat{}) on the y, and use indices to denote which a, b, c, and d values are under consideration. Put that in attempt 2. Then we’ll discuss how to modify it for a quantile regression. (It’s also going to matter that each $\hat{y}_i = \mathbb{E}[y\vert a=a_i, b=b_i,c=c_i, d=d_i]$, so write that in your attempt, too.)
– Dave
Jan 27, 2020 at 2:36
• @Dave what do you mean by indices? maybe brackets? Jan 27, 2020 at 3:00
• You’re evaluating at a particular value of a, so it’s $a_i$. Then you get $\hat{y}_i$ as the conditional expected, given the value of that predictor.
– Dave
Jan 27, 2020 at 3:08

Let's start by reviewing what linear regression does.

The typical setup is that we posit that there is some phenomenon occurring that follows distribution with a mean that changes, depending on the input variables (predictors). We use regression to estimate this conditional mean (expected value), conditioned on the predictors.

In your case, your predictors are $$a$$, $$b$$, $$c$$, and $$d$$. For each subject $$i$$, you get some $$a=a_i$$, $$b=b_i$$, $$c=c_i$$, and $$d=d_i$$. This is how we wind up with $$\widehat{y}_i = \mathbb{E}[y\vert a=a_i, b=b_i,c=c_i, d=d_i]$$ (maybe throw a hat over the expected value like $$\widehat{\mathbb{E}}$$, since it's still just an estimate). We want to know the average value of $$y$$ that we would get when $$a=a_i$$, $$b=b_i$$, $$c=c_i$$, and $$d=d_i$$.

The key point here is that there is a full distribution at each combination of $$a$$, $$b$$, $$c$$, and $$d$$ values. We might not be interested in the mean. The median or first quartile or 90th percentile might be more interesting, and this is where quantile regression comes in.

Instead of estimating the conditional mean, quantile regression estimates the conditional quantile. Therefore, we do not write the linear combination of predictors as the expected value of the conditional distribution but as a particular quantile of the conditional distribution. But that's all you change. The side of the equation with the parameter estimates is the same, except that they are not estimated via least squares.

In matrix notation, we go from $$\mathbb{E}[y\vert X] = X\hat{\beta}_{ols}$$ to $$Q_{q_0}(y\vert X)= X\hat{\beta}_{q_0}$$, where $$q_0$$ is the quantile of interest.

The notation I'm using is what I like at this particular moment but is not universal. However, I think it captures all pertinent information: that it is a quantile regression, the quantile under consideration, and that there is a conditional distribution at play.