# [R] wald test: compare quantile regression estimators from different samples

John Fox jfox at mcmaster.ca
Sat Nov 19 14:02:45 CET 2011

```Dear Julia,

One approach would be to fit a combined model for the two samples, with a
factor (say, sample) and all interactions between sample and the other
predictors -- something like rq(y ~ sample*(x1 + x2 + etc.)) -- and then
compare via anova() to the additive model rq(y ~ sample + x1 + x2 + etc.)
or, if you're interested in a difference in the intercepts and well as
coefficients of the x's (as implied by your formulation), to rq(y ~ x1 + x2
+ etc.).

I hope this helps,
John

--------------------------------
John Fox
Senator William McMaster
Professor of Social Statistics
Department of Sociology
McMaster University
http://socserv.mcmaster.ca/jfox

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Julia Lira
> Sent: November-19-11 6:49 AM
> To: R list
> Subject: [R] wald test: compare quantile regression estimators from
> different samples
>
>
> Dear all,
> I am trying to compare the estimated coefficients of a quantile
> regression model between two different samples. It is a Wald test, but
> I cannot find one way to do that in R.The samples are collected
> conditional on a specific characteristic and I would like to test
> whether such characteristic indeed affect the estimators. The problem
> in the test anova.rq is that the response variable should be the same,
> therefore I cannot use different samples.
> Consider as an example the following:
> Model 1:Q_y(tau|X,I=2) = X'beta(tau|I=2)
> Model2;Q_y(tau|X,I=3) = X'beta(tau|I=3)
> The first sample consider I=2 and the second I=3. I would like to test
> whether, at the quantile "tau", beta(tau|I=2) = beta(tau|I=3).
> I have already tried to design a Wald test like:
> W <- ((beta(tau|I=2)-beta(tau|I=3))^2)/var(beta(tau|I=2)-beta(tau|I=3))
> But it doesn't work because var(beta(tau|I=2)-beta(tau|I=3)) is equal
> to NA.
> Is there any way to compare those estimators?
> Thank you very much!
> Best regards,
> Julia
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help