* Author: William D. MacMillan
* Prepared for ICPSR time-series and cross-section data analysis
* Hausman, Xtmixed, and SUR
* 5/20/09
* 7/6/10 update
* 7/6/11 Revised and updated by RJFjr
clear
use http://www-personal.umich.edu/~franzese/garmit_esspanel1.dta, clear
* Define the 'model' and the 'rhs' to facilitate their future repeated use:
local model spend unem growthpc depratio left cdem trade lowwage fdi
local rhs unem growthpc depratio left cdem trade lowwage fdi
* Let's take a second to remind ourselves what stata has pre-programmed for us
more
help xt
* Let's explore a few we've covered so far, starting with xtreg:
more
help xtreg
* So that's the standard battery of classical panel-heterogeneity models
* and now FGLS for GLRM
more
help xtgls
* And that's where we'd find Parks' procedure and the like
* and xtpcse
more
help xtpcse
* And that's where we'd find Parks' procedure and the like
* And the random-coefficients model
more
help xtrc
* Oops. Notice the use of the Swamy estimator here...
* How about the multilevel-model version:
more
help xtmixed
* That's better (but wow, syntax seems messy to me!)
* OK, let's do some estimating...
* HAUSMAN TEST of RE vs. FE:
more
xtreg `model', re
estimates store remodel
more
xtreg `model', fe
estimates store femodel
more
* for the Hausman test, the always-consistent model is listed first
more
hausman femodel remodel
more
* Let's try PWLS
more
xtgls `model', panels(het)
more
* And using xtgls to do pooled OLS
more
xtgls `model', i(cc)
* Just to compare to OLS with clustered s.e.'s...
more
reg `model', cluster(cc)
* ....and to pcse
more
xtpcse `model'
more
*And a random-coefficient model, using default estimator; effect of unem random by cc
more
xtmixed `model' || cc: unem
more
*Comparing unit-by-unit to SUR unit-by-unit:
more
forvalues i = 2/3 {
qui reg `model' if cc == `i'
estimates store ols`i'
}
suest ols*
more
est clear
forvalues i = 1/18 {
qui capture reg `model' if cc == `i'
capture estimates store ols`i'
}
qui suest ols*
ereturn list
test [ols1_mean]unem=[ols2_mean]unem
more
testparm *unem