Dear Statalist,
I am working with panel data (17k observations, N= 275, T=65) on Stata 15. I want to compare the residuals from pooled OLS and Fixed effects models. In each case, I am regressing my dependent variable on a constant only. When I ran the -reg- and -xtreg- commands, I noticed that both of the commands produce exactly the same coefficients for the constant and very slightly different standard errors. The predicted residuals are also identically the same. Code and log file for three models is attached: pooled OLS with robust standard errors, FE with and without robust standard errors. I am also not sure why in the FE model with robust SE, there is lots of missing output.
How should I interpret these results? Am I doing something wrong?
Best,
Mihir
I am working with panel data (17k observations, N= 275, T=65) on Stata 15. I want to compare the residuals from pooled OLS and Fixed effects models. In each case, I am regressing my dependent variable on a constant only. When I ran the -reg- and -xtreg- commands, I noticed that both of the commands produce exactly the same coefficients for the constant and very slightly different standard errors. The predicted residuals are also identically the same. Code and log file for three models is attached: pooled OLS with robust standard errors, FE with and without robust standard errors. I am also not sure why in the FE model with robust SE, there is lots of missing output.
How should I interpret these results? Am I doing something wrong?
Best,
Mihir
Code:
xtset id year panel variable: id (unbalanced) time variable: year, 1950 to 2014, but with gaps delta: 1 unit *--------------------------------------------* Pooled OLS with robust std errors *--------------------------------------------* reg y , r predict y_res1, res Linear regression Number of obs = 17,301 F(0, 17300) = 0.00 Prob > F = . R-squared = 0.0000 Root MSE = .78842 ------------------------------------------------------------------------------ | Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .362956 .0059941 60.55 0.000 .351207 .374705 ------------------------------------------------------------------------------ *-----------------------------------* FE with robust std errors *-----------------------------------* xtreg y, fe r predict y_res2, res Fixed-effects (within) regression Number of obs = 17,301 Group variable: area_code Number of groups = 272 R-sq: Obs per group: within = . min = 6 between = 0.0163 avg = 63.6 overall = . max = 65 F(0,271) = . corr(u_i, Xb) = . Prob > F = . (Std. Err. adjusted for 272 clusters in area_code) ------------------------------------------------------------------------------ | Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .362956 . . . . . -------------+---------------------------------------------------------------- sigma_u | .5572325 sigma_e | .79466906 rho | .32962395 (fraction of variance due to u_i) ------------------------------------------------------------------------------ *-----------------------------------* FE without robust std errors *-----------------------------------* xtreg y, fe predict y_res3, res Fixed-effects (within) regression Number of obs = 17,301 Group variable: area_code Number of groups = 272 R-sq: Obs per group: within = . min = 6 between = 0.0163 avg = 63.6 overall = . max = 65 F(0,17029) = 0.00 corr(u_i, Xb) = . Prob > F = . ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .362956 .0060416 60.08 0.000 .3511139 .3747981 -------------+---------------------------------------------------------------- sigma_u | .5572325 sigma_e | .79466906 rho | .32962395 (fraction of variance due to u_i) ------------------------------------------------------------------------------ F test that all u_i=0: F(271, 17029) = 0.00 Prob > F = 1.0000 *--------------------------------------------* check that residuals are the same *--------------------------------------------* assert y_res3 == y_res2 assert y_res3 == y_res1
Comment