<>
The 'by hand' Sargan statistic could be computed in a more bulletproof
manner via
------
sysuse auto,clear
loc qual !foreign
ivregress 2sls price (mpg = weight length) if `qual'
// these are the proper 2SLS resids: y - orig X * 2SLS beta
predict double eps, res
estat overid
// Sargan stat by hand
reg eps weight length if `qual'
// compute the uncentered r^2 from this regression
predict double yhat, xb
gen double syhat2 = yhat^2 if `qual'
su syhat2, mean
loc syhat2 = `r(sum)'
gen double seps2 = eps^2 if `qual'
su seps2, mean
scalar ur2 = `syhat2'/r(sum)
// Sargan: N * uncentered r^2
di e(N)*ur2
-------
which will take care of missing values or use of less than the full
sample in estimation. Even if Tunga eschews the use of 'canned'
routines such as estat overid or ivreg2 for pedagogical reasons, he
should check his 'by hand' routine to see that it matches.
The 'artificial regression' terminology is, I believe, due to Davidson
and MacKinnon's books. Jeff Wooldridge's books also use this
terminology.
Kit Baum | Boston College Economics and DIW Berlin | http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html
*
* 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/