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: quantile regression with IV

From   xueliansharon <>
Subject   st: quantile regression with IV
Date   Thu, 1 Jul 2010 16:02:01 -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, 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')

	bootstrap qregivb _b, reps(100) 

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