繁体   English   中英

在 R 中使用固定效应 model 检查多重共线性

[英]Checking for multicollinearity using fixed effects model in R

来自德国社区的 Guten Tag :)

我正在处理时间和公司的面板数据和固定效果(= FE)。 我想通过使用方差膨胀因子(= VIF)检查我的 model 的多重共线性,但 R 给了我一条警告消息,而不是 Z78E6221F6393D1356681DB398F14CE6D。

我如何解释此警告消息,是否有解决方案?

我想过自己计算VIF:

VIF = 1 / (1 - R-squared)
VIF = 1 / (1 - 0.26632)
VIF = 1.36299

这是在解决问题吗?

当没有 FE 时,如何像以前一样为每个变量获取 VIF?

提前致谢: :)

代码 1:

### Creating a baseline formular ###
FORMULAR.PLM.BASELINE <- StockPrice ~ EPS + BookValuePS + AssetsTotal.LOG + LeverageRatio + AvgAnnualDividendyield + Dummy.ESG + Dummy.Sektor

### Creating FE-model ###
MOD.FE <- plm(FORMULAR.PLM.BASELINE, data = PD.Datensatz_so, model = "within", effect = "twoways")
summary(MOD.FE)

结果 1:

Twoways effects Within Model

Call:
plm(formula = FORMULAR.PLM.BASELINE, data = PD.Datensatz_so, 
    effect = "twoways", model = "within")

Balanced Panel: n = 17, T = 7, N = 119

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-30.90756  -7.42737  -0.66878   6.97856  37.45463 

Coefficients:
                         Estimate Std. Error t-value Pr(>|t|)
EPS                       0.33624    0.26725  1.2581   0.2117
BookValuePS               0.46793    0.32815  1.4260   0.1574
AssetsTotal.LOG          14.21471   12.38404  1.1478   0.2542
LeverageRatio            38.60903   40.14368  0.9618   0.3388
AvgAnnualDividendyield -402.35998  249.04744 -1.6156   0.1098
Dummy.ESGbefriedigend    -3.17031   14.06732 -0.2254   0.8222
Dummy.ESGgut            -21.72112   16.71391 -1.2996   0.1971
Dummy.ESGexzellent      -21.21610   17.62499 -1.2038   0.2319

Total Sum of Squares:    25242
Residual Sum of Squares: 18519

R平方:0.26632

Adj. R-Squared: 0.016197
F-statistic: 3.99284 on 8 and 88 DF, p-value: 0.00044688

代码 2:

### Checking for multicollinearity ###
vif(MOD.FE)
1/vif(MOD.FE)

结果 2:

# Error in R[subs, subs] : subscript out of bounds
# In addition: Warning message:
#  In vif.default(MOD.FE) : No intercept: vifs may not be sensible.

数据:

structure(list(Company = c("AIR PRODUCTS & CHEMICALS INC", "AIR PRODUCTS & CHEMICALS INC", 
"AIR PRODUCTS & CHEMICALS INC", "AIR PRODUCTS & CHEMICALS INC", 
"AIR PRODUCTS & CHEMICALS INC", "AIR PRODUCTS & CHEMICALS INC", 
"AIR PRODUCTS & CHEMICALS INC", "HESS CORP", "HESS CORP", "HESS CORP", 
"HESS CORP", "HESS CORP", "HESS CORP", "HESS CORP", "APACHE CORP", 
"APACHE CORP", "APACHE CORP", "APACHE CORP", "APACHE CORP", "APACHE CORP", 
"APACHE CORP", "AVERY DENNISON CORP", "AVERY DENNISON CORP", 
"AVERY DENNISON CORP", "AVERY DENNISON CORP", "AVERY DENNISON CORP", 
"AVERY DENNISON CORP", "AVERY DENNISON CORP", "BALL CORP", "BALL CORP", 
"BALL CORP", "BALL CORP", "BALL CORP", "BALL CORP", "BALL CORP", 
"CHEVRON CORP", "CHEVRON CORP", "CHEVRON CORP", "CHEVRON CORP", 
"CHEVRON CORP", "CHEVRON CORP", "CHEVRON CORP", "ECOLAB INC", 
"ECOLAB INC", "ECOLAB INC", "ECOLAB INC", "ECOLAB INC", "ECOLAB INC", 
"ECOLAB INC", "EXXON MOBIL CORP", "EXXON MOBIL CORP", "EXXON MOBIL CORP", 
"EXXON MOBIL CORP", "EXXON MOBIL CORP", "EXXON MOBIL CORP", "EXXON MOBIL CORP", 
"FMC CORP", "FMC CORP", "FMC CORP", "FMC CORP", "FMC CORP", "FMC CORP", 
"FMC CORP", "HALLIBURTON CO", "HALLIBURTON CO", "HALLIBURTON CO", 
"HALLIBURTON CO", "HALLIBURTON CO", "HALLIBURTON CO", "HALLIBURTON CO", 
"HELMERICH & PAYNE", "HELMERICH & PAYNE", "HELMERICH & PAYNE", 
"HELMERICH & PAYNE", "HELMERICH & PAYNE", "HELMERICH & PAYNE", 
"HELMERICH & PAYNE", "HOLLYFRONTIER CORP", "HOLLYFRONTIER CORP", 
"HOLLYFRONTIER CORP", "HOLLYFRONTIER CORP", "HOLLYFRONTIER CORP", 
"HOLLYFRONTIER CORP", "HOLLYFRONTIER CORP", "INTL FLAVORS & FRAGRANCES", 
"INTL FLAVORS & FRAGRANCES", "INTL FLAVORS & FRAGRANCES", "INTL FLAVORS & FRAGRANCES", 
"INTL FLAVORS & FRAGRANCES", "INTL FLAVORS & FRAGRANCES", "INTL FLAVORS & FRAGRANCES", 
"INTL PAPER CO", "INTL PAPER CO", "INTL PAPER CO", "INTL PAPER CO", 
"INTL PAPER CO", "INTL PAPER CO", "INTL PAPER CO", "MARATHON OIL CORP", 
"MARATHON OIL CORP", "MARATHON OIL CORP", "MARATHON OIL CORP", 
"MARATHON OIL CORP", "MARATHON OIL CORP", "MARATHON OIL CORP", 
"NEWMONT CORP", "NEWMONT CORP", "NEWMONT CORP", "NEWMONT CORP", 
"NEWMONT CORP", "NEWMONT CORP", "NEWMONT CORP", "NUCOR CORP", 
"NUCOR CORP", "NUCOR CORP", "NUCOR CORP", "NUCOR CORP", "NUCOR CORP", 
"NUCOR CORP"), Year = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 
3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 
5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 
7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 
2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 
4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L
), .Label = c("2011", "2012", "2013", "2014", "2015", "2016", 
"2017"), class = "factor"), ggroup = c(1510, 1510, 1510, 1510, 
1510, 1510, 1510, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 
1010, 1010, 1010, 1010, 1010, 1010, 1510, 1510, 1510, 1510, 1510, 
1510, 1510, 1510, 1510, 1510, 1510, 1510, 1510, 1510, 1010, 1010, 
1010, 1010, 1010, 1010, 1010, 1510, 1510, 1510, 1510, 1510, 1510, 
1510, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1510, 1510, 1510, 
1510, 1510, 1510, 1510, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 
1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 
1010, 1010, 1010, 1510, 1510, 1510, 1510, 1510, 1510, 1510, 1510, 
1510, 1510, 1510, 1510, 1510, 1510, 1010, 1010, 1010, 1010, 1010, 
1010, 1010, 1510, 1510, 1510, 1510, 1510, 1510, 1510, 1510, 1510, 
1510, 1510, 1510, 1510, 1510), gvkey = structure(c(1L, 1L, 1L, 
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 
12L, 12L, 12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 
14L, 14L, 14L, 14L, 14L, 14L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 
16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 17L, 17L, 
17L), .Label = c("1209", "1380", "1678", "1913", "1988", "2991", 
"4213", "4503", "4510", "5439", "5581", "5667", "6078", "6104", 
"7017", "7881", "8030"), class = "factor"), StockPrice = c(85.19, 
84.02, 111.78, 144.23, 130.11, 143.82, 164.08, 56.8, 52.96, 83, 
73.82, 48.48, 62.29, 47.47, 90.58, 78.5, 85.94, 62.67, 44.47, 
63.47, 42.22, 28.68, 34.92, 50.19, 51.88, 62.66, 70.22, 114.86, 
17.86, 22.38, 25.83, 34.09, 36.37, 37.54, 37.85, 106.4, 108.14, 
124.91, 112.18, 89.96, 117.7, 125.19, 57.81, 71.9, 104.27, 104.52, 
114.38, 117.22, 134.18, 84.76, 86.55, 101.2, 92.45, 77.95, 90.26, 
83.64, 43.02, 58.52, 75.46, 57.03, 39.13, 56.56, 94.66, 34.51, 
34.69, 50.75, 39.33, 34.04, 54.09, 48.87, 58.36, 56.01, 84.08, 
67.42, 53.55, 77.4, 64.64, 23.4, 46.55, 49.69, 37.48, 39.89, 
32.76, 51.22, 52.42, 66.54, 85.98, 101.36, 119.64, 117.83, 152.61, 
29.6, 39.84, 49.03, 53.58, 37.7, 53.06, 57.94, 29.27, 30.66, 
35.3, 28.29, 12.59, 17.31, 16.93, 60.01, 46.44, 23.03, 18.9, 
17.99, 34.07, 37.52, 39.57, 43.16, 53.38, 49.05, 40.3, 59.52, 
63.58), EPS = c(5.75, 5.53, 4.74, 4.66, 5.95, 2.92, 13.76, 5.01, 
5.93, 15.53, 8.11, -10.68, -19.37, -12.93, 11.94, 5.14, 5.65, 
-14.07, -61.16, -3.71, 3.42, 1.78, 1.65, 2.49, 2.69, 3.01, 3.63, 
3.2, 1.34, 1.3, 1.39, 1.7, 1.02, 0.83, 1.07, 13.54, 13.42, 11.18, 
10.21, 2.46, -0.27, 4.88, 1.95, 2.41, 3.23, 4.01, 3.38, 4.2, 
5.21, 8.43, 9.7, 7.37, 7.6, 3.85, 1.88, 4.63, 2.58, 3.02, 2.17, 
2.31, 3.66, 1.56, 3.99, 3.09, 2.85, 2.37, 4.13, -0.79, -6.69, 
-0.53, 4.07, 5.44, 6.93, 3.57, 3.92, -0.53, -1.18, 6.46, 8.41, 
3.67, 1.43, 3.92, -1.48, 4.57, 3.32, 3.13, 4.35, 5.12, 5.21, 
5.09, 3.74, 3.1, 1.82, 3.15, 1.3, 2.25, 2.2, 5.19, 4.15, 2.24, 
2.49, 4.48, -3.26, -2.53, -6.73, 0.74, 3.65, -4.94, 1.02, 0.43, 
-1.18, -0.18, 2.45, 1.59, 1.53, 2.23, 1.12, 2.49, 4.12), BookValuePS = c(27.21, 
30.67, 33.58, 34.63, 33.73, 32.72, 46.27, 54.46, 61.75, 75.99, 
77.68, 67.77, 45.92, 35.08, 75.5, 80.54, 84.55, 67.54, 6.79, 
16.46, 19.46, 15.53, 12.13, 17.21, 11.53, 10.61, 10.48, 11.88, 
3.69, 3.6, 4.11, 3.73, 4.56, 10.85, 11.25, 61.1, 70, 77.78, 82.3, 
81.76, 77.72, 78.67, 23.92, 20.78, 24.49, 24.38, 23.31, 23.59, 
26.31, 31.7, 35.84, 39.36, 40.76, 40.72, 40.12, 44.1, 8.74, 10.75, 
11.24, 11.48, 13.95, 14.62, 19.97, 14.38, 17.02, 15.12, 19.18, 
18.13, 10.93, 9.57, 30.66, 35.9, 41.81, 45.37, 45.45, 42.23, 
38.38, 32.84, 29.49, 29.94, 28, 27.84, 6.58, 30.49, 13.73, 15.4, 
17.99, 18.76, 19.77, 20.42, 21.3, 15.32, 14.45, 18.3, 11.89, 
9.32, 10.65, 15.79, 24.16, 25.9, 27.44, 30.91, 27.4, 20.71, 13.77, 
26.11, 27.77, 20.35, 20.63, 22.18, 20.18, 19.9, 23.58, 24.02, 
23.96, 24.3, 23.14, 24.66, 27.31), ESGscore = c(84.2750015258789, 
81.9225006103516, 77.4024963378906, 80.1125030517578, 78.6449966430664, 
76.3775024414062, 79.2699966430664, 69.4899978637695, 65.8300018310547, 
64.4300003051758, 74.3000030517578, 75.7600021362305, 71.4599990844727, 
74.6900024414062, 55.8300018310547, 56.0900001525879, 57.5, 60.75, 
60.8800010681152, 67.379997253418, 71.9899978637695, 82.9000015258789, 
77.3899993896484, 76.9300003051758, 78.7399978637695, 76.2283325195312, 
74.2125015258789, 68.3600006103516, 64.4100036621094, 65.6600036621094, 
63.75, 67.7300033569336, 67.5699996948242, 74.4300003051758, 
68.5699996948242, 86.5100021362305, 84.3099975585938, 82.6600036621094, 
82.3399963378906, 88.4100036621094, 90.0800018310547, 92.25, 
74.6999969482422, 72.3600006103516, 68.3899993896484, 67.9300003051758, 
65.629997253418, 74.9000015258789, 74.8600006103516, 81.6999969482422, 
79.370002746582, 79.0899963378906, 75.25, 81.9499969482422, 81.0199966430664, 
88.3399963378906, 59.8199996948242, 55.6500015258789, 52.2999992370605, 
51.8499984741211, 56.9199981689453, 66.620002746582, 65.3300018310547, 
85.9800033569336, 83.9499969482422, 85.1100006103516, 67.4300003051758, 
76.4400024414062, 69.9199981689453, 78.4599990844727, 19.0599994659424, 
17.5200004577637, 18.1200008392334, 23.5025005340576, 35.5349998474121, 
36.7350006103516, 41.1725006103516, 27.8700008392334, 33.7700004577637, 
37.6699981689453, 47.7599983215332, 50.2400016784668, 55.25, 
58.3800010681152, 70.7600021362305, 71.9800033569336, 75.1500015258789, 
75.1399993896484, 79.4100036621094, 70.1500015258789, 76.5299987792969, 
71.3399963378906, 80.1900024414062, 72.9899978637695, 66.9400024414062, 
73.8000030517578, 76.2399978637695, 72.0500030517578, 80.4700012207031, 
80.5100021362305, 79.6800003051758, 76.4300003051758, 78.6399993896484, 
77.2300033569336, 76.5899963378906, 81.6399993896484, 77.8600006103516, 
79.5100021362305, 85.9800033569336, 81.120002746582, 78.75, 80.7099990844727, 
59.8600006103516, 52.3400001525879, 54.9300003051758, 54.8899993896484, 
64.120002746582, 62.4900016784668, 61.7200012207031), LeverageRatio = c(0.594435561205841, 
0.617679355403529, 0.605486789891209, 0.585704565106127, 0.584301032659383, 
0.607893538666041, 0.453831624609765, 0.526880621422731, 0.514513938445248, 
0.421808485755719, 0.424412877806003, 0.433075010966516, 0.492225987910974, 
0.521893388715819, 0.466561641467023, 0.50435484136523, 0.458182585135552, 
0.536441950243066, 0.863814881647384, 0.722989475553977, 0.661709698020254, 
0.666478988304306, 0.690341393278699, 0.676354504930841, 0.755401139345263, 
0.766383635343921, 0.789486848203547, 0.796336317416944, 0.832646959442815, 
0.85152722608109, 0.846556170952766, 0.863545109551454, 0.872015950820485, 
0.787608977926173, 0.77045838429728, 0.420539064513973, 0.414014816595273, 
0.412369508931914, 0.417244930946599, 0.426101922939614, 0.440337129630342, 
0.416388895455584, 0.689339285962852, 0.654171637758199, 0.625987329478904, 
0.624183852632949, 0.629331005652438, 0.623511997043816, 0.618357519590785, 
0.53362009593659, 0.503099207597478, 0.498272819542802, 0.50099429745374, 
0.492778196806015, 0.493436548254086, 0.461735462056663, 0.668598911289985, 
0.661560602236253, 0.709695906149125, 0.713416346784009, 0.705069637526097, 
0.681119995202526, 0.70869946604795, 0.442581408117582, 0.424844947099599, 
0.535263319987681, 0.495440446650124, 0.581452005847003, 0.651518518518518, 
0.668247956946382, 0.346499145342847, 0.329672942621959, 0.290686407542856, 
0.272377520553529, 0.315234369479579, 0.33241919028586, 0.353323181006733, 
0.495472522128971, 0.413984333584541, 0.403422922342673, 0.401603334682229, 
0.373721043240805, 0.503861576091451, 0.497685035920943, 0.627590017963253, 
0.615704103314394, 0.560867296803568, 0.565457600575885, 0.572662204137801, 
0.595157943268954, 0.633783603720298, 0.754751231800837, 0.803937424190589, 
0.74292692210099, 0.821677590294241, 0.873017948801779, 0.869815564552407, 
0.807627643571365, 0.453253004367091, 0.482156007477483, 0.456934306569343, 
0.416289467107273, 0.425799263408746, 0.435871872386956, 0.468108304561148, 
0.530610759263303, 0.535480607082631, 0.590494265869811, 0.58765451918446, 
0.549281232626479, 0.490228709999525, 0.484073335602782, 0.486979724850567, 
0.460038216337232, 0.497097505794197, 0.502272882334361, 0.479531926496852, 
0.482388666486795, 0.448336979534749), AvgAnnualDividendyield = c(0.0266, 
0.0314, 0.0298, 0.0253, 0.0241, 0.025, 0.0245, 0.006, 0.009, 
0.01, 0.012, 0.016, 0.021, 0.025, 0.007, 0.01, 0.011, 0.011, 
0.018, 0.019, 0.019, 0.029, 0.028, 0.03, 0.023, 0.02, 0.023, 
0.019, 0.008, 0.01, 0.011, 0.009, 0.008, 0.007, 0.009, 0.031, 
0.033, 0.033, 0.035, 0.045, 0.043, 0.039, 0.013, 0.016, 0.008, 
0.011, 0.012, 0.013, 0.012, 0.023, 0.025, 0.027, 0.028, 0.035, 
0.037, 0.041, 0.011, 0.008, 0.01, 0.01, 0.015, 0.017, 0.01, 0.008, 
0.011, 0.011, 0.011, 0.018, 0.017, 0.015, 0.0043, 0.0055, 0.0131, 
0.0254, 0.0443, 0.0447, 0.0481, 0.054, 0.09, 0.068, 0.071, 0.03, 
0.045, 0.042, 0.019, 0.027, 0.014, 0.017, 0.017, 0.019, 0.019, 
0.037, 0.035, 0.029, 0.032, 0.036, 0.044, 0.036, 0.028, 0.023, 
0.021, 0.023, 0.03, 0.014, 0.014, 0.021, 0.027, 0.037, 0.01, 
0.005, 0.004, 0.007, 0.036, 0.036, 0.031, 0.029, 0.034, 0.031, 
0.026), AssetsTotal.LOG = c(9.56736426869569, 9.73753926605387, 
9.78976436754936, 9.78577886714304, 9.76641272417325, 9.80119459273923, 
9.82375142221191, 10.5747980384869, 10.6791589746007, 10.6632180372392, 
10.5604374447842, 10.4398347135322, 10.261895993101, 10.0481072421461, 
10.8599792861544, 11.0143083465337, 11.0290176185546, 10.9322494593032, 
9.84384369960861, 10.0221146762943, 9.99524597777567, 8.51171827041292, 
8.53803445653107, 8.43611330054631, 8.38027325164503, 8.3269282159168, 
8.38854128098197, 8.5442050446523, 8.89351782318383, 8.92360453139329, 
8.96441423278807, 8.93208043810331, 9.18778796750567, 9.69109846411978, 
9.75086071107721, 12.2523549056307, 12.3587164763448, 12.4441166319283, 
12.4913493273481, 12.4916387308594, 12.4687368650067, 12.4443254746449, 
9.81141616514545, 9.77407912202464, 9.88514535828826, 9.87646055234287, 
9.83315624388896, 9.81630520922804, 9.90160580268615, 12.7100307417182, 
12.7182823110683, 12.7565265916732, 12.7642388118431, 12.7271198504863, 
12.7077989961906, 12.7619414221787, 8.22777628167074, 8.38341031627978, 
8.56316036427592, 8.58307456052975, 8.7524075805257, 8.72246597631381, 
9.12764329007411, 10.072259391783, 10.2186631892968, 10.2827113494391, 
10.3809631966206, 10.5171043941393, 10.2035921449865, 10.1300253369184, 
8.51797111141425, 8.65191374487273, 8.74270627691564, 8.81312030587554, 
8.87514902365156, 8.8293755227843, 8.77028192359486, 9.24131769131151, 
9.2427104683695, 9.21599826167033, 9.13028362611817, 9.03459301705783, 
9.15225152771786, 9.27726550821295, 7.99482826345879, 8.0862872208779, 
8.11124725483796, 8.15898023498527, 8.22186975840737, 8.29828662307883, 
8.43357802939057, 10.2033328521137, 10.3782610379096, 10.3586313188748, 
10.2640947550025, 10.3283303610705, 10.4146631150664, 10.4312587850283, 
10.3536391782667, 10.4718082001492, 10.4806625568437, 10.4915797263212, 
10.3831630085098, 10.3447701535097, 9.99934303817965, 10.2209953818852, 
10.2972174044259, 10.1171462646391, 10.123265446374, 10.1338847325616, 
9.95375281868368, 9.93124862332152, 9.58674389405408, 9.55761537614691, 
9.62926668371527, 9.65604661844032, 9.56454021436101, 9.63059672022673, 
9.67037306957062), Dummy.ESG = structure(c(4L, 4L, 4L, 4L, 4L, 
4L, 4L, 3L, 3L, 3L, 3L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 3L, 4L, 3L, 
4L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 
3L, 4L, 4L, 4L, 3L, 4L, 3L, 4L, 3L, 3L, 3L, 4L, 3L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L), .Label = c("schlecht", "befriedigend", "gut", "exzellent"
), class = "factor"), Dummy.Sektor = structure(c(2L, 2L, 2L, 
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L), .Label = c("Energie", "Material"), class = "factor")), row.names = c("1209-2011", 
"1209-2012", "1209-2013", "1209-2014", "1209-2015", "1209-2016", 
"1209-2017", "1380-2011", "1380-2012", "1380-2013", "1380-2014", 
"1380-2015", "1380-2016", "1380-2017", "1678-2011", "1678-2012", 
"1678-2013", "1678-2014", "1678-2015", "1678-2016", "1678-2017", 
"1913-2011", "1913-2012", "1913-2013", "1913-2014", "1913-2015", 
"1913-2016", "1913-2017", "1988-2011", "1988-2012", "1988-2013", 
"1988-2014", "1988-2015", "1988-2016", "1988-2017", "2991-2011", 
"2991-2012", "2991-2013", "2991-2014", "2991-2015", "2991-2016", 
"2991-2017", "4213-2011", "4213-2012", "4213-2013", "4213-2014", 
"4213-2015", "4213-2016", "4213-2017", "4503-2011", "4503-2012", 
"4503-2013", "4503-2014", "4503-2015", "4503-2016", "4503-2017", 
"4510-2011", "4510-2012", "4510-2013", "4510-2014", "4510-2015", 
"4510-2016", "4510-2017", "5439-2011", "5439-2012", "5439-2013", 
"5439-2014", "5439-2015", "5439-2016", "5439-2017", "5581-2011", 
"5581-2012", "5581-2013", "5581-2014", "5581-2015", "5581-2016", 
"5581-2017", "5667-2011", "5667-2012", "5667-2013", "5667-2014", 
"5667-2015", "5667-2016", "5667-2017", "6078-2011", "6078-2012", 
"6078-2013", "6078-2014", "6078-2015", "6078-2016", "6078-2017", 
"6104-2011", "6104-2012", "6104-2013", "6104-2014", "6104-2015", 
"6104-2016", "6104-2017", "7017-2011", "7017-2012", "7017-2013", 
"7017-2014", "7017-2015", "7017-2016", "7017-2017", "7881-2011", 
"7881-2012", "7881-2013", "7881-2014", "7881-2015", "7881-2016", 
"7881-2017", "8030-2011", "8030-2012", "8030-2013", "8030-2014", 
"8030-2015", "8030-2016", "8030-2017"), class = c("pdata.frame", 
"data.frame"), index = structure(list(gvkey = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 
12L, 12L, 12L, 12L, 12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 13L, 
13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 15L, 15L, 15L, 15L, 15L, 
15L, 15L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 
17L, 17L, 17L), .Label = c("1209", "1380", "1678", "1913", "1988", 
"2991", "4213", "4503", "4510", "5439", "5581", "5667", "6078", 
"6104", "7017", "7881", "8030"), class = "factor"), Year = structure(c(1L, 
2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 
4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 
3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 
5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 
7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 
2L, 3L, 4L, 5L, 6L, 7L), .Label = c("2011", "2012", "2013", "2014", 
"2015", "2016", "2017"), class = "factor")), row.names = c(NA, 
119L), class = c("pindex", "data.frame")))

我花时间寻找证据来支持我的想法,即多重共线性不需要验证,因为您的 model 是聚类的。 如果有的话,在集群内检查可能是值得关注的。 检查独立于组的变量? 没那么多。 然而,我没有发现任何我认为是“证据”的东西。

这就是我要做的(我所做的):

首先,我创建了 MOD.FE(正如您所演示的那样)。 接下来,我制作了 MOD.RE。

# random effects
MOD.RE <- plm(FORMULAR.PLM.BASELINE, 
              data = PD.Datensatz_so, 
              model = "random")
summary(MOD.RE)

然后我进行了豪斯曼检验。

#------------ testing the suitability of the test method --------------
# this tests whether you should use random or fixed effects
# it tests whether ui is correlated with the regressors
# the H0: not correlated
phtest(MOD.FE, MOD.RE)
# 
#   Hausman Test
# 
# data:  FORMULAR.PLM.BASELINE
# chisq = 12.983, df = 8, p-value = 0.1125
# alternative hypothesis: one model is inconsistent
#  
# if p < .05 FE is needed, it is not, so RE is needed
# this infers that the ui (unique errors) correlated with regressors **

这让我相信使用 RE model 会更好。 但是,我对这两种选择进行了进一步调查。 我使用了几个不同的包,所以我将 package 名称附加到我使用的任何 function (除了plm函数)。

残差的序列相关

pbgtest(MOD.FE)
# 
#   Breusch-Godfrey/Wooldridge test for serial correlation in panel models
# 
# data:  FORMULAR.PLM.BASELINE
# chisq = 18.501, df = 7, p-value = 0.009903
# alternative hypothesis: serial correlation in idiosyncratic errors
#  
# problem with serial correlation, but may not matter (small sample size)

pbgtest(MOD.RE)
# 
#   Breusch-Godfrey/Wooldridge test for serial correlation in panel models
# 
# data:  FORMULAR.PLM.BASELINE
# chisq = 26.98, df = 7, p-value = 0.0003361
# alternative hypothesis: serial correlation in idiosyncratic errors
#  
# problem with serial correlation, but may not matter (small sample size)

平稳时间序列

# test for stochastic trends
# H0: series is non-stationary
tseries::adf.test(PD.Datensatz_so$StockPrice, k = 2)
# 
#   Augmented Dickey-Fuller Test
# 
# data:  PD.Datensatz_so$StockPrice
# Dickey-Fuller = -3.4907, Lag order = 2, p-value = 0.04612
# alternative hypothesis: stationary
#  
# this is good; no differencing needed

等方差

# test for homoskedasticity
lmtest::bptest(FORMULAR.PLM.BASELINE,
               data = PD.Datensatz_so,
               studentize = F)
# 
#   Breusch-Pagan test
# 
# data:  FORMULAR.PLM.BASELINE
# BP = 25.903, df = 9, p-value = 0.002119
#  
# there is a problem of heteroskedasticity**

控制序列相关性和方差问题

#------- controlling for serial corr/heteroskedasticity FE -------

t(sapply(c("HC0", "HC1", "HC2", "HC3", "HC4"), 
         function(x) sqrt(diag(vcovHC(MOD.FE, type = x)))))
# all of the variables saw larger error terms with the increase in HC value
   # except for Dummy.ESG == excellent

lmtest::coeftest(MOD.FE, vcovHC(MOD.FE, type = "HC0"))
# 
# t test of coefficients:
# 
#                          Estimate Std. Error t value Pr(>|t|)  
# EPS                       0.33624    0.28454  1.1817  0.24051  
# BookValuePS               0.46793    0.32077  1.4588  0.14818  
# AssetsTotal.LOG          14.21471   13.98026  1.0168  0.31205  
# LeverageRatio            38.60903   48.75079  0.7920  0.43051  
# AvgAnnualDividendyield -402.35998  374.68585 -1.0739  0.28582  
# Dummy.ESGbefriedigend    -3.17031   11.29811 -0.2806  0.77967  
# Dummy.ESGgut            -21.72112    9.52367 -2.2808  0.02498 *
# Dummy.ESGexzellent      -21.21610   11.14826 -1.9031  0.06030 .
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

使用method= "white1"看到了进一步的改进

lmtest::coeftest(MOD.FE, vcovHC(MOD.FE, method = "white1", type = "HC0"))
# 
# t test of coefficients:
# 
#                          Estimate Std. Error t value Pr(>|t|)  
# EPS                       0.33624    0.29827  1.1273  0.26269  
# BookValuePS               0.46793    0.25116  1.8630  0.06579 .
# AssetsTotal.LOG          14.21471    9.44197  1.5055  0.13578  
# LeverageRatio            38.60903   34.45018  1.1207  0.26546  
# AvgAnnualDividendyield -402.35998  239.65196 -1.6789  0.09671 .
# Dummy.ESGbefriedigend    -3.17031    8.71336 -0.3638  0.71685  
# Dummy.ESGgut            -21.72112   10.45950 -2.0767  0.04075 *
# Dummy.ESGexzellent      -21.21610   11.68868 -1.8151  0.07292 .
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# It looks like `satisfactory` isn't doing a whole lot for the model.
# Das ist mir Wurst -> Das is ihn Wurst (befriedigend auf die Ergebnisvariable)

现在为 RE model

#------- controlling for serial corr/heteroskedasticity RE -------
t(sapply(c("HC0", "HC1", "HC2", "HC3", "HC4"), 
         function(x) sqrt(diag(vcovHC(MOD.RE, type = x)))))
# all had more error as the HC when higher, except BookValuePS (up, then down)
# same resulting use of vcovHC as the FE model, not surprising    

lmtest::coeftest(MOD.RE, vcovHC(MOD.RE, type = "HC0"))
# 
# t test of coefficients:
# 
#                           Estimate  Std. Error t value Pr(>|t|)  
# (Intercept)             -56.340871   40.407060 -1.3943  0.16605  
# EPS                       0.177625    0.111367  1.5949  0.11362  
# BookValuePS               0.604870    0.248151  2.4375  0.01641 *
# AssetsTotal.LOG           8.616948    5.009664  1.7201  0.08826 .
# LeverageRatio            28.749759   46.126681  0.6233  0.53440  
# AvgAnnualDividendyield -219.316248  275.288817 -0.7967  0.42737  
# Dummy.ESGbefriedigend    -0.072336    8.476523 -0.0085  0.99321  
# Dummy.ESGgut             -5.251316    6.127045 -0.8571  0.39329  
# Dummy.ESGexzellent       -7.244158   12.488032 -0.5801  0.56305  
# Dummy.SektorMaterial     22.719709   16.087360  1.4123  0.16072  
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

使用method= "white1"看到了进一步的改进

lmtest::coeftest(MOD.RE, vcovHC(MOD.RE, method = "white1", type = "HC0"))
# 
# t test of coefficients:
# 
#                           Estimate  Std. Error t value Pr(>|t|)   
# (Intercept)             -56.340871   43.309326 -1.3009 0.196038   
# EPS                       0.177625    0.199284  0.8913 0.374723   
# BookValuePS               0.604870    0.199899  3.0259 0.003093 **
# AssetsTotal.LOG           8.616948    4.898411  1.7591 0.081361 . 
# LeverageRatio            28.749759   38.256011  0.7515 0.453966   
# AvgAnnualDividendyield -219.316248  211.106676 -1.0389 0.301156   
# Dummy.ESGbefriedigend    -0.072336   11.143110 -0.0065 0.994832   
# Dummy.ESGgut             -5.251316   11.087409 -0.4736 0.636712   
# Dummy.ESGexzellent       -7.244158   12.887762 -0.5621 0.575205   
# Dummy.SektorMaterial     22.719709   13.114915  1.7324 0.086039 . 
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM