5.5 Panel Data

5.5.1 Structure

library(plm)
## Loading required package: Formula
## 
## Attaching package: 'plm'
## The following object is masked from 'package:data.table':
## 
##     between
pdfwagepan <- pdata.frame(wagepan,index=c('nr','year'))

5.5.2 Pooled OLS

model1 <- plm(lwage~educ+exper,model="pooling",data=pdfwagepan)
summary(model1)
## Pooling Model
## 
## Call:
## plm(formula = lwage ~ educ + exper, data = pdfwagepan, model = "pooling")
## 
## Balanced Panel: n = 545, T = 8, N = 4360
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -5.332208 -0.259202  0.034226  0.308498  2.514500 
## 
## Coefficients:
##              Estimate Std. Error t-value Pr(>|t|)    
## (Intercept) 0.0120541  0.0626042  0.1925   0.8473    
## educ        0.1078844  0.0045477 23.7228   <2e-16 ***
## exper       0.0564295  0.0028102 20.0806   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    1236.5
## Residual Sum of Squares: 1059.8
## R-Squared:      0.14289
## Adj. R-Squared: 0.1425
## F-statistic: 363.191 on 2 and 4357 DF, p-value: < 2.22e-16

5.5.3 Fixed effects (Within groups)

model2 <- plm(lwage~educ+exper,model="within",data=pdfwagepan)
summary(model2)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = lwage ~ educ + exper, data = pdfwagepan, model = "within")
## 
## Balanced Panel: n = 545, T = 8, N = 4360
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -4.148013 -0.124958  0.013642  0.161298  1.505558 
## 
## Coefficients:
##        Estimate Std. Error t-value  Pr(>|t|)    
## exper 0.0633278  0.0023454      27 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    572.05
## Residual Sum of Squares: 480.25
## R-Squared:      0.16047
## Adj. R-Squared: 0.040508
## F-statistic: 729.027 on 1 and 3814 DF, p-value: < 2.22e-16
summary(c(fixef(model2)))
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -0.01496  0.94959  1.23988  1.23659  1.52607  2.88920
model3 <- plm(lwage~educ+exper,model="within",effect="time",data=pdfwagepan) 
summary(model3)
## Oneway (time) effect Within Model
## 
## Call:
## plm(formula = lwage ~ educ + exper, data = pdfwagepan, effect = "time", 
##     model = "within")
## 
## Balanced Panel: n = 545, T = 8, N = 4360
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -5.351880 -0.262312  0.028272  0.305250  2.460275 
## 
## Coefficients:
##        Estimate Std. Error t-value  Pr(>|t|)    
## educ  0.0969287  0.0052413 18.4934 < 2.2e-16 ***
## exper 0.0364743  0.0055347  6.5901  4.92e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    1143.6
## Residual Sum of Squares: 1054.4
## R-Squared:      0.077944
## Adj. R-Squared: 0.076037
## F-statistic: 183.859 on 2 and 4350 DF, p-value: < 2.22e-16
model4 <- plm(lwage~educ+exper+as.factor(year),model="within",data=pdfwagepan)
summary(model4)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = lwage ~ educ + exper + as.factor(year), data = pdfwagepan, 
##     model = "within")
## 
## Balanced Panel: n = 545, T = 8, N = 4360
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -4.157497 -0.124763  0.010873  0.160003  1.503777 
## 
## Coefficients: (1 dropped because of singularities)
##                       Estimate Std. Error t-value Pr(>|t|)    
## exper               0.06757176 0.00306957 22.0135  < 2e-16 ***
## as.factor(year)1981 0.05181844 0.02012850  2.5744  0.01008 *  
## as.factor(year)1982 0.04304658 0.01916944  2.2456  0.02479 *  
## as.factor(year)1983 0.02307119 0.01867145  1.2356  0.21667    
## as.factor(year)1984 0.02653105 0.01867145  1.4209  0.15542    
## as.factor(year)1985 0.00807450 0.01916944  0.4212  0.67362    
## as.factor(year)1986 0.00081119 0.02012850  0.0403  0.96786    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    572.05
## Residual Sum of Squares: 479.09
## R-Squared:      0.16251
## Adj. R-Squared: 0.041334
## F-statistic: 105.563 on 7 and 3808 DF, p-value: < 2.22e-16

5.5.4 Between-group effect

5.5.5 Simpson’s paradox

5.5.6 Arellano correction

## HAC estimator. Note: n must be >> T
summary(model2,plm::vcovHC)
## Oneway (individual) effect Within Model
## 
## Note: Coefficient variance-covariance matrix supplied: plm::vcovHC
## 
## Call:
## plm(formula = lwage ~ educ + exper, data = pdfwagepan, model = "within")
## 
## Balanced Panel: n = 545, T = 8, N = 4360
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -4.148013 -0.124958  0.013642  0.161298  1.505558 
## 
## Coefficients:
##        Estimate Std. Error t-value  Pr(>|t|)    
## exper 0.0633278  0.0032464  19.507 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    572.05
## Residual Sum of Squares: 480.25
## R-Squared:      0.16047
## Adj. R-Squared: 0.040508
## F-statistic: 380.531 on 1 and 544 DF, p-value: < 2.22e-16

5.5.7 Large T panels