Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Re: Endogeneity in quantile regression
From
Tirthankar Chakravarty <[email protected]>
To
[email protected]
Subject
Re: st: Re: Endogeneity in quantile regression
Date
Tue, 6 Jul 2010 13:04:33 +0530
by replacing -tempvar- with a non-temporary variable as in:
******************************
clear*
sysuse auto, clear
cap program drop qregivb
program qregivb, eclass
version 11.1
marksample touse
// Stage 1
regress price 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'
}
drop pricehat
eret post b, esample(`touse')
end
bootstrap _b , reps(100): qregivb
******************************
2010/7/6 xueliansharon <[email protected]>:
> Dear Scott,
>
> I delete the "nodots" option and change the local cmd "qregivb", but I can
> not understand what you mean about "use the explicit variable", could you
> explain it more clearly? Or could you provide the correct codes to me?
>
> Now I get the error message as "insufficient observations to compute
> bootstrap standard errors
> no results will be saved".
>
> My codes are:
>
> 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 "gregivb"
> ereturn local properties "b"
>
> end
>
> bootstrap _b , reps(2000) seed(10101): qregivb
>
> Thanks,
> Sharon
>
> --
> View this message in context: http://statalist.1588530.n2.nabble.com/Endogeneity-in-quantile-regression-tp5256322p5258475.html
> Sent from the Statalist mailing list archive at Nabble.com.
> *
> * 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/
>
--
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).
*
* 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/