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
Calculation of mean for each industry quarter using egen, any quicker way!!Dear Statalist members, My dataset is something like this Code: * Example generated by -dataex-.…
Vuong test for hedonic price model - RegressionHi all, I am trying to estimate a hedonic price model. The first step used is estimating the Box Cox…
How to run mlogit for panel dataDear guys: I'm a graduate in China, my thesis is about to check the relation between 1000 people's …
combining datasets with different formats of a variable and ts valuesI have a dataset that includes information on naic codes, years, the quarter of those years in the f…
regression with time trendHi everyone, I have pooled cross-sectional dataset for 2009,2011,2012,2014 and 2017. I am trying to…
Subscribe to:
Post Comments (Atom)
0 Response to Problem using Hoechle's Hausman test for Driscoll-Kraay standard errors
Post a Comment