# R: st: AW: IV Quantile Regression and Test of Equality

 From "Francesco Burchi" To Subject R: st: AW: IV Quantile Regression and Test of Equality Date Thu, 17 Dec 2009 09:43:02 +0100

```The first point is that the Wald test after the procure suggested by Austin
ends up with a Chi2 test while with standard sqreg it is a F-test, and I
don't know why.
Then, I find surprising that the coefficients of the same variable for
different quantiles are so different in both coefficients and standard
errors (therefore, in p-value), but the Wald (Chi2) test never identifies a
statistically significant difference, not even at 10%-level.

Francesco.

-----Messaggio originale-----
Da: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Martin Weiss
Inviato: mercoledì 16 dicembre 2009 20.24
A: statalist@hsphsun2.harvard.edu
Oggetto: RE: st: AW: IV Quantile Regression and Test of Equality

<>

" how is this Wald test calculated "

Manual [R], p. 1919, shows you all the relevant formulas. Which part of your
output do you find surprising?

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Francesco Burchi
Sent: Mittwoch, 16. Dezember 2009 19:01
To: statalist@hsphsun2.harvard.edu
Subject: R: st: AW: IV Quantile Regression and Test of Equality

Thank you Austin, that was great! I finally get my results and I can also
run the tests.
Just a quick question: if I have my exogenous variable - "education" - which
has a coefficient=0.038, s.e.=0.037 and p-value=0.308 at the 0.10 quantile,
and the same variable with a coefficient=0.047, s.e.=0.017 and p-value=0.006
at the 0.50 quantile, how comes that the test of equality of coefficients:
test [q10]education = [q50]education
has a p-value>0.2?

I guess my questions are: how is this Wald test calculated and how important
it is? Is there another way to compute it?
I have seen most of the papers using quantile regression in economics and
social science not reporting these tests of equality.

Thanks,
Francesco.

-----Messaggio originale-----
Da: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Austin Nichols
Inviato: mercoledì 16 dicembre 2009 6.51
A: statalist@hsphsun2.harvard.edu
Oggetto: Re: st: AW: IV Quantile Regression and Test of Equality

and try out this example:

clear all
use http://fmwww.bc.edu/ec-p/data/wooldridge/card
if replay() {
syntax [anything] [, *]
eret di, `options'
}
else {
syntax [varlist] [, *]
loc x `varlist'
reg educ `x' nearc?, robust
tempvar educ
ren educ `educ'
predict double educ
foreach q in 10 30 50 70 90 {
qreg wage `x' educ, q(`q') `options'
mat b`q'=e(b)
mat colnames b`q'=q`q':
mat b=nullmat(b),b`q'
}
gen e=e(sample)
qui count if e
eret post b, dep(wage) es(e) obs(`r(N)')
eret local properties "b"
drop educ
ren `educ' educ
}
end
unab x: exper* smsa* south mar black reg662-reg669

On Tue, Dec 15, 2009 at 8:35 AM,  <fburchi@uniroma3.it> wrote:
> Dear Martin,
>
> I am referring to the post:
> http://www.stata.com/statalist/archive/2003-09/msg00585.html  where this
> procedure is suggested. I should add that I am using Stata 10. I try to
> re-write the commands used:
>
> 1) program IVQRestimates
> 2) reg endogvar instrument1 instrument2 X1 X2 X3 X4, robust
> 3) predict double IVendogvar, xb
> 4) sqreg Y IVendogvar X1 X2 X3 X4, quantiles(10,30,50,70,90)
> 5) end
> 6) bootstrap "IVQRestimates" _b, reps(100) dots
>
>> <>
>>
>> " bootstrap "IVQRestimates" _b, reps(100) dots"
>>
>> This is not your call to -bootstrap- the command "IVQRestimates", is it?
>> It
>> does not follow the syntax explained in -h bs- (where the command in
>> question goes after the colon).
>
> "IVQRestimates" is just a possible name for the program that I have run.
> The final bootstrap on the program should allow to get bootstrapped
> standard errors for both the stages.
>
>>
>> " The other problem is that after using this procedure, Stata does not
>> recognize the quantiles,"
>>
>> What do you mean by that? -sqreg- does leave behind the coefficient
vector
>> and the associated varcov, so you can -test- afterwards:
>
> I am again referring to boostrap of the whole program. Stata displays the
> final output calling the variables b_X1 b_2X2 and so on and there seems no
> way to recall them in order to run the Wald tests. That is why I wondered
> whether there was an alternative procedure to run it or, simply, a way to
> compute the test manually.
>
>> ***
>> sysuse auto, clear
>> sqreg price weight length foreign, quantile(.25 .5 .75)
>> te [q25=q50]
>> ***
>>
>> Since you instructed -bootstrap- to save only the coefficients ("_b"),
why
>> do you expect that a -test- procedure would be possible afterwards?
>
> I have just applied the procedure suggested in the previous post on the
> same topic. Should I add any other option?
>
> Thanks again,
> Francesco
>
>> HTH
>> Martin
>
>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Francesco
>> Burchi
>> Gesendet: Dienstag, 15. Dezember 2009 12:42
>> An: statalist@hsphsun2.harvard.edu
>> Betreff: st: IV Quantile Regression and Test of Equality
>>
>> Dear Statalisters,
>>
>> I am applying instrumental variable quantile regression due to the
>> endogeneity of one explanatory variable (endgovar). I am using two
>> instrumental variables (instrument1 and instrument2).  I have followed
the
>> procedure already highlighted in previous posts, that is:
>>
>> program IVQRestimates
>> reg endogvar instrument1 instrument2 X1 X2 X3 X4, robust
>> predict double IVendogvar, xb
>> sqreg Y IVendogvar X1 X2 X3 X4, quantiles(10,30,50,70,90)
>> end
>> bootstrap "IVQRestimates" _b, reps(100) dots
>>
>> Unfortunately, Stata gives me the message "insufficient observations to
>> compute bootstrap standard errors. no results will be saved" There is
>> clearly no problem of total number of observations since they are more
>> than
>> 6000. I have tried different specifications of the model, but the
>> algorithm
>> still does not converge. However, when I have included just one of the
two
>> instrumental variables, it finally produced the results. Do you have any
>> explanation of this? I would be really glad to have suggestions on how to
>> obtain my results keeping both the instruments.
>>
>> The other problem is that after using this procedure, Stata does not
>> recognize the quantiles, thus I cannot automatically run the Wald tests
to
>> test the equality of coefficients across different quantiles. Do you have
>> any suggestions on this? Or, could you simply tell me how I could compute
>> the test by hand?
>>
>> Thanks,
>> Francesco

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```