Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Panel-robust Hausman Test
From
Lukas Borkowski <[email protected]>
To
[email protected]
Subject
st: Panel-robust Hausman Test
Date
Mon, 28 May 2012 16:24:26 +0200
Dear all,
I am using Stata 11.2 and I am trying to run a panel-robust Hausman Test as suggested by Cameron & Trivedi, Ch. 8. The code is
preserve
qui xtreg lngdp_wb ptot ppri psec pter $controls, re
scalar theta = e(theta)
global yandx lngdp_wb ptot ppri psec pter $controls
sort id
qui foreach var of varlist $yandx {
by id: egen mean`var' = mean(`var')
gen fe`var' = `var' - mean`var'
gen re`var' = `va' - theta*mean`var'
}
* Wooldridge's auxiliary regression for the panel-robust Hausman test
qui reg relngdp_wb reptot reppri repsec repter relnoecd_dist reoecd_comlang_ethno redisteq ///
relandrel relif remor_u5 rerat_bir relnpop_tot relnland reopenk remalfal94 ///
feptot feppri fepsec fepter felnoecd_dist feoecd_comlang_ethno fedisteq felandrel felif ///
femor_u5 ferat_bir felnpop_tot felnland feopenk femalfal94, vce(cluster id)
* Test of the null-hypothesis gamma==0
test feptot feppri fepsec fepter felnoecd_dist feoecd_comlang_ethno fedisteq felandrel felif ///
femor_u5 ferat_bir felnpop_tot felnland feopenk femalfal94
restore
Even though I have been successfully running this test a couple of times before, suddenly an error message appears after scalar theta = e(theta) telling me that there would be a type mismatch when generating theta. However, all variables are numeric and there cannot be any kind of type mismatch.
Does anyone have a solution to this rather stupid but time-consuming problem? Thanks!
#
Lukas Borkowski
*
* 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/