# Hypothesis testing multiple quantiles in quantile regression (quantreg package)

#### derksheng

##### New Member
Consider a simple quantile regression with 1 regressor. I want to do two things:

1) Compare whether the slope parameter is equal $$\forall \tau \in \{0.1,0.2,0.3,\dotsc,0.7,0.8,0.9\}$$

2) Do the same over all $$\tau \in \{0.01,0.02,\dotsc,0.98,0.99\}$$.

I've identified anova(model1,model2,model3) as being a way that works, where model1 is the "rq" object (quantile regression fit) over $$\tau_1$$. However, for the test over 9 quantiles I don't want to type anova(model1,model2,......,model9), and for the test over 99 quantiles I don't want to do it for 99 models.

I've tried generating a list of length 9 and 99 (for my two goals) using lapply() over different $$\tau$$'s. However, anova() won't accept this.

I've also tried working with object "rqs" instead of default "rq". However, that doesn't work either. FYI here is how you generate an "rqs" object. It's basically an "rq" regression over all specified quantiles within 1 object. So I'll generate it for the 99 quantiles.

Code:
y = rnorm(100)
x = rnorm(100)

rqs_object <- rq(y~x,tau=1:99/100)
Here's an example of an "rq" object (the one that works with anova()):

Code:
y = rnorm(100)
x = rnorm(100)

rq_object <- rq(y~x,tau=0.5) #median regression
So how do I get this to work? I see that anova.rq in the package accepts rqlist object type but extensive google searching still has not revealed what this object type is.

Last edited:

#### Lazar

##### Phineas Packard
What about the default graphing function for quantreg models. My vague memory from using it a couple of years ago is that the default plot gives an indication of which slopes are significantly above or below the ols regression line.

#### derksheng

##### New Member
plot() accepts rqs perfectly fine.

anova() (or, equivalently, "anova.rq" in the quantreg documentation) doesn't.

The head author has requested formal joint hypothesis testing as well as plots.

I think I just need a way to create something that contains all 99 models that anova() will accept without typing out anova(model1,model2...........).