Dear Brian,
Thanks a lot for your help. Your code is working just fine!
Could I please ask you how the code could be expanded to retrieve the pseudo R-square as well?
Also, I was wondering whether it is possible to perform tests such as the exogeneity test of instruments or a test of over-identification assumption. More generally, I have searched for papers using quantile regressions or 2SLAD (of which there are few), and I did not see any mention of specification tests based on quantile residuals. Is it the case that econometrics has not yet developed the tools to perform such tests? I've been looking in my textbooks (Wooldridge, Greene) but did not find any guidance.
Thanks a lot again for your help,
Thi Minh
------------------------------------------------------------
Date: Wed, 7 Apr 2004 15:41:50 -0500 (CDT)
From: "Brian P. Poi" <[email protected]>
Subject: Re: st: 2SLAD - qreg - how to obtain t-stat and p-value
Earlier today (Apr 7, 2004) Thi Minh asked
> I am now estimating a 2SLAD model, and follow the instructions given by
> Statacorp's Brian P. Poi in the statalist dated 26 Sep 2003. Is there a
> way to retrieve the p-value and the t-stat as they appear when using the
> command bsqreg? As Brian Poi explains, the s.e. need to be bootstrapped
> for _both_ stages of the estimation so that it is the command
> _bootstrap_ which needs to be used.
> program bootit2
> version 8.0
> //region 2 - stage 1
> reg Y2 X1 Z if reg7==2
> predict double phat2, xb
>
> //region 2 - stage 2
> qreg Y1 X1 phat2 if reg7==2
> drop phat2
> end
> bootstrap "bootit2" _b, reps (200) dots
In [R] -qreg- we give the following example of -bsqreg-:
sysuse auto, clear
set seed 1001
bsqreg price weight length foreign , reps(1000)
We can replicate the output table including t-statistics, p-values
and confidence intervals ourselves using -bootstrap- and -qreg-.
This code does just that:
set seed 1001
bootstrap "qreg price weight length foreign" _b, reps(1000)
// The following code should work after any call to
// -bootstrap-
matrix b = e(b)
matrix se = e(se)
local names : colnames(se)
local df = e(N) - colsof(b)
tempname t lb ub
local i = 1
foreach var of local names {
scalar `t' = (b[1, `i'] / se[1, `i'])
scalar `lb' = b[1, `i'] - se[1, `i']*invttail(`df', 0.025)
scalar `ub' = b[1, `i'] + se[1, `i']*invttail(`df', 0.025)
di "`var'" _col(15) %9.0g b[1,`i'] ///
_col(26) %9.0g se[1, `i'] ///
_col(38) %6.2f `t' ///
_col(46) %6.3f 2*ttail(`df', abs(`t')) ///
_col(56) %9.0g `lb' ///
_col(68) %9.0g `ub'
local i = `i' + 1
}
These results agree with -bsqreg-, since all we've really done is
replicate what -bsqreg- does automatically.
The same code that appears after my call to -bootstrap- can be used
any bootstrapping job, including bootstrapping the 2SLAD estimator
that Thi Minh mentioned.
Hope this helps
-- Brian Poi
-- [email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/