Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: quantile regression with IV


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: quantile regression with IV
Date   Thu, 1 Jul 2010 20:57:42 -0400

Sharon <xuelianstata@gmail.com> :

You are only keeping the last estimated coef vector in your program.

I found this solution via Google easily enough:
http://www.stata.com/statalist/archive/2009-12/msg00576.html

but apparently the first few lines of that email were cut off--should be:

See:
http://www.stata.com/statalist/archive/2008-05/msg00913.html
and try out this example:

etc.

On Thu, Jul 1, 2010 at 7:02 PM, xueliansharon <xuelianstata@gmail.com> wrote:
> Dear all,
>
> I want to do quantile regression, but I have an endogenous variable, so I
> regress the endogenous variable price on IVs in the first stage and get the
> predicted value for price, then do quantile regression of mpg on foreign and
> pricehat, then I bootstrap the whole program to correct for the standard
> errors of the second stage.
>
> My problem is that the following codes just return the estimates for 0.9
> quantile regression, but what I want are the quantile regressions for
> quantiles 0.1,0.2,...,0.9 with endogenous variable instrumented and standard
> errors corrected. So could anyone help me to point out my mistakes and
> provide the correct codes to me?  Many thanks.
>
> The following are my codes:
>
> sysuse auto, clear
>
>        program qregivb
>                version 11.1
>
>                // Stage 1
>                regress price foreign weight length
>                predict pricehat, xb
>
>                // Stage 2
>                foreach quant of numlist 0.1 0.2 0.25 0.3 0.4 0.5 0.6 0.7 0.75 0.8
> 0.9 {
>                qreg mpg foreign pricehat, quantile (`quant')
>                }
>        end
>
>        bootstrap qregivb _b, reps(100)
>
>
> Best,
> Sharon

*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index