3
votes

I don't understand how R calculates the degrees of freedom in the case of panel data and fixed effects. I particular I have 2 doubts:

1) When fitting a Least Squares Dummy Variable model using the two alternative strategies of:

a) including N dummies and removing the constant

b) including N-1 dummies and keeping the constant

results in two different numbers of degrees of freedom in the F-statistics (in the former case I have 1 degree of freedom more than in the latter - which I believed was the correct number). Why?

2) When estimating a within model using the twoways effects (plm package) the degrees of freedom in the F-statistics are: NT-N-T+1. Why is there a +1?

1

1 Answers

1
votes

1) 1a and 1b both estimate the same model: The intercept left out in 1b is "replaced" by a dummy, i.e. the first dummy variable in 1b catches what the intercept catches in 1a. The F test for joint significance of the regressors is performed without the intercept. For model 1b, there is no way for plm to detect that you left out the intercept and replaced it by a dummy variable, hence the dummy variable is counted as a "regular" regressor. Here is a code example:

library("plm")
data("Grunfeld", package = "plm")
fe1 <- plm(inv ~ value + capital, data = Grunfeld, model = "within")
fe2 <- plm(inv ~ value + capital + factor(firm), data = Grunfeld, model = "pooling")
fe3 <- plm(inv ~ value + capital + factor(firm) - 1, data = Grunfeld, model = "pooling")
summary(fe1)$fstatistic
summary(fe2)$fstatistic
summary(fe3)$fstatistic

2) This is rather a question about statistics: There is +1 due to the whole dummy coding concept: You cannot have a dummy for all individuals and for all time periods in the same model as that would cause linear dependence. You need to drop one of the dummy variables for the individuals or for the time periods. Here is a code example which shows there is no dummy for the first individual (firm = 1):

library("plm")
data("Grunfeld", package = "plm")
fe4 <- plm(inv ~ value + capital + factor(firm) + factor(year), data = Grunfeld, model = "pooling")
summary(fe4)
### [...]
### Coefficients:
###                     Estimate  Std. Error t-value  Pr(>|t|)    
###     (Intercept)       -86.900230   56.046633 -1.5505 0.1228925    
###     value               0.117716    0.013751  8.5604 6.653e-15 ***
###     capital             0.357916    0.022719 15.7540 < 2.2e-16 ***
###     factor(firm)2     207.054240   35.172748  5.8868 2.067e-08 ***
###     factor(firm)3    -135.230800   35.708975 -3.7870 0.0002116 ***
###     factor(firm)4      95.353842   50.722116  1.8799 0.0618390 .  
###     factor(firm)5      -5.438595   57.830520 -0.0940 0.9251859    
###     factor(firm)6     102.888642   54.173879  1.8992 0.0592379 .  
###     factor(firm)7      51.466610   58.179220  0.8846 0.3776174    
###     factor(firm)8      67.490515   50.970927  1.3241 0.1872585    
###     factor(firm)9      30.217556   55.723069  0.5423 0.5883394    
###     factor(firm)10    126.837123   58.525451  2.1672 0.0316183 *  
###     factor(year)1936  -19.197405   23.675862 -0.8108 0.4185963    
###     factor(year)1937  -40.690009   24.695410 -1.6477 0.1012774    
###     factor(year)1938  -39.226404   23.235936 -1.6882 0.0932215 .  
###     factor(year)1939  -69.470288   23.656074 -2.9367 0.0037802 ** 
###     factor(year)1940  -44.235085   23.809795 -1.8579 0.0649297 .  
###     factor(year)1941  -18.804463   23.694000 -0.7936 0.4285190    
###     factor(year)1942  -21.139792   23.381630 -0.9041 0.3672189    
###     factor(year)1943  -42.977623   23.552866 -1.8247 0.0698076 .  
###     factor(year)1944  -43.098772   23.610197 -1.8254 0.0697014 .  
###     factor(year)1945  -55.683040   23.895615 -2.3303 0.0209739 *  
###     factor(year)1946  -31.169284   24.115984 -1.2925 0.1979574    
###     factor(year)1947  -39.392242   23.783682 -1.6563 0.0995223 .  
###     factor(year)1948  -43.716514   23.969654 -1.8238 0.0699446 .  
###     factor(year)1949  -73.495099   24.182919 -3.0391 0.0027500 ** 
###     factor(year)1950  -75.896112   24.345526 -3.1175 0.0021445 ** 
###     factor(year)1951  -62.480912   24.864254 -2.5129 0.0129115 *  
###     factor(year)1952  -64.632341   25.349502 -2.5496 0.0116721 *  
###     factor(year)1953  -67.717966   26.611085 -2.5447 0.0118315 *  
###     factor(year)1954  -93.526221   27.107864 -3.4502 0.0007076 ***
###     [...]