Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: about STATA


From   Kit Baum <[email protected]>
To   <[email protected]>
Subject   st: Re: about STATA
Date   Wed, 17 Aug 2005 21:22:15 -0400

Dear Tracy

I believe this will do the trick. If you run into trouble with matrix size in your problem (you probably have more than 22 obs.), you could (a) find a copy of Stata/SE or (b) rewrite all this in Mata (which is how it should be done anyway). But the bottom line is that a Hansen J stat is just the minimized value of the criterion function for minimum-distance estimation. Under the null that the overid. restrictions are appropriate (the instruments are exogenous), J ~ Chi^2 with appropriate d.f. For 3SLS, there is still a 1x1 criterion function that is being minimized, and you just have to figure out how to write it down. Thankfully Davidson and MacKinnon have done a good job of laying that out.

Here is an example that I think is doing the right thing with good ole' Klein Model I:

* overidentification test for 3SLS (reg3) with constraints
* logic without constraints following discussion in Davidson and MacKinnon,
* Econometric Theory and Methods, p. 532
* CFBaum 17aug2005
webuse klein, clear
constraint define 1 [consump]govt = [wagepriv]govt
* must keep track of constraints on coeff vector, since Stata's e(b)
* will contain duplicate entries
* could get it from the rank of e(V)
local nconstraint 1
reg3 (consump wagepriv wagegovt govt invest) ///
(wagepriv consump govt capital1 taxnetx) , c(1)
mat esigma = e(Sigma)
mat beta = e(b)
g iota = 1 if e(sample)
local exog `e(exog)' iota
* construct the 3SLS resids and vec them
predict double econsump, resid equation(consump)
predict double ewagepriv, resid equation(wagepriv)
mkmat econsump ewagepriv if e(sample), mat(e)
mat e3 = vec(e)
* construct the matrix of exogenous vars in system
mkmat `exog' if e(sample), mat(w)
mat pw = w*syminv(w'*w)*w'
* Kronecker product with esigma
mat middle = syminv(esigma) # pw
* GMM criterion function, a la Davidson & MacKinnon (12.61) and p.532
* crit = e3' (sigma^-1 kronecker pw) e3 ~ Hansen/Sargan stat (equiv to J)
* where pw = w (w'w)^-1 w', and w is matrix of all exogenous vars in system
mat crit = e3' * middle * e3
scalar crit = crit[1,1]
* D.F. : #eqns * #exog - #betas estimated (net)
matrix df = rowsof(esigma) * colsof(w) - (colsof(beta) - `nconstraint')
scalar df = df[1,1]
di "Total # exog in system : " colsof(w)
di "Coeffs estimated net of constraints : " colsof(beta) - `nconstraint'
di "Hansen/Sargan : " crit
di "with d.f. : " df
scalar chi2 = chiprob(df,crit)
di "Hansen/Sargan Chi2 p-value : " chi2


Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


On Aug 17, 2005, at 5:21 PM, p.x wrote:


Dear Mr. Christopher Baum:



My name is Tracy. I am a doctoral student in University of Washington.

I am trying to run an over-identification test for a constrained four-equation simultaneous model.

I used regs to run simultaneous model. But I couldn’t find a way to run over-identification test for reg3.

Could you give me some suggestions on how to run an over- identification test for reg3

or is there procedure that I can run both a constrained four- equation simultaneous model and

over-identificaiton test? Your help is greatly appreciated!!!



Best regards,

Tracy Xu



University of Washington



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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index