Apologies for a long post. Posting here first time, so trying to be as descriptive about my problem as possible.
I'm using Stata 15.1 to run certain regressions of a dependent variable on 12 independent variables, 2 of which are dummies. I have about 13000 observations of about firms and 11 years. The following is a sample of my data:
My problem is that I am running the following two regression commands (which to me are equivalent) and getting different coefficients and standard errors:
Some of the ways that I have tried to investigate the problem are as below:
The following are the first half of the results that I am getting - is there a reason why the degrees of freedom for F values are different?
xtreg:
reghdfe:
I also tried running the following xtreg command which I know is incorrect, but just to try:
this gave me the same coefficients as my reghdfe command, but with different SEs. Is my initial command of
somehow missing estimating the fixed effects??
I'm using Stata 15.1 to run certain regressions of a dependent variable on 12 independent variables, 2 of which are dummies. I have about 13000 observations of about firms and 11 years. The following is a sample of my data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id double fyear float depvar double indepvar float(avg_acc bign btm) double ib float(lev ln_mve negearn) double(returns returns_sd) float roa double turnover 1 2008 .21098053 .5637141535615172 .008471157 1 .3294921 693 .2857335 8.957575 0 -.009528047869725224 .043552877898948815 .09318274 .008361675741150975 1 2009 .19782035 .5812519272278756 .0576721 1 .29263046 -31 .3815029 9.055287 1 .005355215185532733 .06399085279101045 -.004072517 .010527989189140498 1 2010 .196463 .5812519272278756 .0035066006 1 .26797697 684 .22586633 9.396472 0 .0068172405747016175 .04030163330312947 .070544556 .01009467148128897 1 2011 .19716935 .6583745239445751 .027382135 1 .3355041 1012 .21331567 9.46035 0 .002321546803264377 .057455056678877264 .11173678 .012597314028069377 1 2012 .19436316 .6920832995705375 .007118451 1 .4155719 1153 .20045558 9.4310465 0 .000574310337576796 .048660550088320056 .10943432 .009339219935238362 1 2013 .18369286 .6920832995705375 .04005241 1 .3133838 724 .25257346 9.733144 0 .0073712712373190485 .028140228933663403 .0677522 .009011035441420972 1 2014 .180157 .715292459478506 .01911181 1 .2861167 504 .25500876 9.82644 0 .002056485512293875 .028562754063788047 .0465331 .0067959762928076085 1 2015 .17802577 .7040169133192389 .012033694 1 .3323942 438 .22128627 9.436385 0 .00011126648795017797 .0269186764339904 .05361679 .007689854548778385 1 2016 .17573275 .7040169133192389 .04242502 1 .3010673 462 .24506536 9.553448 0 .003445337727988282 .030085134101758067 .05921559 .006401633309200406 1 2017 .17838474 .723684210526316 .024329456 1 .22055374 684 .2137432 9.994423 0 .008917151643030453 .021258123519906528 .0811773 .005766246012412012 1 2018 .17764647 .6660412757973732 .09027046 1 .22186323 316 .21063107 9.932306 0 -.0002192192306906423 .03571619570176653 .03699801 .00796381507301703 2 2008 .14732866 .3602941176470588 .0455329 1 .4634591 -273.829 .4979979 6.274389 1 .004488017717552073 .1523623373863852 -.1327424 .031082197126001118 2 2009 .18914294 .3035714285714285 .00719254 1 .7137276 134.662 .47676665 6.55574 0 .009821480704256548 .11954877456868047 .0589544 .02977910908870399 2 2010 .18234695 .4 .05607961 1 .5380657 38.543 .4342996 6.910154 0 .010715832983036168 .10333402652174215 .017685564 .030142837908118964 3 2014 .14020246 .2490118577075098 .004523543 1 .05402936 2882 .40903795 10.529575 0 .01575231987785978 .04715140656536541 .06584268 .017945348266512156 3 2015 .11068071 .29090909090909095 .02811112 1 .2130214 7610 .4246824 10.183115 0 -.0028670972365384493 .051643774805462055 .1571827 .016255052791908385 3 2016 .14916953 .29090909090909095 .07504778 1 .15980203 2676 .4747825 10.07262 0 .003643968411219808 .05328928039386283 .05219019 .015726902717724443 3 2017 .14504911 .29090909090909095 .05496537 1 .158686 1919 .4876839 10.116204 0 .002807587695525189 .04086280597844709 .03733754 .011680605379864574 3 2018 .1349146 .21538461538461545 .035011556 1 -.01142647 1412 .56172 9.601722 0 -.0062770233815535904 .058583369794131965 .02330802 .015764765104278922
Code:
xtset id fyear xtreg depvar indepvar avg_accruals bign btm ib lev ln_mve negearn returns returns_sd roa turnover, fe vce(robust) reghdfe depvar indepvar avg_accruals bign btm ib lev ln_mve negearn returns returns_sd roa turnover, absorb(id fyear) vce(robust)
The following are the first half of the results that I am getting - is there a reason why the degrees of freedom for F values are different?
xtreg:
Code:
Fixed-effects (within) regression Number of obs = 13,398 Group variable: id Number of groups = 1,538 R-sq: Obs per group: within = 0.2122 min = 2 between = 0.0148 avg = 8.7 overall = 0.0273 max = 12 F(12,1537) = 59.05 corr(u_i, Xb) = -0.2804 Prob > F = 0.0000 (Std. Err. adjusted for 1,538 clusters in id)
Code:
HDFE Linear regression Number of obs = 13,398 Absorbing 2 HDFE groups F( 12, 11837) = 32.01 Prob > F = 0.0000 R-squared = 0.9124 Adj R-squared = 0.9008 Within R-sq. = 0.0436 Root MSE = 0.0167
Code:
xtreg depvar indepvar avg_accruals bign btm ib lev ln_mve negearn returns returns_sd roa turnover i.id i.fyear, fe vce(robust)
Code:
xtreg depvar indepvar controls, fe vce(robust)
Comment