I am running fixed effects regressions using the plm
package.
Why and how does the order of the ID code have an impact on the regression?
I used these codes for running the regressions, which only differ between the order of the ID code Company
and Year
.
The code:
MV_Year <- plm (MVlog ~ LEV + Size + DY + RDlog
, data=Values, model="within", index= c("Year","Company"))
MV_Company <- plm (MVlog ~ LEV + Size + DY + RDlog,
data=Values, model="within", index= c("Company", "Year"))
The corresponding outputs: MV_Year:
Oneway (individual) effect Within Model
Call:
plm(formula = MVlog ~ LEV + Size + DY + RDlog, data = Values,
model = "within", index = c("Year", "Company"))
Unbalanced Panel: n = 17, T = 557-4280, N = 29890
Residuals:
Min. 1st Qu. Median 3rd Qu. Max.
-5.250901 -0.457100 0.015763 0.476140 6.006483
Coefficients:
Estimate Std. Error t-value Pr(>|t|)
LEV -1.95485031 0.04060539 -48.143 < 2e-16 ***
Size 0.75233709 0.00314849 238.952 < 2e-16 ***
DY -0.00033192 0.00013482 -2.462 0.01382 *
RDlog 0.13148626 0.00300509 43.755 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Total Sum of Squares: 102610
Residual Sum of Squares: 17568
R-Squared: 0.82879
Adj. R-Squared: 0.82868
F-statistic: 36148 on 4 and 29869 DF, p-value: < 2.22e-16
MV_Company
Oneway (individual) effect Within Model
Call:
plm(formula = MVlog ~ LEV + Size + DY + RDlog, data = Values,
model = "within", index = c("Company", "Year"))
Unbalanced Panel: n = 5911, T = 1-17, N = 29890
Residuals:
Min. 1st Qu. Median 3rd Qu. Max.
-4.35967 -0.38711 0.00000 0.40528 5.48624
Coefficients:
Estimate Std. Error t-value Pr(>|t|)
LEV -1.88958140 0.04392991 -43.0135 < 2e-16 ***
Size 0.74650676 0.00375926 198.5782 < 2e-16 ***
DY -0.00034308 0.00014585 -2.3524 0.01866 *
RDlog 0.13904360 0.00331886 41.8950 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Total Sum of Squares: 58168
Residual Sum of Squares: 12747
R-Squared: 0.78085
Adj. R-Squared: 0.72679
F-statistic: 21356.2 on 4 and 23975 DF, p-value: < 2.22e-16
Why do the outputs have these small differences between the different estimates and R^2?