9.4.1 Panel or OLS
It is important to test if the panel regression model is signficantly different from the OLS model. In other words, do we need a panel model or OLS model is good enough?
The function in the plm package can be used to test a fitted fixed effect model against a fitted OLS model to check which regression is a better choice.
# Simple OLS (without the intercept) using pooling = plm(inv ~ value + capital - 1, data = pdata1, model = "pooling") ols1 # summary of results summary(ols1)
Pooling Model Call: plm(formula = inv ~ value + capital - 1, data = pdata1, model = "pooling") Balanced Panel: n = 10, T = 20, N = 200 Residuals: Min. 1st Qu. Median Mean 3rd Qu. Max. -270.32 -51.32 -23.69 -21.04 -4.51 476.74 Coefficients: Estimate Std. Error t-value Pr(>|t|) value 0.1076384 0.0058256 18.4769 < 2.2e-16 *** capital 0.1832062 0.0242750 7.5471 1.587e-12 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Total Sum of Squares: 9359900 Residual Sum of Squares: 1935600 R-Squared: 0.8113 Adj. R-Squared: 0.81035 F-statistic: 597.659 on 2 and 198 DF, p-value: < 2.22e-16
- The above OLS model can now be tested against the fixed effect model to check for the best fit.
# Testing for the better model, null: OLS is a better pFtest(fe1, ols1)
F test for individual effects data: inv ~ value + capital F = 50.714, df1 = 10, df2 = 188, p-value < 2.2e-16 alternative hypothesis: significant effects
- Similar to the fixed effect and OLS comparison one can also check if the random effects are needed using one of the available Langrange multiplier tests (Breusch and Pagan (1980) test here) test in function as illustrated below
# plmtest using the Breuch-Pagan method plmtest(ols1, type = c("bp"))
Lagrange Multiplier Test - (Breusch-Pagan) for balanced panels data: inv ~ value + capital - 1 chisq = 727.84, df = 1, p-value < 2.2e-16 alternative hypothesis: significant effects
- A p-value<0.05 in the above test indicates that the Random Effect model is required.
9.4.2 Fixed Effect or Random Effect
- The Hausman test (Hausman (1978)) is the standard approach to test for model specification which can be computed using the function in the plm package.
# phtest using the fitted models in fe1 and re1 phtest(fe1, re1)
Hausman Test data: inv ~ value + capital chisq = 2.3304, df = 2, p-value = 0.3119 alternative hypothesis: one model is inconsistent
- A p-value<0.05 suggests that the fixed effect model is appropriate so in this case the random effect model should be used.