Dear Stata users
I have written this STATA code to implement the Hausman and Taylor
estimator but I am not quite sure if this is the right procedure, in
particular, to get consistent estimates of the variance components.
Someone could help me
ALl the best
Antonio
>>>>>>>>>>>>>
REPLICATE PAGES 120-121: HAUSMAN TAYLOR APPROACH USING WAGES DATA
*GENERATE LIST OF ENDOGENOUS VARIABLE;
global yvar "lwage";
* GENERATE LIST OF EXPLANATORY VARIABLES (Xit and Zi);
global z1 "fem blk"
global z2 "ed"
global x1 "wks south smsa ms"
global x2 "occ ind union exp exp2"
*WITHIN REGRESSION;
regress devlwage devwks devsouth devsmsa devms devocc devind devunion
devexp2 devmy76 devmy77 devmy78 devmy79 devmy80 devmy81 devmy82,
noconstant
*WITHIN RESIDUALS;
predict residu, residuals
ge sqresidu=residu*residu
*SQUARED SUM OF WITHIN RESIDUALS;
egen sumsqru=sum(sqresidu)
*CREATE SIGMA2ETA (Hausman Taylor p. 1384). consistent estimate of
sigma2eta;
gen sigmau=sumsqru/(4164-595) */ NT=4164 N=595
su sumsqru sqresidu sigmau
*GENERATE di (group means of within residuals);
egen mresidu=mean(residu), by (id)
*2SLS of di on z1 and z2 using as instruments x1 and z1;
ivreg mresidu fem blk (ed= wks south smsa ms)
*save residuals
predict resiv, residuals
gen sqresiv=resiv*resiv
* squared sum of 2SLS residuals
egen sumresiv=sum(sqresiv)
* consistent estimate sigma2 (1/n)*/(yi.-xi.*bw-zi*gammaw)'
(yi.-xi.*bw-zi*gammaw), p. 1384 HT where yi. =vector of group means,
bw=within estimate gammav=2SLS estimates
*gammav is obtained from the above 2SLS regression
gen sigmat=sumresiv/595
>>>>>>>>>>>>>>>>>>>>>>
*
* 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/