Hi, guys! So I have a problem. I'm trying to use the Wooldridge/Hausman test that Hoechle suggests in his 2007 paper Robust Standard Errors for Panel Regressionswith Cross-Sectional Dependence. This is the code he suggests:
. qui xtreg BA aVol Size TRMS2 TRMS, re
. scalar lambda_hat = 1 - sqrt(e(sigma_e)^2/(e(g_avg)*e(sigma_u)^2+e(sigma_e)^2))
. gen in_sample = e(sample)
. sort ID TDate. qui foreach var of varlist BA aVol Size TRMS2 TRMS {
. by ID: egen ‘var’_bar = mean(‘var’) if in_sample
. gen ‘var’_re = ‘var’ - lambda_hat*‘var’_bar if in_sample // GLS-transform
. gen ‘var’_fe = ‘var’ - ‘var’_bar if in_sample // within-transform
.}
. * Wooldridge’s auxiliary regression for the panel-robust Hausman test:
. reg BA_re aVol_re Size_re TRMS2_re TRMS_re aVol_fe Size_fe TRMS2_fe
> TRMS_fe if in_sample, cluster(ID)(output omitted)
. * Test of the null-hypothesis ‘‘gamma==0’’:
. test aVol_fe Size_fe TRMS2_fe TRMS_fe
( 1) aVol_fe = 0
( 2) Size_fe = 0
( 3) TRMS2_fe = 0
( 4) TRMS_fe = 0
F( 4, 218) = 2.40
Prob>F= 0.0510
I enter the following code into STATA:
. qui xtreg Employmentrate Taxwedge HICP GDPgrowth, re
. scalar lambda_hat = 1 - sqrt(e(sigma_e)^2/(e(g_avg)*e(sigma_u)^2+e(sigma_e)^2))
. gen in_sample = e(sample)
. sort Country Year
. qui foreach var of varlist Employmentrate Taxwedge HICP GDPgrowth {
. by Country : egen ‘var’_bar = mean(‘var’) if in_sample
. gen ‘var’_re = ‘var’ - lambda_hat*‘var’_bar if in_sample
. gen ‘var’_fe = ‘var’ - ‘var’_bar if in_sample
. }
And get the following error message:
‘var’_bar invalid name
Now, obviously this means that I have violated some kind of naming parameter for STATA, but what do I do about that? How do I fix this?
Related Posts with Problem using Hoechle's Hausman test for Driscoll-Kraay standard errors
Dropping observations based on certain criteriaHello all, Here is a snippet of the data I am working with: Code: * Example generated by -dataex-…
Testing for Normality using Jarque-Bera in Panel Data (xtsktest + jb)Dear Stata community, currently, I am trying to decide whether my data is normally distributed or n…
scatter plotshey there! im using stata 14 and want to create the scatter plots between the K (cutt-offs) and H,A,…
Meaning of different code1. Create the dummies and estimate levelsof year, local(time) foreach t of local time { local y_rr =…
Interval Scaled Independent VariablesHello everyone, I know, this is not a question referring to Stata directly, but maybe someone can h…
Subscribe to:
Post Comments (Atom)
0 Response to Problem using Hoechle's Hausman test for Driscoll-Kraay standard errors
Post a Comment