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 on April 23, and its replacement, is already up and running.

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

st: Endogeneity in quantile regression

From   xueliansharon <>
Subject   st: Endogeneity in quantile regression
Date   Mon, 5 Jul 2010 07:40:37 -0700 (PDT)

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, after that I bootstrap the whole program to correct for the
standard errors.  But I get an error message "Convergence not achieved". So
can anybody help me to figure out the mistakes in my codes? Many thanks.

My codes: 

sysuse auto, clear 
        program qregivb, eclass 
        version 11.1 

        // Stage 1 
                tempvar pricehat 
        regress price foreign weight length 
       	 predict `pricehat', xb 

        // Stage 2 
        foreach q of numlist 10 20 30 { 
                qreg mpg foreign `pricehat', quantile (`q') 
                                matrix b`q'=e(b) 
                                matrix colnames b`q'=q`q': 
                                matrix b=nullmat(b), b`q' 
                gen e=e(sample) 
                qui count if e 
                eret post b, dep(sch) es(e) obs(`r(N)') 
                ereturn local cmd "schrural19" 
                ereturn local properties "b" 

        bootstrap _b , reps(1000) seed(10101) nodots: qregivb 

View this message in context:
Sent from the Statalist mailing list archive at
*   For searches and help try:

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