# Packages ----
library(archive)
library(haven)
library(dplyr)
library(broom)
library(ivreg) # for 2SLS regression
# Extract ----
<- "first-edition/Chapter-9.zip"
fzip <- gsub("\\.zip$", "", fzip)
dout
if (!dir.exists(dout)) {
archive_extract(fzip, dir = dout)
}
# Read and transform ----
<- paste0(dout, "/china_fdi.rds")
fout
if (!file.exists(fout)) {
<- read_dta(paste0(dout, "/china_fdi.dta"))
china_fdi
saveRDS(china_fdi, fout)
else {
} <- readRDS(fout)
china_fdi }
Chapter 9. Political Economy of Trade Policy
Empirical exercise
This exercise is to reproduce regression results Branstetter and Feenstra (2002). To complete the exercise, the file “china_fdi.dta” should be stored in Chapter-9
.
Documentation
The primary data set is a file, in STATA format, called china_fdi.dta. An extended list and description of the variables are given below.
Variable | Brief Description |
---|---|
pcode | Province Code |
pname | Province Name |
year | 1978-1996 |
output | Total output |
state | State-owned firm output |
coll | Output of collectives |
indi | Output of individual enterprises |
others | Output of other firms |
fiech | fie2 + oversea2 |
other2 | Finer breakdown of other output |
stock2 | Output of stock companies |
fie2 | Output of Foreign-Invested Enterprises (FIEs) |
oversea2 | Output of Overseas Chinese FIEs |
fiexrat | cx_fo / fiech |
cx_fo | (cx_or_fo + cx_pr_fo + cx_ot_fo) |
import | Imports from provincial data |
export | Exports from provincial data |
loan | Foreign loans |
fdi | Foreign direct investments |
ofdi | Other Foreign Direct Investment (FDI) |
fdidum | Dummy variable (1 if fdi > 0 & fdi != .) |
cx_tot | Total exports from customs data |
cm_tot | Total imports from customs data |
cx_or_st | Ordinary trade exports, State-Owned Enterprises (SOEs) |
cm_or_st | Ordinary trade imports, SOEs |
cx_or_fo | Ordinary trade exports, FIEs |
cm_or_fo | Ordinary trade imports, FIEs |
cx_or_ot | Ordinary trade exports, others |
cm_or_ot | Ordinary trade imports, others |
cx_pr_st | Processing trade exports, SOEs |
cm_pr_st | Processing trade imports, SOEs |
cx_pr_fo | Processing trade exports, FIEs |
cm_pr_fo | Processing trade imports, FIEs |
cx_pr_ot | Processing trade exports, others |
cm_pr_ot | Processing trade imports, others |
cx_ot_st | Other trade exports, SOEs |
cm_ot_st | Other trade imports, SOEs |
cx_ot_fo | Other trade exports, FIEs |
cm_ot_fo | Other trade imports, FIEs |
cx_ot_ot | Other trade exports, others |
cm_ot_ot | Other trade imports, others |
totwage | Total wages |
soewage | SOE wages |
collwage | Urban collective wages |
othwage | Other wages |
premium | othwage / ((soewage + collwage) / 2) |
totalemp | Total provincial employment |
urbanemp | Total urban employment (in 10,000 people) |
soeemp | SOE employment |
collemp | Total (urban) collective employment |
ruralemp | Total rural employment |
tveemp | Total township and village enterprise employment |
jointemp | Total joint-owned employment |
fieemp | FIE employment |
overemp | Employment by overseas Chinese |
indemp | Employment by individual businesses |
fieshr | fieemp / (jointemp + fieemp + overemp) |
fiechshr | (fieemp + overemp) / (jointemp + fieemp) |
statrat1 | state / appcons |
impute | =1 if output is imputed |
coastal | =1 if coastal province |
suprox | =1 if Fujian or Guangdong |
tariff96 | 1996 tariff estimates |
merge1 | Old merge variable for tariffs? |
fdirv | Sets fdi=0 if missing |
fdistock | Cumulative FDI stock |
fdidum2 | =1 if fdistock > 0 |
fierat1 | fiech / (output + import) |
imprat1 | import / (output + import) |
fdi_imp1 | fdistock * imprat1 |
tar_imp1 | tariff96 * imprat1 |
lfdistok | Lagged fdistock |
tar_imp | tariff96 * import |
fdi_imp | fdistock * import |
lfdi_imp | Lagged fdistock * import |
tar_stat | tariff96 * state |
lfdi_sta | Lagged fdistock * state |
tar_lfdi | tariff96 * lagged fdistock |
stat_imp | state * import |
imp_prem | import * newprem |
sta_prem | state * newprem |
lfdi_pre | lfdistok * newprem |
newprem | (othwage - collwage) / other |
tar_prem | tariff96 * newprem |
statrat3 | = statrat2 if y >= 1988, pc != 11,54 |
fierat3 | = fierat2 if y >= 1988, pc != 11,54 |
imprat3 | = imprat2 if y >= 1988, pc != 11,54 |
fdi_imp3 | fdistock * imprat3 |
tar_imp3 | tariff96 * imprat3 |
Note: Additional interaction terms and various residuals are present in the dataset, often used as instruments for econometric analyses.
Exercise 1
Run the program share_reg.do
to reproduce the regression results in Table 9.1. Notice that apparent consumption (appcon3
) is included as a control variables in these regressions. What happens if this variable is dropped?
Feenstra’s code
clear
capture log close
log using Z:\home\pacha\github\advanced-international-trade\first-edition\Chapter-9\share_reg.log,replace
use Z:\home\pacha\github\advanced-international-trade\first-edition\Chapter-9\china_fdi,clear
set matsize 100
reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 if fiech3>0, r
reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 /*
*/ (elecpro elecgdp elecpop elecurb elecrur elecwag elecwags elecwagu cmpr3 /*
*/ cmprgdp cmprpop cmprelec indewag indewags indewagu gdp pop urbaninc rurinc /*
*/ pd1-pd30 yd1-yd18) if fiech3>0, r
reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 /*
*/ (elecpro elecgdp elecpop elecurb elecrur elecwag elecwags elecwagu cmpr3 /*
*/ cmprgdp cmprpop cmprelec indewag indewags indewagu gdp pop urbaninc rurinc /*
*/ pd1-pd30 yd1-yd18) [w=gdp] if fiech3>0, r
matrix cv=get(VCE)
matrix cv1 = cv[1..3,1..3]
matrix list cv1
reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 /*
*/ (elecpro elecgdp elecpop elecurb elecrur elecwag elecwags elecwagu cmpr3 /*
*/ cmprgdp cmprpop cmprelec indewag indewags indewagu gdp pop urbaninc rurinc /*
*/ pd1-pd30 yd1-yd18) [w=gdp] if fiech3>0 & year>=1988, r
matrix cv=get(VCE)
matrix cv1 = cv[1..3,1..3]
matrix list cv1
reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 /*
*/ (elecpro elecgdp elecpop elecurb elecrur elecwag elecwags elecwagu cmpr3 /*
*/ cmprgdp cmprpop cmprelec indewag indewags indewagu gdp pop urbaninc rurinc /*
*/ pd1-pd30 yd1-yd18) [w=gdp] if fiech3>0 & year>=1990, r
matrix cv=get(VCE)
matrix cv1 = cv[1..3,1..3]
matrix list cv1
log close
Output:
clear
.
capture log close
.
log using Z:\home\pacha\github\advanced-international-trade\first-edition\Chapter-9\share_reg.log,replace
. note: file Z:\home\pacha\github\advanced-international-trade\first-edition\Chapter-9\share_reg.log not found)
(
------------------------------------------------------------------------------------------------------------------------name: <unnamed>
log: Z:\home\pacha\github\advanced-international-trade\first-edition\Chapter-9\share_reg.log
log type: text
on: 27 Oct 2024, 17:14:23
opened
. use Z:\home\pacha\github\advanced-international-trade\first-edition\Chapter-9\china_fdi,clear
.
. set matsize 100
.
memory allocation
Current
memory usage
current value description (1M = 1024k)
settable
--------------------------------------------------------------------set maxvar 5000 max. variables allowed 1.909M
set memory 50M max. data space 50.000M
set matsize 100 max. RHS vars in models 0.085M
-----------
51.994M
. reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 if fiech3>0, r
. note: pd25 omitted because of collinearity
note: pd28 omitted because of collinearity
note: yd1 omitted because of collinearity
note: yd2 omitted because of collinearity
note: yd3 omitted because of collinearity
note: yd4 omitted because of collinearity
note: yd5 omitted because of collinearity
note: yd6 omitted because of collinearity
note: yd8 omitted because of collinearity
of obs = 297
Linear regression Number F( 45, 251) = 13.17
F = 0.0000
Prob >
R-squared = 0.8517
Root MSE = 70.771
------------------------------------------------------------------------------
| Robust
fiech3 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
state3 | -.4120043 .1252756 -3.29 0.001 -.6587296 -.1652789
premsta3 | .418439 .2349873 1.78 0.076 -.0443591 .8812372
tar_cm3 | -.1462319 2.698182 -0.05 0.957 -5.460194 5.16773
newprem | -118.4885 63.81774 -1.86 0.065 -244.175 7.197995
fdi2_cm3 | 3.67e-07 2.21e-07 1.66 0.099 -6.89e-08 8.03e-07
appcons3 | .1085887 .0181638 5.98 0.000 .0728158 .1443616
pd1 | 138.6463 53.32884 2.60 0.010 33.61727 243.6753
pd2 | 111.7079 53.14862 2.10 0.037 7.033765 216.3819
pd3 | 47.80944 46.13068 1.04 0.301 -43.0431 138.662
pd4 | 38.63599 36.39048 1.06 0.289 -33.03362 110.3056
pd5 | 33.63291 33.2422 1.01 0.313 -31.83628 99.1021
pd6 | 56.76019 96.64213 0.59 0.558 -133.5726 247.093
pd7 | 63.22479 44.37549 1.42 0.155 -24.17098 150.6206
pd8 | 91.16894 58.7561 1.55 0.122 -24.54885 206.8867
pd9 | 334.7459 91.91022 3.64 0.000 153.7324 515.7594
pd10 | 91.62152 56.68167 1.62 0.107 -20.01078 203.2538
pd11 | -23.90319 42.97933 -0.56 0.579 -108.5493 60.74289
pd12 | 15.61683 44.60963 0.35 0.727 -72.24007 103.4737
pd13 | 97.31858 42.69299 2.28 0.023 13.23643 181.4007
pd14 | 32.84924 34.97525 0.94 0.349 -36.03311 101.7316
pd15 | -12.67496 71.00855 -0.18 0.858 -152.5235 127.1735
pd16 | 43.48629 48.61576 0.89 0.372 -52.26052 139.2331
pd17 | 78.74117 55.86131 1.41 0.160 -31.27545 188.7578
pd18 | 42.05588 42.98484 0.98 0.329 -42.60106 126.7128
pd19 | 5.776277 104.8443 0.06 0.956 -200.7105 212.263
pd20 | 38.00421 36.7446 1.03 0.302 -34.36282 110.3712
pd21 | 14.8177 32.051 0.46 0.644 -48.30546 77.94086
pd22 | 76.34966 66.17087 1.15 0.250 -53.97124 206.6706
pd23 | 33.08723 29.60536 1.12 0.265 -25.21934 91.39381
pd24 | 44.62833 38.59018 1.16 0.249 -31.3735 120.6302
pd25 | (omitted)
pd26 | 39.83218 37.3268 1.07 0.287 -33.68146 113.3458
pd27 | 45.07108 33.09393 1.36 0.174 -20.1061 110.2483
pd28 | (omitted)
pd29 | -3.537009 27.8295 -0.13 0.899 -58.34611 51.27209
pd30 | 42.1159 31.27092 1.35 0.179 -19.47094 103.7027
yd1 | (omitted)
yd2 | (omitted)
yd3 | (omitted)
yd4 | (omitted)
yd5 | (omitted)
yd6 | (omitted)
yd7 | -7.813549 31.83694 -0.25 0.806 -70.51514 54.88804
yd8 | (omitted)
yd9 | 4.66118 19.13492 0.24 0.808 -33.02428 42.34664
yd10 | 8.009458 18.69165 0.43 0.669 -28.803 44.82192
yd11 | 4.120545 19.32224 0.21 0.831 -33.93384 42.17493
yd12 | 15.40138 20.54087 0.75 0.454 -25.05304 55.85579
yd13 | 18.11733 19.94841 0.91 0.365 -21.17027 57.40493
yd14 | 21.38019 23.03616 0.93 0.354 -23.98861 66.74899
yd15 | 37.6667 27.87403 1.35 0.178 -17.23009 92.56349
yd16 | 29.59672 34.22505 0.86 0.388 -37.80815 97.00159
yd17 | 9.661191 37.11564 0.26 0.795 -63.43658 82.75896
yd18 | 114.3398 43.81527 2.61 0.010 28.04735 200.6322_cons | 8.138607 42.66315 0.19 0.849 -75.88476 92.16198
------------------------------------------------------------------------------
. reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 /*
. > */ (elecpro elecgdp elecpop elecurb elecrur elecwag elecwags elecwagu cmpr3 /*
> */ cmprgdp cmprpop cmprelec indewag indewags indewagu gdp pop urbaninc rurinc /*
> */ pd1-pd30 yd1-yd18) if fiech3>0, r
of obs = 280
Instrumental variables (2SLS) regression Number F( 43, 236) = 11.69
F = 0.0000
Prob >
R-squared = 0.7437
Root MSE = 94.71
------------------------------------------------------------------------------
| Robust
fiech3 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
state3 | -1.301465 .4036078 -3.22 0.001 -2.096599 -.5063307
premsta3 | 2.188291 .8745997 2.50 0.013 .4652708 3.911311
tar_cm3 | -7.4778 3.316947 -2.25 0.025 -14.01241 -.9431926
newprem | -967.166 435.0548 -2.22 0.027 -1824.253 -110.079
fdi2_cm3 | 3.73e-07 1.73e-07 2.15 0.032 3.18e-08 7.14e-07
appcons3 | .1501362 .0251856 5.96 0.000 .1005188 .1997536
pd1 | 22.49351 84.71518 0.27 0.791 -144.4011 189.3881
pd2 | (omitted)
pd3 | -101.9567 68.5424 -1.49 0.138 -236.9898 33.07639
pd4 | -62.65556 118.8012 -0.53 0.598 -296.702 171.3908
pd5 | -261.3773 128.8722 -2.03 0.044 -515.2641 -7.490483
pd6 | (omitted)
pd7 | -95.03245 83.30879 -1.14 0.255 -259.1563 69.09143
pd8 | -32.86181 81.23209 -0.40 0.686 -192.8945 127.1708
pd9 | 324.31 65.47577 4.95 0.000 195.3183 453.3016
pd10 | 24.40901 44.81474 0.54 0.586 -63.87903 112.697
pd11 | -240.2662 82.48247 -2.91 0.004 -402.7622 -77.7702
pd12 | -185.4254 106.2032 -1.75 0.082 -394.6528 23.80195
pd13 | -38.63878 118.8187 -0.33 0.745 -272.7195 195.442
pd14 | -136.9162 106.3078 -1.29 0.199 -346.3496 72.51729
pd15 | (omitted)
pd16 | -75.15068 69.47177 -1.08 0.280 -212.0147 61.71335
pd17 | 14.33876 50.61352 0.28 0.777 -85.37326 114.0508
pd18 | -116.985 87.18557 -1.34 0.181 -288.7464 54.77642
pd19 | -40.35602 124.3852 -0.32 0.746 -285.4032 204.6911
pd20 | -179.2321 101.3529 -1.77 0.078 -378.904 20.43983
pd21 | -119.2624 149.9743 -0.80 0.427 -414.7219 176.197
pd22 | 10.03015 64.99138 0.15 0.877 -118.0072 138.0675
pd23 | -157.3637 121.3052 -1.30 0.196 -396.3431 81.61573
pd24 | -170.5148 103.4955 -1.65 0.101 -374.4078 33.37831
pd25 | (omitted)
pd26 | -136.5358 112.6071 -1.21 0.227 -358.3793 85.30762
pd27 | -130.0935 103.6251 -1.26 0.211 -334.2418 74.05478
pd28 | -213.2504 156.1108 -1.37 0.173 -520.7991 94.29841
pd29 | -371.6727 159.8529 -2.33 0.021 -686.5936 -56.75185
pd30 | -131.4453 106.1748 -1.24 0.217 -340.6168 77.72623
yd1 | (omitted)
yd2 | (omitted)
yd3 | (omitted)
yd4 | (omitted)
yd5 | (omitted)
yd6 | (omitted)
yd7 | (omitted)
yd8 | -23.25973 50.76326 -0.46 0.647 -123.2667 76.74728
yd9 | -12.41766 50.90956 -0.24 0.808 -112.7129 87.87757
yd10 | 15.76796 48.88126 0.32 0.747 -80.53139 112.0673
yd11 | 43.42377 51.59704 0.84 0.401 -58.22585 145.0734
yd12 | 79.3707 56.02184 1.42 0.158 -30.99606 189.7375
yd13 | 77.22576 55.69696 1.39 0.167 -32.50098 186.9525
yd14 | 98.32196 60.62045 1.62 0.106 -21.10439 217.7483
yd15 | 129.245 67.84135 1.91 0.058 -4.407003 262.897
yd16 | 134.9046 72.58903 1.86 0.064 -8.100661 277.9098
yd17 | 92.58514 67.73654 1.37 0.173 -40.86038 226.0307
yd18 | 218.5723 79.71104 2.74 0.007 61.53622 375.6084_cons | 469.3039 197.0992 2.38 0.018 81.00532 857.6025
------------------------------------------------------------------------------
. reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 /*
. > */ (elecpro elecgdp elecpop elecurb elecrur elecwag elecwags elecwagu cmpr3 /*
> */ cmprgdp cmprpop cmprelec indewag indewags indewagu gdp pop urbaninc rurinc /*
> */ pd1-pd30 yd1-yd18) [w=gdp] if fiech3>0, r
(analytic weights assumed)sum of wgt is 2.4017e+05)
(
of obs = 280
Instrumental variables (2SLS) regression Number F( 43, 236) = 26.43
F = 0.0000
Prob >
R-squared = 0.7550
Root MSE = 171.68
------------------------------------------------------------------------------
| Robust
fiech3 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
state3 | -1.660521 .4807088 -3.45 0.001 -2.607549 -.7134923
premsta3 | 3.618218 1.160893 3.12 0.002 1.331182 5.905255
tar_cm3 | -15.85201 5.11311 -3.10 0.002 -25.92518 -5.778843
newprem | -3333.269 1085.09 -3.07 0.002 -5470.97 -1195.569
fdi2_cm3 | 5.17e-07 1.25e-07 4.12 0.000 2.70e-07 7.65e-07
appcons3 | .1497793 .0216163 6.93 0.000 .1071937 .1923649
pd1 | 151.3819 205.4259 0.74 0.462 -253.321 556.0847
pd2 | (omitted)
pd3 | -136.5562 231.6549 -0.59 0.556 -592.9319 319.8195
pd4 | 131.699 236.2008 0.56 0.578 -333.6322 597.0303
pd5 | -519.0087 313.4677 -1.66 0.099 -1136.561 98.54363
pd6 | (omitted)
pd7 | -94.63755 227.7186 -0.42 0.678 -543.2584 353.9833
pd8 | -97.71278 248.7448 -0.39 0.695 -587.7566 392.331
pd9 | 504.7952 252.3469 2.00 0.047 7.654983 1001.935
pd10 | 11.20123 247.3212 0.05 0.964 -476.038 498.4405
pd11 | -384.5489 224.5097 -1.71 0.088 -826.8481 57.75023
pd12 | -170.7961 215.2741 -0.79 0.428 -594.9006 253.3083
pd13 | 234.0235 204.0305 1.15 0.253 -167.9302 635.9771
pd14 | -4.280486 199.6937 -0.02 0.983 -397.6905 389.1295
pd15 | -61.50421 250.3792 -0.25 0.806 -554.7679 431.7595
pd16 | -48.59471 226.6831 -0.21 0.830 -495.1755 397.9861
pd17 | 3.428437 244.1047 0.01 0.989 -477.4742 484.331
pd18 | -83.46781 215.5776 -0.39 0.699 -508.17 341.2344
pd19 | 335.7746 280.9931 1.19 0.233 -217.8006 889.3499
pd20 | -237.5962 238.2537 -1.00 0.320 -706.9719 231.7795
pd21 | 254.9373 222.6991 1.14 0.253 -183.7948 693.6694
pd22 | -172.099 259.6178 -0.66 0.508 -683.5633 339.3653
pd23 | -4.580315 199.7805 -0.02 0.982 -398.1613 389.0006
pd24 | -248.713 253.6054 -0.98 0.328 -748.3327 250.9066
pd25 | (omitted)
pd26 | 89.16112 207.6892 0.43 0.668 -320.0004 498.3226
pd27 | -212.042 251.1014 -0.84 0.399 -706.7285 282.6444
pd28 | (omitted)
pd29 | -622.8209 321.3912 -1.94 0.054 -1255.983 10.34126
pd30 | -171.1686 225.7568 -0.76 0.449 -615.9247 273.5874
yd1 | (omitted)
yd2 | (omitted)
yd3 | (omitted)
yd4 | (omitted)
yd5 | (omitted)
yd6 | (omitted)
yd7 | 43.01289 141.6405 0.30 0.762 -236.0284 322.0542
yd8 | (omitted)
yd9 | 20.60074 86.75487 0.24 0.813 -150.3122 191.5136
yd10 | 140.6733 92.57702 1.52 0.130 -41.70964 323.0562
yd11 | 249.315 113.0118 2.21 0.028 26.6742 471.9558
yd12 | 297.7457 121.7527 2.45 0.015 57.88479 537.6067
yd13 | 301.1773 125.5635 2.40 0.017 53.80884 548.5457
yd14 | 364.4928 141.5999 2.57 0.011 85.5315 643.4542
yd15 | 432.1373 159.4536 2.71 0.007 118.003 746.2716
yd16 | 462.5475 187.6808 2.46 0.014 92.80381 832.2912
yd17 | 408.6656 200.4563 2.04 0.043 13.75323 803.578
yd18 | 580.9932 201.3976 2.88 0.004 184.2265 977.76_cons | 898.3402 356.9691 2.52 0.013 195.0871 1601.593
------------------------------------------------------------------------------
. matrix cv=get(VCE)
.
. matrix cv1 = cv[1..3,1..3]
.
. matrix list cv1
.
symmetric cv1[3,3]
state3 premsta3 tar_cm3
state3 .23108091
premsta3 -.5216955 1.3476718
tar_cm3 1.511459 -3.9109265 26.143895
. reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 /*
. > */ (elecpro elecgdp elecpop elecurb elecrur elecwag elecwags elecwagu cmpr3 /*
> */ cmprgdp cmprpop cmprelec indewag indewags indewagu gdp pop urbaninc rurinc /*
> */ pd1-pd30 yd1-yd18) [w=gdp] if fiech3>0 & year>=1988, r
(analytic weights assumed)sum of wgt is 2.1445e+05)
(
of obs = 210
Instrumental variables (2SLS) regression Number F( 39, 170) = 23.69
F = 0.0000
Prob >
R-squared = 0.8734
Root MSE = 130.7
------------------------------------------------------------------------------
| Robust
fiech3 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
state3 | -1.320297 .497583 -2.65 0.009 -2.302534 -.3380597
premsta3 | 2.553575 1.187916 2.15 0.033 .2086084 4.898541
tar_cm3 | -11.46246 6.712541 -1.71 0.090 -24.71313 1.788208
newprem | -2519.84 1256.346 -2.01 0.046 -4999.888 -39.7934
fdi2_cm3 | 4.85e-07 1.50e-07 3.23 0.001 1.89e-07 7.81e-07
appcons3 | .1486559 .024088 6.17 0.000 .1011058 .196206
pd1 | 163.2254 169.4229 0.96 0.337 -171.2181 497.6689
pd2 | (omitted)
pd3 | -34.73277 188.4823 -0.18 0.854 -406.7999 337.3344
pd4 | 51.19367 183.792 0.28 0.781 -311.6148 414.0022
pd5 | -368.2653 282.3617 -1.30 0.194 -925.652 189.1214
pd6 | (omitted)
pd7 | -8.148863 187.4163 -0.04 0.965 -378.1118 361.814
pd8 | 42.97417 207.3155 0.21 0.836 -366.2702 452.2185
pd9 | 598.6921 241.8478 2.48 0.014 121.2806 1076.104
pd10 | 63.07135 209.5412 0.30 0.764 -350.5666 476.7093
pd11 | -339.0711 190.8114 -1.78 0.077 -715.736 37.59373
pd12 | -64.59059 172.208 -0.38 0.708 -404.5321 275.3509
pd13 | 196.2458 173.3039 1.13 0.259 -145.859 538.3505
pd14 | 33.28636 161.2055 0.21 0.837 -284.936 351.5087
pd15 | -35.32299 218.3816 -0.16 0.872 -466.4118 395.7658
pd16 | 7.898497 190.3217 0.04 0.967 -367.7998 383.5968
pd17 | 58.21349 208.674 0.28 0.781 -353.7125 470.1395
pd18 | -7.502736 175.9845 -0.04 0.966 -354.8991 339.8936
pd19 | 192.1812 346.1707 0.56 0.580 -491.1656 875.528
pd20 | -160.9523 206.8624 -0.78 0.438 -569.3022 247.3976
pd21 | 192.3007 199.4306 0.96 0.336 -201.3787 585.9802
pd22 | -48.786 215.9674 -0.23 0.822 -475.1092 377.5372
pd23 | 27.90071 159.6185 0.17 0.861 -287.1889 342.9903
pd24 | -136.5801 218.0904 -0.63 0.532 -567.0941 293.934
pd25 | (omitted)
pd26 | 164.0468 177.9983 0.92 0.358 -187.3247 515.4184
pd27 | -238.2111 238.5003 -1.00 0.319 -709.0147 232.5925
pd28 | (omitted)
pd29 | -464.9702 303.1842 -1.53 0.127 -1063.461 133.5205
pd30 | -152.6274 201.0469 -0.76 0.449 -549.4973 244.2425
yd1 | (omitted)
yd2 | (omitted)
yd3 | (omitted)
yd4 | (omitted)
yd5 | (omitted)
yd6 | (omitted)
yd7 | (omitted)
yd8 | (omitted)
yd9 | (omitted)
yd10 | (omitted)
yd11 | (omitted)
yd12 | 42.70326 47.13385 0.91 0.366 -50.33976 135.7463
yd13 | 45.25918 45.69599 0.99 0.323 -44.94548 135.4638
yd14 | 97.22254 61.23666 1.59 0.114 -23.65965 218.1047
yd15 | 155.5728 85.44523 1.82 0.070 -13.09748 324.2432
yd16 | 186.4389 125.9879 1.48 0.141 -62.26333 435.1412
yd17 | 136.0366 144.7728 0.94 0.349 -149.7474 421.8206
yd18 | 315.0861 143.2271 2.20 0.029 32.35332 597.8188_cons | 842.7119 438.2943 1.92 0.056 -22.48842 1707.912
------------------------------------------------------------------------------
. matrix cv=get(VCE)
.
. matrix cv1 = cv[1..3,1..3]
.
. matrix list cv1
.
symmetric cv1[3,3]
state3 premsta3 tar_cm3
state3 .24758885
premsta3 -.55788145 1.4111448
tar_cm3 1.8692088 -4.6693021 45.058204
. reg fiech3 state3 premsta3 tar_cm3 newprem fdi2_cm3 appcons3 pd1-pd30 yd1-yd18 /*
. > */ (elecpro elecgdp elecpop elecurb elecrur elecwag elecwags elecwagu cmpr3 /*
> */ cmprgdp cmprpop cmprelec indewag indewags indewagu gdp pop urbaninc rurinc /*
> */ pd1-pd30 yd1-yd18) [w=gdp] if fiech3>0 & year>=1990, r
(analytic weights assumed)sum of wgt is 1.8621e+05)
(
of obs = 158
Instrumental variables (2SLS) regression Number F( 37, 120) = 24.51
F = 0.0000
Prob >
R-squared = 0.9150
Root MSE = 115.63
------------------------------------------------------------------------------
| Robust
fiech3 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
state3 | -1.037144 .485102 -2.14 0.035 -1.997612 -.0766754
premsta3 | 1.837028 1.160133 1.58 0.116 -.4599559 4.134011
tar_cm3 | -9.974153 7.575814 -1.32 0.190 -24.97374 5.025432
newprem | -2125.903 1396.838 -1.52 0.131 -4891.545 639.7383
fdi2_cm3 | 5.11e-07 1.60e-07 3.19 0.002 1.94e-07 8.29e-07
appcons3 | .1446918 .0269515 5.37 0.000 .0913298 .1980538
pd1 | 175.8829 154.8554 1.14 0.258 -130.7201 482.4859
pd2 | (omitted)
pd3 | -23.40224 173.3892 -0.13 0.893 -366.7008 319.8963
pd4 | -33.34945 158.2301 -0.21 0.833 -346.634 279.9351
pd5 | -183.8552 209.1258 -0.88 0.381 -597.9097 230.1993
pd6 | (omitted)
pd7 | 43.79854 168.3807 0.26 0.795 -289.5835 377.1806
pd8 | 99.2044 192.0972 0.52 0.607 -281.1347 479.5435
pd9 | 677.295 252.7652 2.68 0.008 176.8374 1177.752
pd10 | 61.92765 195.3322 0.32 0.752 -324.8165 448.6718
pd11 | -330.9045 175.7311 -1.88 0.062 -678.8399 17.03093
pd12 | -30.48932 156.9822 -0.19 0.846 -341.3031 280.3245
pd13 | 201.1421 166.0392 1.21 0.228 -127.604 529.8881
pd14 | 42.74646 144.145 0.30 0.767 -242.6506 328.1435
pd15 | -82.50432 214.247 -0.39 0.701 -506.6984 341.6897
pd16 | 15.49172 176.6563 0.09 0.930 -334.2755 365.2589
pd17 | 42.55748 199.6531 0.21 0.832 -352.7417 437.8567
pd18 | 9.402431 160.6178 0.06 0.953 -308.6096 327.4145
pd19 | 167.9075 418.6528 0.40 0.689 -660.9959 996.811
pd20 | -120.0367 187.6748 -0.64 0.524 -491.6197 251.5464
pd21 | 170.3136 193.863 0.88 0.381 -213.5217 554.1488
pd22 | -24.40219 200.0268 -0.12 0.903 -420.4413 371.6369
pd23 | 59.87 143.5248 0.42 0.677 -224.299 344.039
pd24 | -82.74678 202.1043 -0.41 0.683 -482.8992 317.4057
pd25 | (omitted)
pd26 | 180.1916 173.7741 1.04 0.302 -163.8691 524.2523
pd27 | -231.2034 255.1446 -0.91 0.367 -736.3719 273.9651
pd28 | (omitted)
pd29 | -404.6779 325.7161 -1.24 0.217 -1049.573 240.2173
pd30 | -173.7454 217.6256 -0.80 0.426 -604.6289 257.1381
yd1 | (omitted)
yd2 | (omitted)
yd3 | (omitted)
yd4 | (omitted)
yd5 | (omitted)
yd6 | (omitted)
yd7 | (omitted)
yd8 | (omitted)
yd9 | (omitted)
yd10 | (omitted)
yd11 | (omitted)
yd12 | (omitted)
yd13 | -99.68378 152.6417 -0.65 0.515 -401.9037 202.5361
yd14 | -51.76248 127.3657 -0.41 0.685 -303.9377 200.4127
yd15 | 1.204476 98.69447 0.01 0.990 -194.2037 196.6127
yd16 | 35.94405 57.09284 0.63 0.530 -77.09581 148.9839
yd17 | (omitted)
yd18 | 171.8328 55.21844 3.11 0.002 62.50408 281.1614_cons | 826.6987 609.2366 1.36 0.177 -379.5473 2032.945
------------------------------------------------------------------------------
.
. matrix cv=get(VCE)
.
. matrix cv1 = cv[1..3,1..3]
.
. matrix list cv1
.
symmetric cv1[3,3]
state3 premsta3 tar_cm3
state3 .23532398
premsta3 -.52880818 1.3459097
tar_cm3 1.8540186 -4.6583376 57.392959
. log close
. name: <unnamed>
log: Z:\home\pacha\github\advanced-international-trade\first-edition\Chapter-9\share_reg.log
log type: text
on: 27 Oct 2024, 17:14:31
closed
------------------------------------------------------------------------------------------------------------------------
. end of do-file
My code
<- paste("pd", 1:30, sep = "", collapse = " + ")
pd_vars <- paste("yd", 1:18, sep = "", collapse = " + ")
yd_vars
<- paste("fiech3 ~ state3 + premsta3 + tar_cm3 + newprem + fdi2_cm3 + appcons3 +", pd_vars, "+", yd_vars)
formula_str
<- lm(as.formula(formula_str), data = filter(china_fdi, fiech3 > 0))
fit1
tidy(fit1)
# A tibble: 55 × 5
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 1.65e+2 41.6 3.96 9.89e- 5
2 state3 -4.12e-1 0.0794 -5.19 4.33e- 7
3 premsta3 4.18e-1 0.138 3.04 2.65e- 3
4 tar_cm3 -1.46e-1 1.18 -0.124 9.02e- 1
5 newprem -1.18e+2 65.2 -1.82 7.02e- 2
6 fdi2_cm3 3.67e-7 0.0000000750 4.89 1.80e- 6
7 appcons3 1.09e-1 0.00842 12.9 1.60e-29
8 pd1 9.65e+1 32.7 2.95 3.47e- 3
9 pd2 6.96e+1 32.7 2.13 3.41e- 2
10 pd3 5.69e+0 31.9 0.178 8.58e- 1
# ℹ 45 more rows
<- paste(
formula_str "fiech3 ~ state3 + premsta3 + tar_cm3 + newprem + fdi2_cm3 + appcons3 +", pd_vars, "+", yd_vars,
"| elecpro + elecgdp + elecpop + elecurb + elecrur + elecwag + elecwags + elecwagu + cmpr3 +",
"cmprgdp + cmprpop + cmprelec + indewag + indewags + indewagu + gdp + pop + urbaninc + rurinc +",
"+", yd_vars
pd_vars,
)
<- ivreg(as.formula(formula_str), data = filter(china_fdi, fiech3 > 0))
fit2
# tidy(fit2)
# fails with
# Error in solve.default(vcov.hyp) :
# system is computationally singular: reciprocal condition number = 9.20049e-21
Exercise 2
Open the excel file standard_errors.xls
to see how the results in Table 9.2 are computed. What formula is used for \(\alpha\), and for its variance and standard error? Justify these formulas.
Hint: Consider the easier case of taking the difference between \(\alpha\) and \(\beta\). Then:
\[ var(\alpha - \beta) = E[(\alpha - \beta) - (\bar{\alpha} - \bar{beta})]^2 = E f(\alpha,\beta), \]
where \(f(\alpha,\beta)\) is the quadratic function indicated. To compute this expected value, we take a second-order Taylor series expansion:
\[ f(\alpha,\beta) \approx f(\bar{\alpha},\bar{\beta}) + f_{\alpha}(\bar{\alpha},\bar{\beta})(\alpha - \bar{\alpha}) + f_{\beta}(\bar{\alpha},\bar{\beta})(\beta - \bar{\beta}) + \frac{1}{2} f_{\alpha\alpha}(\bar{\alpha},\bar{\beta})(\alpha - \bar{\alpha})^2 + \frac{1}{2} f_{\beta\beta}(\bar{\alpha},\bar{\beta})(\beta - \bar{\beta})^2 + f_{\alpha\beta}(\bar{\alpha},\bar{\beta})(\alpha - \bar{\alpha})(\beta - \bar{\beta}). \]
It follows that,
\[ Ef(\alpha,\beta) \approx \frac{1}{2} f_{\alpha\alpha}(\bar{\alpha},\bar{\beta}) \sigma_{\alpha}^2 + \frac{1}{2} f_{\beta\beta}(\bar{\alpha},\bar{\beta}) \sigma_{\beta}^2 + f_{\alpha\beta}(\bar{\alpha},\bar{\beta}) text{cov}(\alpha,\beta). \]
So computing the derivatives of the quadratic function \(f(\alpha,\beta)\), we obtain,
\[ \text{var}(\alpha - \beta) = E[(\alpha - \beta) - (\bar{\alpha} - \bar{\beta})]^2 \approx \sigma_{\alpha}^2 + \sigma_{\beta}^2- 2\text{cov}(\alpha,\beta). \]
Now given the formula for \(\alpha\), use the same approach to justify its variance.