11 CHAPTER 11: PANEL DATA

11.1 Pooled REgression (Page 543)

library("foreign") 
library("plm")

data = read.dta("Dataset/panelx.dta")
data=na.omit(data)
data = pdata.frame(data, index=c("firm_ident", "year"))
pdim(data)
## Unbalanced Panel: n = 1734, T = 1-11, N = 8856
pooled = plm(return~beta, model="pooling", data=data)
summary(pooled)
## Pooling Model
## 
## Call:
## plm(formula = return ~ beta, data = data, model = "pooling")
## 
## Unbalanced Panel: n = 1734, T = 1-11, N = 8856
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -1.0073393 -0.0133705 -0.0017671  0.0201393  0.7041667 
## 
## Coefficients:
##               Estimate Std. Error t-value Pr(>|t|)
## (Intercept) 0.00184254 0.00307461  0.5993    0.549
## beta        0.00045439 0.00273471  0.1662    0.868
## 
## Total Sum of Squares:    24.205
## Residual Sum of Squares: 24.204
## R-Squared:      3.1181e-06
## Adj. R-Squared: -0.00010982
## F-statistic: 0.0276078 on 1 and 8854 DF, p-value: 0.86804

11.2 Fixed Effects (Page 544)

within <- plm(return~beta, model="within", data=data)
summary(within)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = return ~ beta, data = data, model = "within")
## 
## Unbalanced Panel: n = 1734, T = 1-11, N = 8856
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -0.891228 -0.015834  0.000000  0.016408  0.653811 
## 
## Coefficients:
##        Estimate Std. Error t-value Pr(>|t|)   
## beta -0.0118931  0.0041139 -2.8909 0.003852 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    18.371
## Residual Sum of Squares: 18.35
## R-Squared:      0.0011723
## Adj. R-Squared: -0.24205
## F-statistic: 8.35756 on 1 and 7121 DF, p-value: 0.0038525

11.3 F-Test, Lagrange Multiplier Test (Page 545)

pFtest(within, pooled)  # F-test for individual (fixed) effects
## 
##  F test for individual effects
## 
## data:  return ~ beta
## F = 1.3111, df1 = 1733, df2 = 7121, p-value = 9.795e-14
## alternative hypothesis: significant effects
plmtest(pooled, effect="individual") # null hypothesis: No individual effects
## 
##  Lagrange Multiplier Test - (Honda)
## 
## data:  return ~ beta
## normal = 1.2444, p-value = 0.1067
## alternative hypothesis: significant effects
plmtest(pooled, effect="time")   # null hypothesis: No time effects
## 
##  Lagrange Multiplier Test - time effects (Honda)
## 
## data:  return ~ beta
## normal = 122.62, p-value < 2.2e-16
## alternative hypothesis: significant effects
plmtest(pooled, effect="twoways") # null hypothesis: No individual or time effects
## 
##  Lagrange Multiplier Test - two-ways effects (Honda)
## 
## data:  return ~ beta
## normal = 87.588, p-value < 2.2e-16
## alternative hypothesis: significant effects

11.4 Random Effects (Page 546)

random = plm(return~beta, model="random", data=data)
summary(random)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = return ~ beta, data = data, model = "random")
## 
## Unbalanced Panel: n = 1734, T = 1-11, N = 8856
## 
## Effects:
##                     var   std.dev share
## idiosyncratic 0.0025768 0.0507625 0.944
## individual    0.0001529 0.0123657 0.056
## theta:
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.02841 0.12183 0.19262 0.16455 0.22215 0.22215 
## 
## Residuals:
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -0.98141 -0.01314 -0.00156  0.00031  0.01972  0.69480 
## 
## Coefficients:
##               Estimate Std. Error z-value Pr(>|z|)
## (Intercept)  0.0032809  0.0032887  0.9976   0.3185
## beta        -0.0014994  0.0029132 -0.5147   0.6068
## 
## Total Sum of Squares:    23.117
## Residual Sum of Squares: 23.125
## R-Squared:      0.00048503
## Adj. R-Squared: 0.00037214
## Chisq: 0.264896 on 1 DF, p-value: 0.60678
phtest(random, within)
## 
##  Hausman Test
## 
## data:  return ~ beta
## chisq = 12.804, df = 1, p-value = 0.0003459
## alternative hypothesis: one model is inconsistent

11.5 Page 556

data = read.dta("Dataset/macro.dta")

Y <- as.matrix(data[c("USTB10Y", "USTB1Y", "USTB3M", "USTB3Y", "USTB5Y", "USTB6M")])
purtest(Y, test = "levinlin", exo = "intercept", lags = "SIC", pmax = 5)
## 
##  Levin-Lin-Chu Unit-Root Test (ex. var.: Individual Intercepts)
## 
## data:  Y
## z = 1.4794, p-value = 0.9305
## alternative hypothesis: stationarity
purtest(Y, test = "madwu", exo = "intercept", lags = "SIC", pmax = 5)
## 
##  Maddala-Wu Unit-Root Test (ex. var.: Individual Intercepts)
## 
## data:  Y
## chisq = 3.2849, df = 12, p-value = 0.9932
## alternative hypothesis: stationarity
purtest(Y, test = "ips", exo = "intercept", lags = "SIC", pmax = 5)
## 
##  Im-Pesaran-Shin Unit-Root Test (ex. var.: Individual Intercepts)
## 
## data:  Y
## Wtbar = 1.5458, p-value = 0.9389
## alternative hypothesis: stationarity