I have a quantile regression model with 1 regressor and 1 regressand. I want to hypothesis test that the regressor is equal over every quantile. One approach I’ve thought of is to test over all tau over {0.01,0.02,….,0.99}. However, I would then have to write:
anova(model1,model2,model3,.......,model99), where each model corresponds to a different tau. Question: How do I get anova() to accept large amount of models of type rq without manually typing them out?
My attempt at a solution has been to do this:
y = rnorm(100)
x = rnorm(100)
rqs_object <- rq(y~x,tau=1:99/100)
anova(rqs_object)
However, anova clearly doesn’t take object type rqs, only type rq, unfortunately.
Cross posted here until I decided that it had a large programming/specialist element to the problem .
I concentrate on question 1 and only on the programming part.
some data:
Now I define a function, that takes tau as input and does the fit:
I can then apply this function on a vector of taus:
The result is a list of models.
We can now use
do.callto pass our models toanova: