1
2R version 4.1.1 (2021-08-10) -- "Kick Things"
3Copyright (C) 2021 The R Foundation for Statistical Computing
4Platform: x86_64-w64-mingw32/x64 (64-bit)
5
6R is free software and comes with ABSOLUTELY NO WARRANTY.
7You are welcome to redistribute it under certain conditions.
8Type 'license()' or 'licence()' for distribution details.
9
10R is a collaborative project with many contributors.
11Type 'contributors()' for more information and
12'citation()' on how to cite R or R packages in publications.
13
14Type 'demo()' for some demos, 'help()' for on-line help, or
15'help.start()' for an HTML browser interface to help.
16Type 'q()' to quit R.
17
18> ## Replicate some IV regression results
19> ## Replicate Baltagi (2013), Econometric Analysis of Panel Data, 5th edition, ch. 7.2 (p. 133)
20> ## (same as Baltagi (2006), Estimating an econometric model of crime using panel data from North Carolina,
21> ##                          Journal of Applied Econometrics 21(4), pp. 543-547.
22> ##
23> ## NB: Crime data set: results can diverge slightly form the values printed in Baltagi
24> ##     if logarithm computation is performed on the original variable. For the paper,
25> ##     a data set with pre-computed logarithms (variables l*) was used and those
26> ##     logarithmic values diverge from what R's log() function gives.
27> ##     -> see the two FE2SLS example which is computed in both ways
28>
29>
30> library(plm)
31> data("Crime", package = "plm")
32>
33> # replicates Table 7.1, column "Between"
34> form <- log(crmrte) ~ log(prbarr) + log(prbconv) + log(prbpris) + log(avgsen) + log(polpc) + log(density) + log(wcon) + log(wtuc) + log(wtrd) + log(wfir) + log(wser) + log(wmfg) + log(wfed) + log(wsta) + log(wloc) + log(pctymle) + log(pctmin) + region + smsa
35> be <- plm(form, data = Crime, model = "between")
36> summary(be)
37Oneway (individual) effect Between Model
38
39Call:
40plm(formula = form, data = Crime, model = "between")
41
42Balanced Panel: n = 90, T = 7, N = 630
43Observations used in estimation: 90
44
45Residuals:
46     Min.   1st Qu.    Median   3rd Qu.      Max.
47-0.510397 -0.098495 -0.021638  0.131446  0.598675
48
49Coefficients:
50               Estimate Std. Error t-value  Pr(>|t|)
51(Intercept)   -2.096704   2.821910 -0.7430  0.459999
52log(prbarr)   -0.647509   0.087766 -7.3777 2.738e-10 ***
53log(prbconv)  -0.528202   0.066741 -7.9143 2.868e-11 ***
54log(prbpris)   0.296505   0.230668  1.2854  0.202943
55log(avgsen)   -0.235885   0.173534 -1.3593  0.178477
56log(polpc)     0.364217   0.060091  6.0611 6.370e-08 ***
57log(density)   0.168390   0.077380  2.1761  0.032971 *
58log(wcon)      0.195005   0.210406  0.9268  0.357259
59log(wtuc)     -0.195747   0.170486 -1.1482  0.254864
60log(wtrd)      0.128619   0.278350  0.4621  0.645479
61log(wfir)      0.113239   0.220473  0.5136  0.609159
62log(wser)     -0.105834   0.162825 -0.6500  0.517861
63log(wmfg)     -0.024885   0.133876 -0.1859  0.853082
64log(wfed)      0.156213   0.287071  0.5442  0.588083
65log(wsta)     -0.283780   0.256342 -1.1070  0.272123
66log(wloc)      0.010325   0.463487  0.0223  0.982292
67log(pctymle)  -0.095049   0.157683 -0.6028  0.548626
68log(pctmin)    0.148195   0.048543  3.0529  0.003218 **
69regionwest    -0.229630   0.108468 -2.1170  0.037865 *
70regioncentral -0.163672   0.064453 -2.5394  0.013362 *
71smsayes       -0.034592   0.132374 -0.2613  0.794624
72---
73Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
74
75Total Sum of Squares:    26.913
76Residual Sum of Squares: 3.2171
77R-Squared:      0.88046
78Adj. R-Squared: 0.84582
79F-statistic: 25.4115 on 20 and 69 DF, p-value: < 2.22e-16
80>
81> # replicates Table 7.1, column "Fixed Effects"
82> fe <- plm(form, data = Crime, model = "within", effect = "twoways")
83> summary(fe)
84Twoways effects Within Model
85
86Call:
87plm(formula = form, data = Crime, effect = "twoways", model = "within")
88
89Balanced Panel: n = 90, T = 7, N = 630
90
91Residuals:
92      Min.    1st Qu.     Median    3rd Qu.       Max.
93-0.5581590 -0.0650155 -0.0018256  0.0698165  0.5247036
94
95Coefficients:
96               Estimate Std. Error  t-value  Pr(>|t|)
97log(prbarr)  -0.3548257  0.0322048 -11.0178 < 2.2e-16 ***
98log(prbconv) -0.2815673  0.0211376 -13.3207 < 2.2e-16 ***
99log(prbpris) -0.1731044  0.0323027  -5.3588 1.263e-07 ***
100log(avgsen)  -0.0024524  0.0261190  -0.0939  0.925232
101log(polpc)    0.4131576  0.0266231  15.5188 < 2.2e-16 ***
102log(density)  0.4143782  0.2825417   1.4666  0.143089
103log(wcon)    -0.0377894  0.0390757  -0.9671  0.333954
104log(wtuc)     0.0455237  0.0190116   2.3945  0.016996 *
105log(wtrd)    -0.0205048  0.0404790  -0.5066  0.612682
106log(wfir)    -0.0038988  0.0282572  -0.1380  0.890312
107log(wser)     0.0088773  0.0191314   0.4640  0.642833
108log(wmfg)    -0.3598306  0.1118355  -3.2175  0.001374 **
109log(wfed)    -0.3093206  0.1761644  -1.7559  0.079703 .
110log(wsta)     0.0528862  0.1135307   0.4658  0.641532
111log(wloc)     0.1815859  0.1176542   1.5434  0.123348
112log(pctymle)  0.6267986  0.3636065   1.7238  0.085334 .
113---
114Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
115
116Total Sum of Squares:    16.123
117Residual Sum of Squares: 9.6545
118R-Squared:      0.40121
119Adj. R-Squared: 0.2729
120F-statistic: 21.6923 on 16 and 518 DF, p-value: < 2.22e-16
121>
122> # replicates Table 7.1, column "FE2SLS"
123> form_iv <- log(crmrte) ~ log(prbarr) + log(prbconv) + log(prbpris) + log(avgsen) + log(polpc) + log(density) + log(wcon) + log(wtuc) + log(wtrd) + log(wfir) + log(wser) + log(wmfg) + log(wfed) + log(wsta) + log(wloc) + log(pctymle) + log(pctmin) + region + smsa | . -log(prbarr) - log(polpc) + log(taxpc) + log(mix)
124> form_iv2 <- lcrmrte ~ lprbarr + lprbconv + lprbpris + lavgsen + lpolpc + ldensity + lwcon + lwtuc + lwtrd + lwfir + lwser + lwmfg + lwfed + lwsta + lwloc + lpctymle + lpctmin + region + smsa | . -lprbarr - lpolpc + ltaxpc + lmix
125> fe_iv <- plm(form_iv, data = Crime, model = "within", effect = "twoways", inst.method = "baltagi")
126> fe_iv2 <- plm(form_iv2, data = Crime, model = "within", effect = "twoways", inst.method = "baltagi")
127> summary(fe_iv)  # logs computed by R
128Twoways effects Within Model
129Instrumental variable estimation
130
131Call:
132plm(formula = form_iv, data = Crime, effect = "twoways", model = "within",
133    inst.method = "baltagi")
134
135Balanced Panel: n = 90, T = 7, N = 630
136
137Residuals:
138      Min.    1st Qu.     Median    3rd Qu.       Max.
139-0.7207996 -0.0682050 -0.0041004  0.0759313  0.5661408
140
141Coefficients:
142               Estimate Std. Error z-value Pr(>|z|)
143log(prbarr)  -0.5753943  0.8019932 -0.7175   0.4731
144log(prbconv) -0.4230764  0.5018196 -0.8431   0.3992
145log(prbpris) -0.2502194  0.2793986 -0.8956   0.3705
146log(avgsen)   0.0090948  0.0489808  0.1857   0.8527
147log(polpc)    0.6574104  0.8466656  0.7765   0.4375
148log(density)  0.1395236  1.0210334  0.1366   0.8913
149log(wcon)    -0.0287310  0.0535109 -0.5369   0.5913
150log(wtuc)     0.0391296  0.0308542  1.2682   0.2047
151log(wtrd)    -0.0177599  0.0453090 -0.3920   0.6951
152log(wfir)    -0.0093412  0.0365471 -0.2556   0.7983
153log(wser)     0.0185815  0.0388087  0.4788   0.6321
154log(wmfg)    -0.2431858  0.4194999 -0.5797   0.5621
155log(wfed)    -0.4512812  0.5270259 -0.8563   0.3918
156log(wsta)    -0.0187117  0.2807606 -0.0666   0.9469
157log(wloc)     0.2631882  0.3122909  0.8428   0.3994
158log(pctymle)  0.3512984  1.0107677  0.3476   0.7282
159
160Total Sum of Squares:    16.123
161Residual Sum of Squares: 11.535
162R-Squared:      0.39131
163Adj. R-Squared: 0.26087
164Chisq: 56.2016 on 16 DF, p-value: 2.2539e-06
165> summary(fe_iv2) # logs as in data set by Baltagi -> results match exactly
166Twoways effects Within Model
167Instrumental variable estimation
168
169Call:
170plm(formula = form_iv2, data = Crime, effect = "twoways", model = "within",
171    inst.method = "baltagi")
172
173Balanced Panel: n = 90, T = 7, N = 630
174
175Residuals:
176      Min.    1st Qu.     Median    3rd Qu.       Max.
177-0.7209110 -0.0682207 -0.0041115  0.0759381  0.5661659
178
179Coefficients:
180           Estimate Std. Error z-value Pr(>|z|)
181lprbarr  -0.5755058  0.8021842 -0.7174   0.4731
182lprbconv -0.4231446  0.5019375 -0.8430   0.3992
183lprbpris -0.2502550  0.2794602 -0.8955   0.3705
184lavgsen   0.0090987  0.0489879  0.1857   0.8527
185lpolpc    0.6575270  0.8468673  0.7764   0.4375
186ldensity  0.1394120  1.0212391  0.1365   0.8914
187lwcon    -0.0287308  0.0535145 -0.5369   0.5914
188lwtuc     0.0391292  0.0308568  1.2681   0.2048
189lwtrd    -0.0177536  0.0453142 -0.3918   0.6952
190lwfir    -0.0093443  0.0365519 -0.2556   0.7982
191lwser     0.0185854  0.0388155  0.4788   0.6321
192lwmfg    -0.2431684  0.4195485 -0.5796   0.5622
193lwfed    -0.4513372  0.5271232 -0.8562   0.3919
194lwsta    -0.0187458  0.2808182 -0.0668   0.9468
195lwloc     0.2632585  0.3123945  0.8427   0.3994
196lpctymle  0.3511166  1.0110334  0.3473   0.7284
197
198Total Sum of Squares:    16.123
199Residual Sum of Squares: 11.537
200R-Squared:      0.3913
201Adj. R-Squared: 0.26087
202Chisq: 56.1934 on 16 DF, p-value: 2.2609e-06
203>
204> # ## felm example
205> # library(lfe)
206> # form_felm <- log(crmrte) ~  log(prbconv) + log(prbpris) + log(avgsen) + log(density) + log(wcon) + log(wtuc) + log(wtrd) + log(wfir) + log(wser) + log(wmfg) + log(wfed) + log(wsta) + log(wloc) + log(pctymle)  |
207> #   county + year |
208> #   (log(prbarr) + log(polpc) ~ log(prbpris) + log(avgsen) + log(density) + log(wcon) + log(wtuc) + log(wtrd) + log(wfir) + log(wser) + log(wmfg) + log(wfed) + log(wsta) + log(wloc) + log(pctymle) + log(taxpc) + log(mix))
209> # summary(felm(form_felm, data = Crime))
210>
211> # replicates Table 7.1, column "BE2SLS"
212> be_iv <- plm(form_iv, data = Crime, model = "between")
213> summary(be_iv)
214Oneway (individual) effect Between Model
215Instrumental variable estimation
216   (Balestra-Varadharajan-Krishnakumar's transformation)
217
218Call:
219plm(formula = form_iv, data = Crime, model = "between")
220
221Balanced Panel: n = 90, T = 7, N = 630
222Observations used in estimation: 90
223
224Residuals:
225      Min.    1st Qu.     Median    3rd Qu.       Max.
226-0.5499406 -0.1041014  0.0029817  0.0986084  0.6020580
227
228Coefficients:
229               Estimate Std. Error z-value  Pr(>|z|)
230(Intercept)   -1.977222   4.000782 -0.4942  0.621159
231log(prbarr)   -0.502946   0.240623 -2.0902  0.036601 *
232log(prbconv)  -0.524770   0.099948 -5.2504 1.517e-07 ***
233log(prbpris)   0.187177   0.318292  0.5881  0.556487
234log(avgsen)   -0.227225   0.178509 -1.2729  0.203052
235log(polpc)     0.408439   0.192998  2.1163  0.034321 *
236log(density)   0.225624   0.102474  2.2018  0.027681 *
237log(wcon)      0.314005   0.259103  1.2119  0.225553
238log(wtuc)     -0.198943   0.197119 -1.0093  0.312854
239log(wtrd)      0.053559   0.296005  0.1809  0.856415
240log(wfir)      0.041707   0.305622  0.1365  0.891453
241log(wser)     -0.135428   0.173646 -0.7799  0.435446
242log(wmfg)     -0.042002   0.156266 -0.2688  0.788097
243log(wfed)      0.148024   0.325648  0.4546  0.649431
244log(wsta)     -0.203080   0.298153 -0.6811  0.495792
245log(wloc)      0.044440   0.494358  0.0899  0.928372
246log(pctymle)  -0.094720   0.191805 -0.4938  0.621423
247log(pctmin)    0.168902   0.052700  3.2049  0.001351 **
248regionwest    -0.204816   0.113836 -1.7992  0.071982 .
249regioncentral -0.172932   0.066706 -2.5924  0.009530 **
250smsayes       -0.080500   0.144232 -0.5581  0.576758
251---
252Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
253
254Total Sum of Squares:    26.913
255Residual Sum of Squares: 3.396
256R-Squared:      0.87385
257Adj. R-Squared: 0.83729
258Chisq: 413.647 on 20 DF, p-value: < 2.22e-16
259>
260> # not in table
261> fd_iv <- plm(form_iv, data = Crime, model = "fd", effect = "individual")
262> summary(fd_iv)
263Oneway (individual) effect First-Difference Model
264Instrumental variable estimation
265   (Balestra-Varadharajan-Krishnakumar's transformation)
266
267Call:
268plm(formula = form_iv, data = Crime, effect = "individual", model = "fd")
269
270Balanced Panel: n = 90, T = 7, N = 630
271Observations used in estimation: 540
272
273Residuals:
274      Min.    1st Qu.     Median    3rd Qu.       Max.
275-1.0255104 -0.0799101  0.0053594  0.0800347  0.9355716
276
277Coefficients:
278               Estimate Std. Error z-value Pr(>|z|)
279(Intercept)   0.0069945  0.1200615  0.0583   0.9535
280log(prbarr)  -0.3657462  1.5603992 -0.2344   0.8147
281log(prbconv) -0.2303887  0.9292399 -0.2479   0.8042
282log(prbpris) -0.1751528  0.4564269 -0.3837   0.7012
283log(avgsen)  -0.0109961  0.1067622 -0.1030   0.9180
284log(polpc)    0.2537245  2.1624236  0.1173   0.9066
285log(density) -0.1466853  2.4584727 -0.0597   0.9524
286log(wcon)    -0.0368105  0.0605415 -0.6080   0.5432
287log(wtuc)     0.0122918  0.0411881  0.2984   0.7654
288log(wtrd)    -0.0388990  0.0501528 -0.7756   0.4380
289log(wfir)     0.0013050  0.0373671  0.0349   0.9721
290log(wser)     0.0164254  0.0152130  1.0797   0.2803
291log(wmfg)    -0.2568435  0.3419870 -0.7510   0.4526
292log(wfed)    -0.1409253  0.5886135 -0.2394   0.8108
293log(wsta)     0.1249133  0.0970830  1.2867   0.1982
294log(wloc)     0.0553071  0.6247338  0.0885   0.9295
295log(pctymle) -0.0054946  1.3734037 -0.0040   0.9968
296
297Total Sum of Squares:    22.197
298Residual Sum of Squares: 14.057
299R-Squared:      0.37134
300Adj. R-Squared: 0.3521
301Chisq: 46.0102 on 16 DF, p-value: 9.7009e-05
302>
303> # replicates Table 7.1, column "EC2SLS"
304> ## need to include time dummies!
305> form_re_iv  <- log(crmrte) ~ log(prbarr) + log(prbconv) + log(prbpris) + log(avgsen) + log(polpc) + log(density) + log(wcon) + log(wtuc) + log(wtrd) + log(wfir) + log(wser) + log(wmfg) + log(wfed) + log(wsta) + log(wloc) + log(pctymle) + log(pctmin) + region + smsa + factor(year) | . -log(prbarr) - log(polpc) + log(taxpc) + log(mix)
306> form_re_iv2 <- lcrmrte ~ lprbarr + lprbconv + lprbpris + lavgsen + lpolpc + ldensity + lwcon + lwtuc + lwtrd + lwfir + lwser + lwmfg + lwfed + lwsta + lwloc + lpctymle + lpctmin + region + smsa + factor(year) | . -lprbarr - lpolpc + ltaxpc + lmix
307> re_iv  <- plm(form_re_iv,  data = Crime, model = "random", inst.method = "baltagi")
308> re_iv2 <- plm(form_re_iv2, data = Crime, model = "random", inst.method = "baltagi")
309> summary(re_iv)
310Oneway (individual) effect Random Effect Model
311   (Swamy-Arora's transformation)
312Instrumental variable estimation
313   (Baltagi's transformation)
314
315Call:
316plm(formula = form_re_iv, data = Crime, model = "random", inst.method = "baltagi")
317
318Balanced Panel: n = 90, T = 7, N = 630
319
320Effects:
321                  var std.dev share
322idiosyncratic 0.02227 0.14923 0.326
323individual    0.04604 0.21456 0.674
324theta: 0.7458
325
326Residuals:
327     Min.   1st Qu.    Median   3rd Qu.      Max.
328-4.997164 -0.465637  0.027153  0.512779  3.917220
329
330Coefficients:
331                 Estimate Std. Error z-value  Pr(>|z|)
332(Intercept)    -0.9536145  1.2839853 -0.7427  0.457664
333log(prbarr)    -0.4129201  0.0974056 -4.2392 2.243e-05 ***
334log(prbconv)   -0.3228859  0.0535539 -6.0292 1.648e-09 ***
335log(prbpris)   -0.1863204  0.0419391 -4.4426 8.886e-06 ***
336log(avgsen)    -0.0101739  0.0270229 -0.3765  0.706551
337log(polpc)      0.4347568  0.0896981  4.8469 1.254e-06 ***
338log(density)    0.4290337  0.0548511  7.8218 5.208e-15 ***
339log(wcon)      -0.0074746  0.0395773 -0.1889  0.850202
340log(wtuc)       0.0454430  0.0197925  2.2960  0.021678 *
341log(wtrd)      -0.0081453  0.0413823 -0.1968  0.843960
342log(wfir)      -0.0036394  0.0289236 -0.1258  0.899867
343log(wser)       0.0056112  0.0201257  0.2788  0.780393
344log(wmfg)      -0.2041324  0.0804418 -2.5376  0.011160 *
345log(wfed)      -0.1635333  0.1594522 -1.0256  0.305083
346log(wsta)      -0.0540400  0.1056774 -0.5114  0.609094
347log(wloc)       0.1630405  0.1196368  1.3628  0.172947
348log(pctymle)   -0.1080968  0.1397015 -0.7738  0.439067
349log(pctmin)     0.1890388  0.0415013  4.5550 5.238e-06 ***
350regionwest     -0.2268401  0.0995975 -2.2776  0.022752 *
351regioncentral  -0.1940408  0.0598277 -3.2433  0.001181 **
352smsayes        -0.2251624  0.1156369 -1.9471  0.051517 .
353factor(year)82  0.0107457  0.0257968  0.4166  0.677006
354factor(year)83 -0.0837924  0.0307088 -2.7286  0.006360 **
355factor(year)84 -0.1034973  0.0370886 -2.7905  0.005262 **
356factor(year)85 -0.0956959  0.0494505 -1.9352  0.052968 .
357factor(year)86 -0.0688930  0.0595961 -1.1560  0.247681
358factor(year)87 -0.0314024  0.0705204 -0.4453  0.656106
359---
360Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
361
362Total Sum of Squares:    30.168
363Residual Sum of Squares: 544.47
364R-Squared:      0.59845
365Adj. R-Squared: 0.58114
366Chisq: 575.685 on 26 DF, p-value: < 2.22e-16
367> summary(re_iv2)
368Oneway (individual) effect Random Effect Model
369   (Swamy-Arora's transformation)
370Instrumental variable estimation
371   (Baltagi's transformation)
372
373Call:
374plm(formula = form_re_iv2, data = Crime, model = "random", inst.method = "baltagi")
375
376Balanced Panel: n = 90, T = 7, N = 630
377
378Effects:
379                  var std.dev share
380idiosyncratic 0.02227 0.14924 0.326
381individual    0.04604 0.21456 0.674
382theta: 0.7457
383
384Residuals:
385     Min.   1st Qu.    Median   3rd Qu.      Max.
386-4.996927 -0.465655  0.027205  0.512780  3.917085
387
388Coefficients:
389                 Estimate Std. Error z-value  Pr(>|z|)
390(Intercept)    -0.9538032  1.2839664 -0.7429  0.457568
391lprbarr        -0.4129261  0.0974020 -4.2394 2.241e-05 ***
392lprbconv       -0.3228872  0.0535517 -6.0295 1.645e-09 ***
393lprbpris       -0.1863195  0.0419382 -4.4427 8.883e-06 ***
394lavgsen        -0.0101765  0.0270231 -0.3766  0.706481
395lpolpc          0.4347492  0.0896950  4.8470 1.254e-06 ***
396ldensity        0.4290282  0.0548483  7.8221 5.196e-15 ***
397lwcon          -0.0074751  0.0395775 -0.1889  0.850194
398lwtuc           0.0454450  0.0197926  2.2961  0.021673 *
399lwtrd          -0.0081412  0.0413828 -0.1967  0.844040
400lwfir          -0.0036395  0.0289238 -0.1258  0.899865
401lwser           0.0056098  0.0201259  0.2787  0.780447
402lwmfg          -0.2041398  0.0804393 -2.5378  0.011155 *
403lwfed          -0.1635108  0.1594496 -1.0255  0.305142
404lwsta          -0.0540503  0.1056769 -0.5115  0.609024
405lwloc           0.1630523  0.1196380  1.3629  0.172920
406lpctymle       -0.1081057  0.1396949 -0.7739  0.439007
407lpctmin         0.1890370  0.0414988  4.5552 5.233e-06 ***
408regionwest     -0.2268433  0.0995913 -2.2777  0.022742 *
409regioncentral  -0.1940428  0.0598241 -3.2436  0.001180 **
410smsayes        -0.2251539  0.1156302 -1.9472  0.051512 .
411factor(year)82  0.0107452  0.0257969  0.4165  0.677023
412factor(year)83 -0.0837944  0.0307088 -2.7287  0.006359 **
413factor(year)84 -0.1034997  0.0370885 -2.7906  0.005261 **
414factor(year)85 -0.0957017  0.0494502 -1.9353  0.052952 .
415factor(year)86 -0.0688982  0.0595956 -1.1561  0.247642
416factor(year)87 -0.0314071  0.0705197 -0.4454  0.656055
417---
418Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
419
420Total Sum of Squares:    30.169
421Residual Sum of Squares: 544.4
422R-Squared:      0.59847
423Adj. R-Squared: 0.58115
424Chisq: 575.735 on 26 DF, p-value: < 2.22e-16
425>
426> # replicates Baltagi (2013), p. 137/Baltagi (2021), p. 165 ("G2SLS"), table 7.3 (not in Table 7.1)
427> re_iv_bvk  <- plm(form_re_iv,  data = Crime, model = "random", inst.method = "bvk")
428> re_iv_bvk2 <- plm(form_re_iv2, data = Crime, model = "random", inst.method = "bvk")
429> summary(re_iv_bvk)
430Oneway (individual) effect Random Effect Model
431   (Swamy-Arora's transformation)
432Instrumental variable estimation
433   (Balestra-Varadharajan-Krishnakumar's transformation)
434
435Call:
436plm(formula = form_re_iv, data = Crime, model = "random", inst.method = "bvk")
437
438Balanced Panel: n = 90, T = 7, N = 630
439
440Effects:
441                  var std.dev share
442idiosyncratic 0.02227 0.14923 0.326
443individual    0.04604 0.21456 0.674
444theta: 0.7458
445
446Residuals:
447      Min.    1st Qu.     Median    3rd Qu.       Max.
448-0.7485123 -0.0710015  0.0040742  0.0784401  0.4756493
449
450Coefficients:
451                 Estimate Std. Error z-value  Pr(>|z|)
452(Intercept)    -0.4538241  1.7029840 -0.2665  0.789864
453log(prbarr)    -0.4141200  0.2210540 -1.8734  0.061015 .
454log(prbconv)   -0.3432383  0.1324679 -2.5911  0.009567 **
455log(prbpris)   -0.1900437  0.0733420 -2.5912  0.009564 **
456log(avgsen)    -0.0064374  0.0289406 -0.2224  0.823977
457log(polpc)      0.5049285  0.2277811  2.2167  0.026642 *
458log(density)    0.4343519  0.0711528  6.1045 1.031e-09 ***
459log(wcon)      -0.0042963  0.0414225 -0.1037  0.917392
460log(wtuc)       0.0444572  0.0215449  2.0635  0.039068 *
461log(wtrd)      -0.0085626  0.0419822 -0.2040  0.838387
462log(wfir)      -0.0040302  0.0294565 -0.1368  0.891175
463log(wser)       0.0105604  0.0215822  0.4893  0.624620
464log(wmfg)      -0.2017917  0.0839423 -2.4039  0.016220 *
465log(wfed)      -0.2134634  0.2151074 -0.9924  0.321023
466log(wsta)      -0.0601083  0.1203146 -0.4996  0.617362
467log(wloc)       0.1835137  0.1396721  1.3139  0.188884
468log(pctymle)   -0.1458448  0.2268137 -0.6430  0.520214
469log(pctmin)     0.1948760  0.0459409  4.2419 2.217e-05 ***
470regionwest     -0.2281780  0.1010317 -2.2585  0.023916 *
471regioncentral  -0.1987675  0.0607510 -3.2718  0.001068 **
472smsayes        -0.2595423  0.1499780 -1.7305  0.083535 .
473factor(year)82  0.0132140  0.0299923  0.4406  0.659518
474factor(year)83 -0.0847676  0.0320008 -2.6489  0.008075 **
475factor(year)84 -0.1062004  0.0387893 -2.7379  0.006184 **
476factor(year)85 -0.0977398  0.0511685 -1.9102  0.056113 .
477factor(year)86 -0.0719390  0.0605821 -1.1875  0.235045
478factor(year)87 -0.0396520  0.0758537 -0.5227  0.601153
479---
480Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
481
482Total Sum of Squares:    30.168
483Residual Sum of Squares: 12.418
484R-Squared:      0.59228
485Adj. R-Squared: 0.5747
486Chisq: 542.435 on 26 DF, p-value: < 2.22e-16
487> summary(re_iv_bvk2)
488Oneway (individual) effect Random Effect Model
489   (Swamy-Arora's transformation)
490Instrumental variable estimation
491   (Balestra-Varadharajan-Krishnakumar's transformation)
492
493Call:
494plm(formula = form_re_iv2, data = Crime, model = "random", inst.method = "bvk")
495
496Balanced Panel: n = 90, T = 7, N = 630
497
498Effects:
499                  var std.dev share
500idiosyncratic 0.02227 0.14924 0.326
501individual    0.04604 0.21456 0.674
502theta: 0.7457
503
504Residuals:
505      Min.    1st Qu.     Median    3rd Qu.       Max.
506-0.7485357 -0.0709883  0.0040648  0.0784455  0.4756273
507
508Coefficients:
509                 Estimate Std. Error z-value  Pr(>|z|)
510(Intercept)    -0.4538501  1.7029831 -0.2665  0.789852
511lprbarr        -0.4141383  0.2210496 -1.8735  0.060998 .
512lprbconv       -0.3432506  0.1324648 -2.5913  0.009563 **
513lprbpris       -0.1900467  0.0733392 -2.5913  0.009560 **
514lavgsen        -0.0064389  0.0289407 -0.2225  0.823935
515lpolpc          0.5049461  0.2277778  2.2168  0.026634 *
516ldensity        0.4343449  0.0711496  6.1047 1.030e-09 ***
517lwcon          -0.0042958  0.0414226 -0.1037  0.917403
518lwtuc           0.0444589  0.0215448  2.0636  0.039060 *
519lwtrd          -0.0085579  0.0419829 -0.2038  0.838476
520lwfir          -0.0040305  0.0294569 -0.1368  0.891166
521lwser           0.0105602  0.0215823  0.4893  0.624630
522lwmfg          -0.2018020  0.0839373 -2.4042  0.016208 *
523lwfed          -0.2134579  0.2151046 -0.9923  0.321029
524lwsta          -0.0601232  0.1203149 -0.4997  0.617275
525lwloc           0.1835363  0.1396775  1.3140  0.188846
526lpctymle       -0.1458703  0.2268086 -0.6431  0.520131
527lpctmin         0.1948763  0.0459385  4.2421 2.214e-05 ***
528regionwest     -0.2281821  0.1010260 -2.2586  0.023905 *
529regioncentral  -0.1987703  0.0607475 -3.2721  0.001068 **
530smsayes        -0.2595451  0.1499718 -1.7306  0.083518 .
531factor(year)82  0.0132147  0.0299924  0.4406  0.659500
532factor(year)83 -0.0847693  0.0320010 -2.6490  0.008074 **
533factor(year)84 -0.1062027  0.0387893 -2.7379  0.006183 **
534factor(year)85 -0.0977457  0.0511681 -1.9103  0.056097 .
535factor(year)86 -0.0719451  0.0605819 -1.1876  0.235004
536factor(year)87 -0.0396595  0.0758531 -0.5228  0.601081
537---
538Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
539
540Total Sum of Squares:    30.169
541Residual Sum of Squares: 12.419
542R-Squared:      0.5923
543Adj. R-Squared: 0.57472
544Chisq: 542.478 on 26 DF, p-value: < 2.22e-16
545> cor(plm:::fitted_exp.plm(re_iv_bvk2), re_iv_bvk2$model[ , 1])^2 # overall R^2 as per Stata
546[1] 0.7724889
547>
548>
549>
550> ## Hausman-Taylor estimator:
551> ## replicates Baltagi (2005, 2013), table 7.4; Baltagi (2021), table 7.5
552> # (chisq values in Baltagi (2021) are not those of the models but of Hausman test
553> #  between the models! plm's summary replicates chisq values of the models as
554> #  given by Stata and printed in Baltagi (2021), tables 7.6, 7.7)
555> #
556> # Table 7.5 claims to replicate Baltagi/Khanti-Akom (1990), table II, but values
557> # for all models but within are largely different (even the GLS case!), making
558> # the book reproducible but not the paper (likely the paper is in error!).
559> data("Wages", package = "plm")
560> pWages <- pdata.frame(Wages, index = 595)
561>
562> form_wage <- lwage ~ wks + south + smsa + married + exp + I(exp ^ 2) +
563+   bluecol + ind + union + sex + black + ed
564>
565> form_wage_iv <- lwage ~ wks + south + smsa + married + exp + I(exp ^ 2) +
566+   bluecol + ind + union + sex + black + ed |
567+   bluecol + south + smsa + ind + sex + black |
568+   wks + married + union + exp + I(exp ^ 2)
569>
570> gls <- plm(form_wage, data = pWages, model = "random")
571> summary(gls)
572Oneway (individual) effect Random Effect Model
573   (Swamy-Arora's transformation)
574
575Call:
576plm(formula = form_wage, data = pWages, model = "random")
577
578Balanced Panel: n = 595, T = 7, N = 4165
579
580Effects:
581                  var std.dev share
582idiosyncratic 0.02310 0.15199 0.251
583individual    0.06899 0.26266 0.749
584theta: 0.7863
585
586Residuals:
587      Min.    1st Qu.     Median    3rd Qu.       Max.
588-2.0612918 -0.1146344  0.0073351  0.1227697  2.0972144
589
590Coefficients:
591               Estimate  Std. Error  z-value  Pr(>|z|)
592(Intercept)  4.2637e+00  9.7716e-02  43.6332 < 2.2e-16 ***
593wks          1.0347e-03  7.7337e-04   1.3379 0.1809396
594southyes    -1.6618e-02  2.6527e-02  -0.6265 0.5310184
595smsayes     -1.3823e-02  1.9993e-02  -0.6914 0.4893108
596marriedyes  -7.4628e-02  2.3005e-02  -3.2440 0.0011788 **
597exp          8.2054e-02  2.8478e-03  28.8138 < 2.2e-16 ***
598I(exp^2)    -8.0845e-04  6.2823e-05 -12.8686 < 2.2e-16 ***
599bluecolyes  -5.0066e-02  1.6647e-02  -3.0076 0.0026336 **
600ind          3.7441e-03  1.7262e-02   0.2169 0.8282830
601unionyes     6.3223e-02  1.7070e-02   3.7038 0.0002124 ***
602sexfemale   -3.3921e-01  5.1303e-02  -6.6119 3.795e-11 ***
603blackyes    -2.1028e-01  5.7989e-02  -3.6262 0.0002876 ***
604ed           9.9659e-02  5.7475e-03  17.3395 < 2.2e-16 ***
605---
606Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
607
608Total Sum of Squares:    270.16
609Residual Sum of Squares: 164.79
610R-Squared:      0.39002
611Adj. R-Squared: 0.38825
612Chisq: 2654.74 on 12 DF, p-value: < 2.22e-16
613>
614> within <- plm(form_wage, data = pWages, model = "within")
615> summary(within)
616Oneway (individual) effect Within Model
617
618Call:
619plm(formula = form_wage, data = pWages, model = "within")
620
621Balanced Panel: n = 595, T = 7, N = 4165
622
623Residuals:
624      Min.    1st Qu.     Median    3rd Qu.       Max.
625-1.8122282 -0.0519417  0.0038855  0.0614706  1.9434306
626
627Coefficients:
628              Estimate  Std. Error t-value  Pr(>|t|)
629wks         8.3595e-04  5.9967e-04  1.3940   0.16340
630southyes   -1.8612e-03  3.4299e-02 -0.0543   0.95673
631smsayes    -4.2469e-02  1.9428e-02 -2.1859   0.02889 *
632marriedyes -2.9726e-02  1.8984e-02 -1.5659   0.11747
633exp         1.1321e-01  2.4710e-03 45.8141 < 2.2e-16 ***
634I(exp^2)   -4.1835e-04  5.4595e-05 -7.6629 2.329e-14 ***
635bluecolyes -2.1476e-02  1.3784e-02 -1.5581   0.11930
636ind         1.9210e-02  1.5446e-02  1.2437   0.21370
637unionyes    3.2785e-02  1.4923e-02  2.1970   0.02809 *
638---
639Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
640
641Total Sum of Squares:    240.65
642Residual Sum of Squares: 82.267
643R-Squared:      0.65815
644Adj. R-Squared: 0.60026
645F-statistic: 761.751 on 9 and 3561 DF, p-value: < 2.22e-16
646>
647> ht <- plm(form_wage_iv,
648+           data = pWages,
649+           random.method = "ht", model = "random", inst.method = "baltagi")
650> summary(ht)
651Oneway (individual) effect Random Effect Model
652   (Hausman-Taylor's transformation)
653Instrumental variable estimation
654   (Baltagi's transformation)
655
656Call:
657plm(formula = form_wage_iv, data = pWages, model = "random",
658    random.method = "ht", inst.method = "baltagi")
659
660Balanced Panel: n = 595, T = 7, N = 4165
661
662Effects:
663                  var std.dev share
664idiosyncratic 0.02304 0.15180 0.025
665individual    0.88699 0.94180 0.975
666theta: 0.9392
667
668Residuals:
669      Min.    1st Qu.     Median    3rd Qu.       Max.
670-12.643736  -0.466002   0.043285   0.524739  13.340263
671
672Coefficients:
673               Estimate  Std. Error z-value  Pr(>|z|)
674(Intercept)  2.9127e+00  2.8365e-01 10.2687 < 2.2e-16 ***
675wks          8.3740e-04  5.9973e-04  1.3963   0.16263
676southyes     7.4398e-03  3.1955e-02  0.2328   0.81590
677smsayes     -4.1833e-02  1.8958e-02 -2.2066   0.02734 *
678marriedyes  -2.9851e-02  1.8980e-02 -1.5728   0.11578
679exp          1.1313e-01  2.4710e-03 45.7851 < 2.2e-16 ***
680I(exp^2)    -4.1886e-04  5.4598e-05 -7.6718 1.696e-14 ***
681bluecolyes  -2.0705e-02  1.3781e-02 -1.5024   0.13299
682ind          1.3604e-02  1.5237e-02  0.8928   0.37196
683unionyes     3.2771e-02  1.4908e-02  2.1982   0.02794 *
684sexfemale   -1.3092e-01  1.2666e-01 -1.0337   0.30129
685blackyes    -2.8575e-01  1.5570e-01 -1.8352   0.06647 .
686ed           1.3794e-01  2.1248e-02  6.4919 8.474e-11 ***
687---
688Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
689
690Total Sum of Squares:    243.04
691Residual Sum of Squares: 4163.6
692R-Squared:      0.60945
693Adj. R-Squared: 0.60833
694Chisq: 6891.87 on 12 DF, p-value: < 2.22e-16
695>
696> am <- plm(form_wage_iv,
697+           data = pWages,
698+           random.method = "ht", model = "random", inst.method = "am")
699> summary(am)
700Oneway (individual) effect Random Effect Model
701   (Hausman-Taylor's transformation)
702Instrumental variable estimation
703   (Amemiya-MaCurdy's transformation)
704
705Call:
706plm(formula = form_wage_iv, data = pWages, model = "random",
707    random.method = "ht", inst.method = "am")
708
709Balanced Panel: n = 595, T = 7, N = 4165
710
711Effects:
712                  var std.dev share
713idiosyncratic 0.02304 0.15180 0.025
714individual    0.88699 0.94180 0.975
715theta: 0.9392
716
717Residuals:
718      Min.    1st Qu.     Median    3rd Qu.       Max.
719-12.643192  -0.464811   0.043216   0.523598  13.338789
720
721Coefficients:
722               Estimate  Std. Error z-value  Pr(>|z|)
723(Intercept)  2.9273e+00  2.7513e-01 10.6399 < 2.2e-16 ***
724wks          8.3806e-04  5.9945e-04  1.3980   0.16210
725southyes     7.2818e-03  3.1936e-02  0.2280   0.81964
726smsayes     -4.1951e-02  1.8947e-02 -2.2141   0.02682 *
727marriedyes  -3.0089e-02  1.8967e-02 -1.5864   0.11266
728exp          1.1297e-01  2.4688e-03 45.7584 < 2.2e-16 ***
729I(exp^2)    -4.2140e-04  5.4554e-05 -7.7244 1.124e-14 ***
730bluecolyes  -2.0850e-02  1.3765e-02 -1.5147   0.12986
731ind          1.3629e-02  1.5229e-02  0.8949   0.37082
732unionyes     3.2475e-02  1.4894e-02  2.1804   0.02922 *
733sexfemale   -1.3201e-01  1.2660e-01 -1.0427   0.29709
734blackyes    -2.8590e-01  1.5549e-01 -1.8388   0.06595 .
735ed           1.3720e-01  2.0570e-02  6.6703 2.553e-11 ***
736---
737Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
738
739Total Sum of Squares:    243.04
740Residual Sum of Squares: 4160.3
741R-Squared:      0.60948
742Adj. R-Squared: 0.60835
743Chisq: 6879.2 on 12 DF, p-value: < 2.22e-16
744>
745> bms <- plm(form_wage_iv,
746+           data = pWages,
747+           random.method = "ht", model = "random", inst.method = "bms")
748> summary(bms)
749Oneway (individual) effect Random Effect Model
750   (Hausman-Taylor's transformation)
751Instrumental variable estimation
752   (Breusch-Mizon-Schmidt's transformation)
753
754Call:
755plm(formula = form_wage_iv, data = pWages, model = "random",
756    random.method = "ht", inst.method = "bms")
757
758Balanced Panel: n = 595, T = 7, N = 4165
759
760Effects:
761                  var std.dev share
762idiosyncratic 0.02304 0.15180 0.025
763individual    0.88699 0.94180 0.975
764theta: 0.9392
765
766Residuals:
767      Min.    1st Qu.     Median    3rd Qu.       Max.
768-12.790365  -0.448022   0.042648   0.506978  13.292638
769
770Coefficients:
771               Estimate  Std. Error z-value  Pr(>|z|)
772(Intercept)  1.9794e+00  2.6724e-01  7.4071 1.291e-13 ***
773wks          7.9537e-04  5.9850e-04  1.3289  0.183869
774southyes     1.4668e-02  3.1883e-02  0.4601  0.645478
775smsayes     -5.2042e-02  1.8911e-02 -2.7520  0.005923 **
776marriedyes  -3.9262e-02  1.8925e-02 -2.0747  0.038017 *
777exp          1.0867e-01  2.4557e-03 44.2513 < 2.2e-16 ***
778I(exp^2)    -4.9060e-04  5.4352e-05 -9.0265 < 2.2e-16 ***
779bluecolyes  -1.5389e-02  1.3737e-02 -1.1203  0.262596
780ind          1.9024e-02  1.5202e-02  1.2514  0.210795
781unionyes     3.7855e-02  1.4864e-02  2.5467  0.010873 *
782sexfemale   -1.8027e-01  1.2639e-01 -1.4263  0.153769
783blackyes    -1.5636e-01  1.5506e-01 -1.0084  0.313276
784ed           2.2066e-01  1.9850e-02 11.1162 < 2.2e-16 ***
785---
786Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
787
788Total Sum of Squares:    243.04
789Residual Sum of Squares: 4147.6
790R-Squared:      0.60686
791Adj. R-Squared: 0.60572
792Chisq: 6467.37 on 12 DF, p-value: < 2.22e-16
793>
794> # texreg::screenreg(list(ht, am, bms))
795>
796> phtest(within, ht) # 5.2577 -> match Baltagi (2021), p. 175 for statistic but
797
798	Hausman Test
799
800data:  form_wage
801chisq = 5.2577, df = 9, p-value = 0.8113
802alternative hypothesis: one model is inconsistent
803
804>                    #           df are different (9 vs. 3), Baltagi explains why df = 3.
805>
806> phtest(ht, am) # 14.66 -> close to Baltagi's 17.74 (df = 12 vs. 13)
807
808	Hausman Test
809
810data:  form_wage_iv
811chisq = 14.666, df = 12, p-value = 0.2602
812alternative hypothesis: one model is inconsistent
813
814>
815>
816>
817>
818> ### IV estimators ##
819> form_wage_iv2 <- lwage ~ wks + married + exp + I(exp ^ 2) + bluecol |
820+                    wks + exp + bluecol |
821+                    wks + married +  exp + I(exp ^ 2)
822>
823> ## balanced one-way individual
824> IVbvk <- plm(form_wage_iv2,
825+           data = pWages,
826+           model = "random", inst.method = "bvk")
827> summary(IVbvk)
828Oneway (individual) effect Random Effect Model
829   (Swamy-Arora's transformation)
830Instrumental variable estimation
831   (Balestra-Varadharajan-Krishnakumar's transformation)
832
833Call:
834plm(formula = form_wage_iv2, data = pWages, model = "random",
835    inst.method = "bvk")
836
837Balanced Panel: n = 595, T = 7, N = 4165
838
839Effects:
840                  var std.dev share
841idiosyncratic 0.02315 0.15215 0.189
842individual    0.09928 0.31509 0.811
843theta: 0.8205
844
845Residuals:
846      Min.    1st Qu.     Median    3rd Qu.       Max.
847-1.9670577 -0.1180355  0.0091769  0.1192050  2.0936461
848
849Coefficients:
850               Estimate  Std. Error  z-value  Pr(>|z|)
851(Intercept)  5.3917e+00  5.2313e-02 103.0662 < 2.2e-16 ***
852wks          1.1115e-03  7.7209e-04   1.4397    0.1500
853marriedyes  -1.3964e-02  2.1789e-02  -0.6409    0.5216
854exp          8.6050e-02  2.9196e-03  29.4729 < 2.2e-16 ***
855I(exp^2)    -7.9169e-04  6.4523e-05 -12.2700 < 2.2e-16 ***
856bluecolyes  -1.1180e-01  1.5963e-02  -7.0034 2.498e-12 ***
857---
858Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
859
860Total Sum of Squares:    261.48
861Residual Sum of Squares: 163.12
862R-Squared:      0.37618
863Adj. R-Squared: 0.37543
864Chisq: 2507.95 on 5 DF, p-value: < 2.22e-16
865>
866> IVbalt <- plm(form_wage_iv2,
867+           data = pWages,
868+           model = "random", inst.method = "baltagi")
869> summary(IVbalt)
870Oneway (individual) effect Random Effect Model
871   (Swamy-Arora's transformation)
872Instrumental variable estimation
873   (Baltagi's transformation)
874
875Call:
876plm(formula = form_wage_iv2, data = pWages, model = "random",
877    inst.method = "baltagi")
878
879Balanced Panel: n = 595, T = 7, N = 4165
880
881Effects:
882                  var std.dev share
883idiosyncratic 0.02315 0.15215 0.189
884individual    0.09928 0.31509 0.811
885theta: 0.8205
886
887Residuals:
888      Min.    1st Qu.     Median    3rd Qu.       Max.
889-12.909745  -0.785178   0.047664   0.784261  13.789006
890
891Coefficients:
892               Estimate  Std. Error  z-value  Pr(>|z|)
893(Intercept)  5.4619e+00  5.3852e-02 101.4244 < 2.2e-16 ***
894wks          1.1434e-03  7.7454e-04   1.4763    0.1399
895marriedyes  -1.1791e-01  2.4588e-02  -4.7954 1.623e-06 ***
896exp          8.7309e-02  3.1570e-03  27.6556 < 2.2e-16 ***
897I(exp^2)    -8.1720e-04  7.0594e-05 -11.5761 < 2.2e-16 ***
898bluecolyes  -1.0980e-01  1.6010e-02  -6.8583 6.968e-12 ***
899---
900Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
901
902Total Sum of Squares:    261.48
903Residual Sum of Squares: 7085.3
904R-Squared:      0.3728
905Adj. R-Squared: 0.37204
906Chisq: 2502.88 on 5 DF, p-value: < 2.22e-16
907>
908> IVam <- plm(form_wage_iv2,
909+           data = pWages,
910+           model = "random", inst.method = "am")
911> summary(IVam)
912Oneway (individual) effect Random Effect Model
913   (Swamy-Arora's transformation)
914Instrumental variable estimation
915   (Amemiya-MaCurdy's transformation)
916
917Call:
918plm(formula = form_wage_iv2, data = pWages, model = "random",
919    inst.method = "am")
920
921Balanced Panel: n = 595, T = 7, N = 4165
922
923Effects:
924                  var std.dev share
925idiosyncratic 0.02315 0.15215 0.189
926individual    0.09928 0.31509 0.811
927theta: 0.8205
928
929Residuals:
930      Min.    1st Qu.     Median    3rd Qu.       Max.
931-12.910190  -0.782406   0.048668   0.783272  13.787161
932
933Coefficients:
934               Estimate  Std. Error  z-value  Pr(>|z|)
935(Intercept)  5.4599e+00  5.3794e-02 101.4955 < 2.2e-16 ***
936wks          1.1451e-03  7.7434e-04   1.4788    0.1392
937marriedyes  -1.1314e-01  2.4486e-02  -4.6206 3.826e-06 ***
938exp          8.7077e-02  3.1494e-03  27.6490 < 2.2e-16 ***
939I(exp^2)    -8.1187e-04  7.0401e-05 -11.5320 < 2.2e-16 ***
940bluecolyes  -1.0993e-01  1.6006e-02  -6.8681 6.504e-12 ***
941---
942Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
943
944Total Sum of Squares:    261.48
945Residual Sum of Squares: 7081.8
946R-Squared:      0.3731
947Adj. R-Squared: 0.37235
948Chisq: 2501.31 on 5 DF, p-value: < 2.22e-16
949>
950> IVbms <- plm(form_wage_iv2,
951+            data = pWages,
952+            model = "random", inst.method = "bms")
953> summary(IVbms)
954Oneway (individual) effect Random Effect Model
955   (Swamy-Arora's transformation)
956Instrumental variable estimation
957   (Breusch-Mizon-Schmidt's transformation)
958
959Call:
960plm(formula = form_wage_iv2, data = pWages, model = "random",
961    inst.method = "bms")
962
963Balanced Panel: n = 595, T = 7, N = 4165
964
965Effects:
966                  var std.dev share
967idiosyncratic 0.02315 0.15215 0.189
968individual    0.09928 0.31509 0.811
969theta: 0.8205
970
971Residuals:
972      Min.    1st Qu.     Median    3rd Qu.       Max.
973-12.910637  -0.781238   0.049022   0.783769  13.787656
974
975Coefficients:
976               Estimate  Std. Error  z-value  Pr(>|z|)
977(Intercept)  5.4586e+00  5.3775e-02 101.5077 < 2.2e-16 ***
978wks          1.1419e-03  7.7433e-04   1.4747    0.1403
979marriedyes  -1.1298e-01  2.4431e-02  -4.6244 3.757e-06 ***
980exp          8.7249e-02  3.1468e-03  27.7266 < 2.2e-16 ***
981I(exp^2)    -8.1597e-04  7.0335e-05 -11.6012 < 2.2e-16 ***
982bluecolyes  -1.0990e-01  1.6006e-02  -6.8660 6.600e-12 ***
983---
984Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
985
986Total Sum of Squares:    261.48
987Residual Sum of Squares: 7081.8
988R-Squared:      0.37311
989Adj. R-Squared: 0.37235
990Chisq: 2503.01 on 5 DF, p-value: < 2.22e-16
991>
992> # texreg::screenreg(list("BVK" = IVbvk, "Baltagi" = IVbalt, "AM" = IVam, "BMS" = IVbms),
993> #                  digits = 5)
994>
995> ## unbalanced one-way individual
996>
997> pWages_ubal <- pWages[-c(2:7, 79:82, 500:505), ]
998> pdim(pWages_ubal)
999Unbalanced Panel: n = 595, T = 1-7, N = 4149
1000> IVbvk_ubal <- plm(form_wage_iv2,
1001+              data = pWages_ubal,
1002+              model = "random", inst.method = "bvk")
1003> summary(IVbvk_ubal)
1004Oneway (individual) effect Random Effect Model
1005   (Swamy-Arora's transformation)
1006Instrumental variable estimation
1007   (Balestra-Varadharajan-Krishnakumar's transformation)
1008
1009Call:
1010plm(formula = form_wage_iv2, data = pWages_ubal, model = "random",
1011    inst.method = "bvk")
1012
1013Unbalanced Panel: n = 595, T = 1-7, N = 4149
1014
1015Effects:
1016                  var std.dev share
1017idiosyncratic 0.02323 0.15243  0.19
1018individual    0.09893 0.31453  0.81
1019theta:
1020   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1021 0.5639  0.8198  0.8198  0.8196  0.8198  0.8198
1022
1023Residuals:
1024    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
1025-1.96701 -0.11847  0.00915 -0.00001  0.11963  2.09363
1026
1027Coefficients:
1028               Estimate  Std. Error  z-value  Pr(>|z|)
1029(Intercept)  5.3954e+00  5.2425e-02 102.9162 < 2.2e-16 ***
1030wks          1.1191e-03  7.7476e-04   1.4445    0.1486
1031marriedyes  -1.3685e-02  2.1830e-02  -0.6269    0.5308
1032exp          8.5760e-02  2.9316e-03  29.2539 < 2.2e-16 ***
1033I(exp^2)    -7.8934e-04  6.4755e-05 -12.1898 < 2.2e-16 ***
1034bluecolyes  -1.1174e-01  1.6014e-02  -6.9771 3.012e-12 ***
1035---
1036Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1037
1038Total Sum of Squares:    265.29
1039Residual Sum of Squares: 163.35
1040R-Squared:      0.38425
1041Adj. R-Squared: 0.38351
1042Chisq: 2477.34 on 5 DF, p-value: < 2.22e-16
1043>
1044> IVbalt_ubal <- plm(form_wage_iv2,
1045+               data = pWages_ubal,
1046+               model = "random", inst.method = "baltagi")
1047> summary(IVbalt_ubal)
1048Oneway (individual) effect Random Effect Model
1049   (Swamy-Arora's transformation)
1050Instrumental variable estimation
1051   (Baltagi's transformation)
1052
1053Call:
1054plm(formula = form_wage_iv2, data = pWages_ubal, model = "random",
1055    inst.method = "baltagi")
1056
1057Unbalanced Panel: n = 595, T = 1-7, N = 4149
1058
1059Effects:
1060                  var std.dev share
1061idiosyncratic 0.02323 0.15243  0.19
1062individual    0.09893 0.31453  0.81
1063theta:
1064   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1065 0.5639  0.8198  0.8198  0.8196  0.8198  0.8198
1066
1067Residuals:
1068    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
1069-12.8856  -0.7915   0.0470  -0.0004   0.7861  13.7637
1070
1071Coefficients:
1072               Estimate  Std. Error  z-value  Pr(>|z|)
1073(Intercept)  5.4676e+00  5.4011e-02 101.2297 < 2.2e-16 ***
1074wks          1.1427e-03  7.7735e-04   1.4700    0.1416
1075marriedyes  -1.1874e-01  2.4650e-02  -4.8172 1.456e-06 ***
1076exp          8.6999e-02  3.1742e-03  27.4081 < 2.2e-16 ***
1077I(exp^2)    -8.1476e-04  7.0926e-05 -11.4874 < 2.2e-16 ***
1078bluecolyes  -1.0986e-01  1.6064e-02  -6.8389 7.982e-12 ***
1079---
1080Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1081
1082Total Sum of Squares:    265.29
1083Residual Sum of Squares: 7070.4
1084R-Squared:      0.38083
1085Adj. R-Squared: 0.38008
1086Chisq: 2468.11 on 5 DF, p-value: < 2.22e-16
1087>
1088> IVam_ubal <- plm(form_wage_iv2,
1089+             data = pWages_ubal,
1090+             model = "random", inst.method = "am")
1091> summary(IVam_ubal)
1092Oneway (individual) effect Random Effect Model
1093   (Swamy-Arora's transformation)
1094Instrumental variable estimation
1095   (Amemiya-MaCurdy's transformation)
1096
1097Call:
1098plm(formula = form_wage_iv2, data = pWages_ubal, model = "random",
1099    inst.method = "am")
1100
1101Unbalanced Panel: n = 595, T = 1-7, N = 4149
1102
1103Effects:
1104                  var std.dev share
1105idiosyncratic 0.02323 0.15243  0.19
1106individual    0.09893 0.31453  0.81
1107theta:
1108   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1109 0.5639  0.8198  0.8198  0.8196  0.8198  0.8198
1110
1111Residuals:
1112    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
1113-12.8863  -0.7867   0.0495  -0.0001   0.7861  13.7627
1114
1115Coefficients:
1116               Estimate  Std. Error  z-value  Pr(>|z|)
1117(Intercept)  5.4638e+00  5.3915e-02 101.3399 < 2.2e-16 ***
1118wks          1.1511e-03  7.7708e-04   1.4813    0.1385
1119marriedyes  -1.1403e-01  2.4534e-02  -4.6479 3.354e-06 ***
1120exp          8.6894e-02  3.1630e-03  27.4723 < 2.2e-16 ***
1121I(exp^2)    -8.1196e-04  7.0668e-05 -11.4898 < 2.2e-16 ***
1122bluecolyes  -1.0982e-01  1.6058e-02  -6.8391 7.968e-12 ***
1123---
1124Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1125
1126Total Sum of Squares:    265.29
1127Residual Sum of Squares: 7066.9
1128R-Squared:      0.38113
1129Adj. R-Squared: 0.38038
1130Chisq: 2471.83 on 5 DF, p-value: < 2.22e-16
1131>
1132> IVbms_ubal <- plm(form_wage_iv2,
1133+              data = pWages_ubal,
1134+              model = "random", inst.method = "bms")
1135>
1136>
1137> summary(IVbms_ubal)
1138Oneway (individual) effect Random Effect Model
1139   (Swamy-Arora's transformation)
1140Instrumental variable estimation
1141   (Breusch-Mizon-Schmidt's transformation)
1142
1143Call:
1144plm(formula = form_wage_iv2, data = pWages_ubal, model = "random",
1145    inst.method = "bms")
1146
1147Unbalanced Panel: n = 595, T = 1-7, N = 4149
1148
1149Effects:
1150                  var std.dev share
1151idiosyncratic 0.02323 0.15243  0.19
1152individual    0.09893 0.31453  0.81
1153theta:
1154   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1155 0.5639  0.8198  0.8198  0.8196  0.8198  0.8198
1156
1157Residuals:
1158    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
1159-12.8867  -0.7873   0.0499  -0.0001   0.7873  13.7632
1160
1161Coefficients:
1162               Estimate  Std. Error  z-value  Pr(>|z|)
1163(Intercept)  5.46240311  0.05389528 101.3522 < 2.2e-16 ***
1164wks          0.00114787  0.00077707   1.4772    0.1396
1165marriedyes  -0.11376538  0.02447722  -4.6478 3.355e-06 ***
1166exp          0.08706288  0.00316031  27.5488 < 2.2e-16 ***
1167I(exp^2)    -0.00081599  0.00007060 -11.5579 < 2.2e-16 ***
1168bluecolyes  -0.10979302  0.01605806  -6.8373 8.072e-12 ***
1169---
1170Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1171
1172Total Sum of Squares:    265.29
1173Residual Sum of Squares: 7066.8
1174R-Squared:      0.38114
1175Adj. R-Squared: 0.3804
1176Chisq: 2473.49 on 5 DF, p-value: < 2.22e-16
1177>
1178> # texreg::screenreg(list("BVK ui" = IVbvk_ubal, "Baltagi ui" = IVbalt_ubal, "AM ui" = IVam_ubal, "BMS ui" = IVbms_ubal),
1179> #                  digits = 5)
1180>
1181>
1182> ## balanced one-way time
1183> # gives identical results for "am" and "bms" results are identical to "baltagi",
1184> # likely because  function StarX is not symmetric in effect
1185> IVbvk_t <- plm(form_wage_iv2,
1186+              data = pWages,
1187+              model = "random", inst.method = "bvk", effect = "time")
1188> summary(IVbvk_t)
1189Oneway (time) effect Random Effect Model
1190   (Swamy-Arora's transformation)
1191Instrumental variable estimation
1192   (Balestra-Varadharajan-Krishnakumar's transformation)
1193
1194Call:
1195plm(formula = form_wage_iv2, data = pWages, effect = "time",
1196    model = "random", inst.method = "bvk")
1197
1198Balanced Panel: n = 595, T = 7, N = 4165
1199
1200Effects:
1201                 var std.dev share
1202idiosyncratic 0.1271  0.3565     1
1203time          0.0000  0.0000     0
1204theta: 0
1205
1206Residuals:
1207      Min.    1st Qu.     Median    3rd Qu.       Max.
1208-1.9957868 -0.2573738 -0.0061258  0.2677200  2.1611993
1209
1210Coefficients:
1211               Estimate  Std. Error z-value  Pr(>|z|)
1212(Intercept)  6.0131e+00  6.0968e-02  98.629 < 2.2e-16 ***
1213wks          3.6313e-03  1.2032e-03   3.018  0.002545 **
1214marriedyes   3.1837e-01  1.6118e-02  19.753 < 2.2e-16 ***
1215exp          3.6882e-02  2.4393e-03  15.120 < 2.2e-16 ***
1216I(exp^2)    -6.4913e-04  5.3708e-05 -12.086 < 2.2e-16 ***
1217bluecolyes  -3.2165e-01  1.2368e-02 -26.007 < 2.2e-16 ***
1218---
1219Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1220
1221Total Sum of Squares:    886.9
1222Residual Sum of Squares: 654.8
1223R-Squared:      0.2617
1224Adj. R-Squared: 0.26081
1225Chisq: 1474.21 on 5 DF, p-value: < 2.22e-16
1226>
1227> IVbalt_t <- plm(form_wage_iv2,
1228+               data = pWages,
1229+               model = "random", inst.method = "baltagi", effect = "time")
1230> summary(IVbalt_t)
1231Oneway (time) effect Random Effect Model
1232   (Swamy-Arora's transformation)
1233Instrumental variable estimation
1234   (Baltagi's transformation)
1235
1236Call:
1237plm(formula = form_wage_iv2, data = pWages, effect = "time",
1238    model = "random", inst.method = "baltagi")
1239
1240Balanced Panel: n = 595, T = 7, N = 4165
1241
1242Effects:
1243                 var std.dev share
1244idiosyncratic 0.1271  0.3565     1
1245time          0.0000  0.0000     0
1246theta: 0
1247
1248Residuals:
1249     Min.   1st Qu.    Median   3rd Qu.      Max.
1250-5.598694 -0.721869 -0.017043  0.751016  6.062259
1251
1252Coefficients:
1253               Estimate  Std. Error  z-value  Pr(>|z|)
1254(Intercept)  6.01329823  0.06096780  98.6307 < 2.2e-16 ***
1255wks          0.00363128  0.00120324   3.0179  0.002545 **
1256marriedyes   0.31849295  0.01611823  19.7598 < 2.2e-16 ***
1257exp          0.03685389  0.00243934  15.1081 < 2.2e-16 ***
1258I(exp^2)    -0.00064850  0.00005371 -12.0740 < 2.2e-16 ***
1259bluecolyes  -0.32165802  0.01236790 -26.0075 < 2.2e-16 ***
1260---
1261Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1262
1263Total Sum of Squares:    886.9
1264Residual Sum of Squares: 5152.8
1265R-Squared:      0.2617
1266Adj. R-Squared: 0.26081
1267Chisq: 1474.19 on 5 DF, p-value: < 2.22e-16
1268>
1269> IVam_t <- plm(form_wage_iv2,
1270+             data = pWages,
1271+             model = "random", inst.method = "am", effect = "time")
1272> summary(IVam_t)
1273Oneway (time) effect Random Effect Model
1274   (Swamy-Arora's transformation)
1275Instrumental variable estimation
1276   (Amemiya-MaCurdy's transformation)
1277
1278Call:
1279plm(formula = form_wage_iv2, data = pWages, effect = "time",
1280    model = "random", inst.method = "am")
1281
1282Balanced Panel: n = 595, T = 7, N = 4165
1283
1284Effects:
1285                 var std.dev share
1286idiosyncratic 0.1271  0.3565     1
1287time          0.0000  0.0000     0
1288theta: 0
1289
1290Residuals:
1291     Min.   1st Qu.    Median   3rd Qu.      Max.
1292-5.598694 -0.721869 -0.017043  0.751016  6.062259
1293
1294Coefficients:
1295               Estimate  Std. Error  z-value  Pr(>|z|)
1296(Intercept)  6.01329823  0.06096780  98.6307 < 2.2e-16 ***
1297wks          0.00363128  0.00120324   3.0179  0.002545 **
1298marriedyes   0.31849295  0.01611823  19.7598 < 2.2e-16 ***
1299exp          0.03685389  0.00243934  15.1081 < 2.2e-16 ***
1300I(exp^2)    -0.00064850  0.00005371 -12.0740 < 2.2e-16 ***
1301bluecolyes  -0.32165802  0.01236790 -26.0075 < 2.2e-16 ***
1302---
1303Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1304
1305Total Sum of Squares:    886.9
1306Residual Sum of Squares: 5152.8
1307R-Squared:      0.2617
1308Adj. R-Squared: 0.26081
1309Chisq: 1474.19 on 5 DF, p-value: < 2.22e-16
1310>
1311> IVbms_t <- plm(form_wage_iv2,
1312+              data = pWages,
1313+              model = "random", inst.method = "bms", effect = "time")
1314> summary(IVbms_t)
1315Oneway (time) effect Random Effect Model
1316   (Swamy-Arora's transformation)
1317Instrumental variable estimation
1318   (Breusch-Mizon-Schmidt's transformation)
1319
1320Call:
1321plm(formula = form_wage_iv2, data = pWages, effect = "time",
1322    model = "random", inst.method = "bms")
1323
1324Balanced Panel: n = 595, T = 7, N = 4165
1325
1326Effects:
1327                 var std.dev share
1328idiosyncratic 0.1271  0.3565     1
1329time          0.0000  0.0000     0
1330theta: 0
1331
1332Residuals:
1333     Min.   1st Qu.    Median   3rd Qu.      Max.
1334-5.598694 -0.721869 -0.017043  0.751016  6.062259
1335
1336Coefficients:
1337               Estimate  Std. Error  z-value  Pr(>|z|)
1338(Intercept)  6.01329823  0.06096780  98.6307 < 2.2e-16 ***
1339wks          0.00363128  0.00120324   3.0179  0.002545 **
1340marriedyes   0.31849295  0.01611823  19.7598 < 2.2e-16 ***
1341exp          0.03685389  0.00243934  15.1081 < 2.2e-16 ***
1342I(exp^2)    -0.00064850  0.00005371 -12.0740 < 2.2e-16 ***
1343bluecolyes  -0.32165802  0.01236790 -26.0075 < 2.2e-16 ***
1344---
1345Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1346
1347Total Sum of Squares:    886.9
1348Residual Sum of Squares: 5152.8
1349R-Squared:      0.2617
1350Adj. R-Squared: 0.26081
1351Chisq: 1474.19 on 5 DF, p-value: < 2.22e-16
1352>
1353> # texreg::screenreg(list("BVK t" = IVbvk_t, "Baltagi t" = IVbalt_t, "AM t" = IVam_t, "BMS t" = IVbms_t),
1354> #                  digits = 5)
1355>
1356> ## unbalanced one-way time
1357> IVbvk_t_ubal <- plm(form_wage_iv2,
1358+               data = pWages_ubal,
1359+               model = "random", inst.method = "bvk", effect = "time")
1360> summary(IVbvk_t_ubal)
1361Oneway (time) effect Random Effect Model
1362   (Swamy-Arora's transformation)
1363Instrumental variable estimation
1364   (Balestra-Varadharajan-Krishnakumar's transformation)
1365
1366Call:
1367plm(formula = form_wage_iv2, data = pWages_ubal, effect = "time",
1368    model = "random", inst.method = "bvk")
1369
1370Unbalanced Panel: n = 595, T = 1-7, N = 4149
1371
1372Effects:
1373                 var std.dev share
1374idiosyncratic 0.1267  0.3559     1
1375time          0.0000  0.0000     0
1376theta:
1377   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1378      0       0       0       0       0       0
1379
1380Residuals:
1381      Min.    1st Qu.     Median    3rd Qu.       Max.
1382-1.9960628 -0.2575742 -0.0060508  0.2675715  2.1579866
1383
1384Coefficients:
1385               Estimate  Std. Error  z-value Pr(>|z|)
1386(Intercept)  6.0335e+00  6.1226e-02  98.5444   <2e-16 ***
1387wks          3.3238e-03  1.2072e-03   2.7533   0.0059 **
1388marriedyes   3.2084e-01  1.6130e-02  19.8905   <2e-16 ***
1389exp          3.6349e-02  2.4441e-03  14.8720   <2e-16 ***
1390I(exp^2)    -6.3990e-04  5.3793e-05 -11.8954   <2e-16 ***
1391bluecolyes  -3.2373e-01  1.2389e-02 -26.1299   <2e-16 ***
1392---
1393Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1394
1395Total Sum of Squares:    883.99
1396Residual Sum of Squares: 652.02
1397R-Squared:      0.26241
1398Adj. R-Squared: 0.26152
1399Chisq: 1473.97 on 5 DF, p-value: < 2.22e-16
1400>
1401> IVbalt_t_ubal <- plm(form_wage_iv2,
1402+                data = pWages_ubal,
1403+                model = "random", inst.method = "baltagi", effect = "time")
1404> summary(IVbalt_t_ubal)
1405Oneway (time) effect Random Effect Model
1406   (Swamy-Arora's transformation)
1407Instrumental variable estimation
1408   (Baltagi's transformation)
1409
1410Call:
1411plm(formula = form_wage_iv2, data = pWages_ubal, effect = "time",
1412    model = "random", inst.method = "baltagi")
1413
1414Unbalanced Panel: n = 595, T = 1-7, N = 4149
1415
1416Effects:
1417                 var std.dev share
1418idiosyncratic 0.1267  0.3559     1
1419time          0.0000  0.0000     0
1420theta:
1421   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1422      0       0       0       0       0       0
1423
1424Residuals:
1425     Min.   1st Qu.    Median   3rd Qu.      Max.
1426-5.608286 -0.723549 -0.016968  0.751478  6.062804
1427
1428Coefficients:
1429               Estimate  Std. Error  z-value  Pr(>|z|)
1430(Intercept)  6.0336e+00  6.1226e-02  98.5463 < 2.2e-16 ***
1431wks          3.3236e-03  1.2072e-03   2.7532  0.005902 **
1432marriedyes   3.2096e-01  1.6130e-02  19.8980 < 2.2e-16 ***
1433exp          3.6323e-02  2.4442e-03  14.8609 < 2.2e-16 ***
1434I(exp^2)    -6.3932e-04  5.3795e-05 -11.8844 < 2.2e-16 ***
1435bluecolyes  -3.2374e-01  1.2389e-02 -26.1307 < 2.2e-16 ***
1436---
1437Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1438
1439Total Sum of Squares:    883.99
1440Residual Sum of Squares: 5147.1
1441R-Squared:      0.26241
1442Adj. R-Squared: 0.26152
1443Chisq: 1473.99 on 5 DF, p-value: < 2.22e-16
1444>
1445> IVam_t_ubal <- plm(form_wage_iv2,
1446+              data = pWages_ubal,
1447+              model = "random", inst.method = "am", effect = "time")
1448> summary(IVam_t_ubal)
1449Oneway (time) effect Random Effect Model
1450   (Swamy-Arora's transformation)
1451Instrumental variable estimation
1452   (Amemiya-MaCurdy's transformation)
1453
1454Call:
1455plm(formula = form_wage_iv2, data = pWages_ubal, effect = "time",
1456    model = "random", inst.method = "am")
1457
1458Unbalanced Panel: n = 595, T = 1-7, N = 4149
1459
1460Effects:
1461                 var std.dev share
1462idiosyncratic 0.1267  0.3559     1
1463time          0.0000  0.0000     0
1464theta:
1465   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1466      0       0       0       0       0       0
1467
1468Residuals:
1469     Min.   1st Qu.    Median   3rd Qu.      Max.
1470-5.608287 -0.723547 -0.016967  0.751478  6.062799
1471
1472Coefficients:
1473               Estimate  Std. Error  z-value  Pr(>|z|)
1474(Intercept)  6.0336e+00  6.1226e-02  98.5463 < 2.2e-16 ***
1475wks          3.3236e-03  1.2072e-03   2.7532  0.005902 **
1476marriedyes   3.2096e-01  1.6130e-02  19.8980 < 2.2e-16 ***
1477exp          3.6323e-02  2.4442e-03  14.8607 < 2.2e-16 ***
1478I(exp^2)    -6.3931e-04  5.3795e-05 -11.8842 < 2.2e-16 ***
1479bluecolyes  -3.2374e-01  1.2389e-02 -26.1307 < 2.2e-16 ***
1480---
1481Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1482
1483Total Sum of Squares:    883.99
1484Residual Sum of Squares: 5147.1
1485R-Squared:      0.26241
1486Adj. R-Squared: 0.26152
1487Chisq: 1473.99 on 5 DF, p-value: < 2.22e-16
1488>
1489> IVbms_t_ubal <- plm(form_wage_iv2,
1490+               data = pWages_ubal,
1491+               model = "random", inst.method = "bms", effect = "time")
1492> summary(IVbms_t_ubal)
1493Oneway (time) effect Random Effect Model
1494   (Swamy-Arora's transformation)
1495Instrumental variable estimation
1496   (Breusch-Mizon-Schmidt's transformation)
1497
1498Call:
1499plm(formula = form_wage_iv2, data = pWages_ubal, effect = "time",
1500    model = "random", inst.method = "bms")
1501
1502Unbalanced Panel: n = 595, T = 1-7, N = 4149
1503
1504Effects:
1505                 var std.dev share
1506idiosyncratic 0.1267  0.3559     1
1507time          0.0000  0.0000     0
1508theta:
1509   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1510      0       0       0       0       0       0
1511
1512Residuals:
1513     Min.   1st Qu.    Median   3rd Qu.      Max.
1514-5.608281 -0.723591 -0.017027  0.751556  6.062881
1515
1516Coefficients:
1517               Estimate  Std. Error  z-value  Pr(>|z|)
1518(Intercept)  6.0335e+00  6.1226e-02  98.5452 < 2.2e-16 ***
1519wks          3.3233e-03  1.2072e-03   2.7529  0.005907 **
1520marriedyes   3.2099e-01  1.6130e-02  19.8997 < 2.2e-16 ***
1521exp          3.6332e-02  2.4442e-03  14.8648 < 2.2e-16 ***
1522I(exp^2)    -6.3952e-04  5.3794e-05 -11.8884 < 2.2e-16 ***
1523bluecolyes  -3.2374e-01  1.2389e-02 -26.1307 < 2.2e-16 ***
1524---
1525Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1526
1527Total Sum of Squares:    883.99
1528Residual Sum of Squares: 5147.1
1529R-Squared:      0.26241
1530Adj. R-Squared: 0.26152
1531Chisq: 1474.18 on 5 DF, p-value: < 2.22e-16
1532>
1533> # texreg::screenreg(list("BVK tu" = IVbvk_t_ubal, "Baltagi tu" = IVbalt_t_ubal, "AM tu" = IVam_t_ubal, "BMS tu" = IVbms_t_ubal),
1534> #                  digits = 5)
1535>
1536>
1537> ### twoway RE estimation: currently prevented (error informatively)
1538> # IVbvktw <- plm(form_wage_iv2,
1539> #               data = pWages,
1540> #               model = "random", inst.method = "bvk", effect = "twoways")
1541> # summary(IVbvktw)
1542> #
1543> # IVbalttw <- plm(form_wage_iv2,
1544> #                data = pWages,
1545> #                model = "random", inst.method = "baltagi", effect = "twoways")
1546> # summary(IVbalttw)
1547> #
1548> # IVamtw <- plm(form_wage_iv2,
1549> #              data = pWages,
1550> #              model = "random", inst.method = "am", effect = "twoways")
1551> # summary(IVamtw)
1552> #
1553> # IVbmstw <- plm(form_wage_iv2,
1554> #               data = pWages,
1555> #               model = "random", inst.method = "bms", effect = "twoways")
1556> # summary(IVbmstw)
1557> #
1558> # texreg::screenreg(list("BVK tw" = IVbvktw, "Baltagi tw" = IVbalttw, "AM tw" = IVamtw, "BMS tw" = IVbmstw),
1559> #                   digits = 5)
1560>
1561>
1562>
1563> proc.time()
1564   user  system elapsed
1565   9.32    0.18    9.54
1566