Wooldridge's test for unobserved individual effects
data: formula
z = 13.713, p-value < 2.2e-16
alternative hypothesis: unobserved effect
Kiểm định lựa chọn FEM, REM
Nguyên tắc kiểm định lựa chọn mô hình FEM và REM, lưu ý rằng, mô hình FEM là mô hình đặt ở trước. Nguyên nhân là: Nếu mô hình FEM mà phù hợp thì REM ước lượng không còn nhất quán nữa.
phtest(FEM3, REM3)
Hausman Test
data: reg
chisq = 150.46, df = 2, p-value < 2.2e-16
alternative hypothesis: one model is inconsistent
Kiểm định Tương quan chuỗi
pbltest(REM3)
Baltagi and Li two-sided LM test
data: formula(x$formula)
chisq = 410.1, df = 1, p-value < 2.2e-16
alternative hypothesis: AR(1)/MA(1) errors in RE panel model
# pbltest(FEM3) Không sử dụng được trong FEM
bgtest(FEM3)
Breusch-Godfrey test for serial correlation of order up to 1
data: FEM3
LM test = 1860.5, df = 1, p-value < 2.2e-16
Heteroskedasticity
lmtest::bptest(POOLED_OLS)
studentized Breusch-Pagan test
data: POOLED_OLS
BP = 40.252, df = 4, p-value = 3.838e-08
lmtest::bptest(FEM3)
studentized Breusch-Pagan test
data: FEM3
BP = 40.252, df = 4, p-value = 3.838e-08
lmtest::bptest(REM3)
studentized Breusch-Pagan test
data: REM3
BP = 40.252, df = 4, p-value = 3.838e-08
Tests for Cross-sectional Dependence
pcdtest(FEM3)
Pesaran CD test for cross-sectional dependence in panels
data: lwage ~ exp + exp2 + wks + ed
z = 18.476, p-value < 2.2e-16
alternative hypothesis: cross-sectional dependence
pcdtest(REM3)
Pesaran CD test for cross-sectional dependence in panels
data: lwage ~ exp + exp2 + wks + ed
z = 351.52, p-value < 2.2e-16
alternative hypothesis: cross-sectional dependence
Khắc phục hay phát triển mô hình.
Ước lượng tổng quát GLS
* Mô hình POOL và REM sử dụng chung 1 kiểu ước lượng GLS. * Điểm hạn chế của ước lượng này là chỉ chọn được tích hợp ảnh hưởng của “individual” hoặc “time”. * Muốn phát triển thêm thì cần mở rộng các hướng ở các mô hình khác như: dữ liệu bảng theo thời gian (Dùng trong long-panel), hoặc các mô hình khác có liên quan. Nếu không chúng ta chỉ cần hiệu chỉnh sai số của mô hình được chọn.
Pooled_GLSid <-pggls(reg,Pdata, model="pooling", effect="individual")# Pooled_GLSt <- pggls(reg,Pdata, model="pooling", effect="time") : ưu tiên sử dụng individual hơn time. Nếu dùng time thường dữ liệu thuộc dạng Long-panel, khi đó nên chuyển sang các dạng mô hình long-panel.
Xử lý khi mô hình REM có hiện tượng tự tương quan
library(nlme)
Attaching package: 'nlme'
The following object is masked from 'package:dplyr':
collapse
# AR(1) errors within each idREM3_robust <-gls(lwage ~ exp + exp2 + wks + ed,Pdata,correlation =corAR1(form =~1|id))summary(REM3_robust)
Generalized least squares fit by REML
Model: lwage ~ exp + exp2 + wks + ed
Data: Pdata
AIC BIC logLik
-1035.995 -991.6621 524.9975
Correlation Structure: AR(1)
Formula: ~1 | id
Parameter estimate(s):
Phi
0.9005671
Coefficients:
Value Std.Error t-value p-value
(Intercept) 4.676658 0.09315787 50.20143 0.0000
exp 0.067315 0.00438772 15.34157 0.0000
exp2 -0.000900 0.00009680 -9.29954 0.0000
wks 0.000073 0.00060226 0.12077 0.9039
ed 0.086918 0.00566914 15.33177 0.0000
Correlation:
(Intr) exp exp2 wks
exp -0.441
exp2 0.326 -0.954
wks -0.291 -0.029 0.031
ed -0.829 0.036 0.024 0.001
Standardized residuals:
Min Q1 Med Q3 Max
-5.5168482 -0.6209991 0.0109206 0.7137432 5.5267909
Residual standard error: 0.4329754
Degrees of freedom: 4165 total; 4160 residual
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
exp2 -4.0505e-04 8.3219e-05 -4.8673 1.18e-06 ***
wks 6.7996e-04 8.7958e-04 0.7730 0.4395
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Heteroskedasticity consistent coefficients, type 3coeftest(model, vcovHC(model, type ="HC3"))
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
exp2 -4.0505e-04 8.3296e-05 -4.8628 1.207e-06 ***
wks 6.7996e-04 8.8458e-04 0.7687 0.4421
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# The following shows the HC standard errors of the coefficientst(sapply(c("HC0", "HC1", "HC2", "HC3", "HC4"), function(x) sqrt(diag(vcovHC(model, type = x)))))
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.3958e+00 1.1568e-01 37.9990 < 2.2e-16 ***
exp 6.6382e-02 4.1368e-03 16.0467 < 2.2e-16 ***
exp2 -6.4421e-04 8.9574e-05 -7.1919 7.543e-13 ***
wks 9.2658e-04 9.1953e-04 1.0077 0.3137
ed 9.7363e-02 6.6234e-03 14.6999 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Heteroskedasticity consistent coefficients, type 3coeftest(model, vcovHC(model, type ="HC3"))
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.3958e+00 1.1600e-01 37.8956 < 2.2e-16 ***
exp 6.6382e-02 4.1447e-03 16.0159 < 2.2e-16 ***
exp2 -6.4421e-04 8.9764e-05 -7.1767 8.418e-13 ***
wks 9.2658e-04 9.2551e-04 1.0012 0.3168
ed 9.7363e-02 6.6339e-03 14.6765 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# The following shows the HC standard errors of the coefficientst(sapply(c("HC0", "HC1", "HC2", "HC3", "HC4"), function(x) sqrt(diag(vcovHC(model, type = x)))))