Thank you sir for the clarification. I want to know how to perform Hausman test adjusted for Cross Sectional dependence as mentioned in Stata Journal xtscc -
I am not able to run this code? As everytime i run the it comes invalid name as error . What is sample in this code? And is it fine if all my variables both dependent and independent variables are in log form? Kindly guide what is wrong with code?
Code:
qui xtreg logBA logaVol logSize logTRMS2 logTRMS, 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 logBA logaVol logSize logTRMS2 logTRMS { . 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 logBA_re logaVol_re logSize_re logTRMS2_re logTRMS_re logaVol_fe logSize_fe logTRMS2_fe logTRMS_fe if in_sample, cluster(ID) (output omitted ) . * Test of the null-hypothesis ``gamma==0'': . test logaVol_fe logSize_fe logTRMS2_fe logTRMS_fe ( 1) logaVol_fe = 0 ( 2) logSize_fe = 0 ( 3) logTRMS2_fe = 0 ( 4) logTRMS_fe = 0 F( 4, 218) = 2.40 Prob > F = 0.0510
Code:
. xtscc logBA_re logaVol_re logSize_re logTRMS2_re logTRMS_re logaVol_fe logSize_fe logTRMS2_fe logTRMS_fe > if in_sample, lag(8) (output omitted ) . 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) = 1.65 Prob > F = 0.1632
Comment