stata hands on session

advertisement
GRAVITY EQUATION FOR INTERNATIONAL TRADE
MODELING
September 2014
CLASS SCRIPT: BASIC DEFINITIONS AND STATA HANDS ON EXERCISE
-
The content of this document, specially for the exercise section, is based on the
document prepared by UNCTAD-WTO entitled “A Practical Guide to Trade Policy
Analysis. (Chapter 3. Analyzing bilateral trade using the gravity equation).
To access to the on-line version of full volume visit the WEB page:
http://vi.unctad.org/tpa/index.html
1.- OTHER DOCS AND SOURCES OF INTEREST
OTHER RELEVANT WORKS for those who want to go further in this specific topic:
-
Head, K. (2003), “Gravity for beginners”, mimeo, University of British Columbia.
https://www3.nd.edu/~agervais/documents/Gravity.pdf
-
Another “accessible” example of a STATA Gravity – Models exercise:
http://www.agrodep.org/sites/default/files/Technical_notes/AGRODEP-TN-05_2.pdf
-
More detail about some
specification/estimation:
of
the
main
issues
on
the
econometrical
The Gravity Model in International Trade AGRODEP Technical Note TN -04. Luca
Salvatici.
http://www.agrodep.org/sites/default/files/Technical_notes/AGRODEP-TN-04-2_1.pdf
-
A really complete and in depth work about gravity equations and their use for
empirical exercises (almost 70 pages!).
Head, K., & Mayer, T. (2013). Gravity equations: Workhorse, toolkit, and cookbook.
Handbook of international economics, 4.
http://strategy.sauder.ubc.ca/head/papers/headmayer_revised.pdf
-
Seminal work on the econometric implications of Jensen’s inequality in the context of
gravity equation:
Silva, J. S., & Tenreyro, S. (2006). The log of gravity. The Review of Economics and
statistics, 88(4), 641-658.
http://personal.lse.ac.uk/tenreyro/jensen08k.pdf
1
-
Seminal paper about the role of Multilateral Trade Resistance term in gravity equation:
Anderson, J. E. and van Wincoop, E. (2003), “Gravity with gravitas: a solution to the
border puzzle”, American Economic Review 93: 170–92.
http://www.econ.ku.dk/Nguyen/teaching/Anderson%20van%20Wincoop%202003%20
Gravitas.pdf
2.- SOME BASIC THEORY AND DEFINITIONS
Foundations of a Gravity Model for international trade:
-
Following Newton expression for masses it states that, broadly constructed, trade
(attraction) between two countries is proportional to their size (size of the economy)
and inversely proportional to their distance.
-
Surprisingly enough, gravity equations did (and do) a pretty successful job at explaining
trade with just the size of the economies and their distances, even before that
someone did find a theoretical basis for it, suggesting a stable relationship between
size of the economies, proximity and trade among them.
-
Widely used to infer trade flow potentials, or to estimate the effects on trade of
institutions such as customs unions, monetary agreement, exchange rate mechanism,
ethnic ties, linguistic identity, international borders
-
The basic expression is currently formulated as: the trade flow from country i to
country j (Xij) is proportional to the product of the two countries’ GDPs (Yi , Yj) and
inversely proportional to their distance, Dij, broadly construed to include all factors
that might create trade resistance.
𝛼
𝛼
𝛼
𝑋𝑖𝑗 = 𝛼0 π‘Œπ‘– 1 π‘Œπ‘— 2 𝐷𝑖𝑗3 πœ€π‘–π‘—
o
o
o
o
o
o
-
α0: Variable/Coefficient not depending on “i” or “j”
Xij: Exports from “i” to “j” (or imports of “j” from “i” )
Yi: Exporter factors (GDPi, for example,…)
Yj: Importer factors (GDPj, for example,..)
Dij:distance/trade barriers of exporter “i” to enter / reach market “j”
εij: random term (not analogue to Physics determinism)
Apart from being intuitive and apparently empirically true, some studies have been
able to provide theoretical foundations for the gravity model/equation1. This
theoretical foundations are critical to understand the right specification of the
empirical model and the proper way of doing correct econometrical inferences, for
examples:
1
See an intuitive sketch in the text Head, K. (2003), “Gravity for beginners” of British Columbia University.
https://www3.nd.edu/~agervais/documents/Gravity.pdf
2
o
o
o
o
According to the theoretical background, elasticities of GDP’s and distance
should be around 1
According to the theory, the gravity equation SHOULD have multiplicative
shape
According to the theory derivation, the gravitation equation MUST also include
a Multilateral Resistance Term OR “remoteness” term (as seen later on)
……and many more interesting facts that frame / condition empirical exercises
-
One of the common questions of newcomers is: Is the physical distance really an
explanatory variable for trade? Yes. Some studies illustrate that distance matter so
much because it measures somehow a lot of relevant trade – resistance issues:
transaction costs, transport costs, perishability/losses of goods during transport,
synchronization costs, communication costs, cultural distance….
-
Some almost evident - additional - main features of the equation:
o
o
o
Multiplicative form: very important empirical/econometrical implications
Multilevel:
 Unit of observations: “i” and “j” might represent countries, regions,
provinces, or even firms and …
 “x” might represent TOTAL trade, share of trade, sectoral trade,
product trade,…
 …or even a NON TRADE variable: migration, commuting, passengers,
trips, fleets…
 …..BUT…be carefull when dealing with disaggregated data because
some critical issues appear when dealing with empirics
A time subindex “t” might be added to every term
The importance of Multilateral Trade Resistance term (MTR). (Anderson and van Wincoop’s
(2003))
-
The authors (among others) showed that “The gravity equation tells us that bilateral
trade, after controlling for size, depends on the bilateral trade barriers between “i”
and “j” BUT RELATIVE to the product of their Multilateral Resistance Indices”: bilateral
barrier between them relative to average trade barriers that both regions face with all
their trading partners. Two neighbor countries will trade more if they are isolated from
the rest of the world.
-
Good example of the idea found at Head, k (2003): “The importance of remoteness in
actual trade patterns can be illustrated by comparing trade between Australia and
New Zealand with trade between Austria and Portugal. The distance between each
pair’s major city is approximately the same: Lisbon–Vienna and Auckland–Canberra
both happen to be 1430 miles apart. Furthermore the product of their GDP’s are similar
(Australia–New Zealand is 20% smaller). Hence, omitting remoteness, the gravity
equation would predict that Austria–Portugal trade would be slightly larger. In fact,
however, in 1993 Australia–New Zealand trade was nine times greater than Austria–
Portugal Trade”.
3
-
It is easy to see why higher multilateral resistance of the importer raises its trade with
“i”.
o
o
-
For a given bilateral barrier between “i” and “j”, higher barriers between “j”
and its other trading partners will reduce the relative price of goods from “i”
and raise imports from “i”.
Higher multilateral resistance of the exporter also raises trade. Higher trade
barriers faced by an exporter will lower the demand for its goods and
therefore its supply price “pi”. For a given bilateral barrier between “i” and “j”,
this raises the level of trade between them.
Empirical implication: All this means that in the gravity equation, we have to include
MTR (or the inverse, that said, easiness to trade) for EITHER “i” and “j”. Following
Anderson and van Wincoop’s derivation, the gravity equation turns out to be:
1−𝜎
𝑋𝑖𝑗 =
π‘Œπ‘– π‘Œπ‘— 𝑑𝑖𝑗
(
)
π‘Œ Π𝑖 Ρ𝑗
where
o
o
o
o
o
o
-
Xij: Exports from “i” to “j” (or imports of “j” from “i” )
Yi/Yj/Y: GPD measures for “i”, “j” and the word
tij: One plus the tariff equivalent of overall trade costs of imports of “j” from
“i”
σ: elasticity of substitution
Πj: Ease of access of exporter “i”
Ρj: Ease of access of importer “j”
What if we omit MRT?. The empirical problem is that multilateral resistance terms are
functions of all bilateral trade barriers, which in turn are a function of “distance” and
“barriers dummies”. Omitting MTR induce potentially severe bias in the coefficients of
the distance and border variables.
3.- INTRODUCTION TO EMPIRICAL ESTIMATION OF A GRAVITY MODEL
-
Basics:
o
Expression: following Anderson and van Wincoop’s formula we come to the
linearized expression:
𝑙𝑛𝑋𝑖𝑗 = π‘Ž0 + π‘Ž1 π‘™π‘›π‘Œπ‘– + π‘Ž2 π‘™π‘›π‘Œπ‘— + π‘Ž3 𝑙𝑛𝑑𝑖𝑗 + π‘Ž4 lnΠ𝑖 + π‘Ž5 lnΡ𝑗 + πœ€π‘–π‘—
Where:

Parameters as elasticities
4



Πj ease of access of exporter “i” and Ρj ease of access of importer “j”
(MTR like terms)
a3=1-σ
“εij” is an error term
Attention:



o
2
“Xij” represents only the flow from “i” to “j”; there might be another
observation for trade from “j” to “i”. We shouldn’t aggregate both
averaging the reciprocal trade flows
FOB or CIF values? One might understand that it depends on if we are
measuring Xit as exports from “i” to “j” or imports of “j” from “i” but
NO. Basically, FOB are the best option (if available)2.
GDP’s, if added, and trade flows (X) are measured in nominal terms
(non real terms)3
Observables:


GDP’s
Vector tij containing both BARRIERS and INCENTIVES to trade
between “i” and “j”. Normally, it includes “ij” variables:

“Natural” barriers / trade costs “ij”:
ο‚· (dij): Bilateral distance “ij” (as proxy for transport costs):
different means of distance calculation between countries4
ο‚· Others (dummies): (ISij) one of the two being islands, (LLij)
one of the two being landlocked countries,

Incentives “ij”:
ο‚· (CBij) Common border or adjacency
ο‚· Existence of Bilateral, Regional or Multilateral Trade
Agreement (TAij)
o Usually with a dummy, although some caveats
should be made5
ο‚· Lower information costs:
o Common language (CLij)
Using CIF data may lead to simultaneous equation biases, as the dependent variable includes costs that are correlated with the
right hand side variables for distance and other trade costs.
3
“Gravity is an expenditure function allocating nominal GDP into nominal imports; therefore inappropriate deflation probably
creates biases via spurious correlations”. UNCTAD-WTO A Practical Guide to Trade Policy Analysis
4
Both in terms of distance measurement choice (Euclidean, great-circle, orthodromic…) and in terms of among “where” to
measure (economic “poles”, capitals, main ports,…)
5 A dummie is not able to capture those trade agreements with asymmetrical benefits/conditions for its members, for different
products or simply with a progressive effect. A single dummy suppose that the “treatment” effect is the same for all the countries
participating in this agreement.
5
o
Cultural / Historical ties (had been colonies of each
other or a common colonizer) (COLij)
This vector tij usually takes the theoretical based form of (for the previous variables):
𝛿
𝑑𝑖𝑗 = 𝑑𝑖𝑗1 · exp⁑(𝛿2 𝐼𝑆𝑖𝑗 + 𝛿3 𝐿𝐿𝑖𝑗 + 𝛿4 𝐢𝐡𝑖𝑗 + 𝛿5 𝑇𝐴𝑖𝑗 + 𝛿6 𝐢𝐿𝑖𝑗 + 𝛿7 𝐢𝑂𝐿𝑖𝑗 )
-
How to deal with non observable nature of MTR:
1.- To use a nonlinear iterative method to estimate MTR effects on prices of MTR
terms (Anderson and van Wincoop’s)
2.- To use a linear estimator adding country, or country x time, fixed effects:
o
With a cross – section dataset:

Country dummies for countries “i” and “j”: (Ii) and (Ij).
ο‚·
ATTENTION if we allow country dummies in a cross-section
approach, we cannot estimate parameters for other country
specific variables so this approach is only valid when the
interest is on bilateral / country pair coefficients (such as the
effect of a common border)
𝑙𝑛𝑋𝑖𝑗 = π‘Ž0 + π‘Ž1 𝐼𝑖 + π‘Ž2 𝐼𝑗 + π‘Ž3 ln⁑(𝑑𝑖𝑗 ) + πœ€π‘–π‘—
o
With a panel dataset:

Country dummies for countries “i” and “j” INVARIANT on “t”
(assuming MTR constant over time).
ο‚· That allows the estimation of country specific factors if they
vary over time = right approach if our interest rely on those
variables.
𝑙𝑛𝑋𝑖𝑗𝑑 = π‘Ž0 + π‘Ž1 ln⁑(𝐺𝐷𝑃𝑖𝑑 ) + π‘Ž2 ln⁑(𝐺𝐷𝑃𝑗𝑑 ) + π‘Ž3 𝐼𝑖 + π‘Ž4 𝐼𝑗 + π‘Ž5 ln⁑(𝑑𝑖𝑗 ) + (π‘Ž6 𝐼𝑑 )+πœ€π‘–π‘—
ο‚·

Is the MTR time invariant assumption plausible?: only within
short periods of time
Country dummies for countries “i” and “j” and period “t” (allowing
MTR change over time): (Iit) and (Ijt).
ο‚·
ATTENTION, if we allow time varying country dummies, we
cannot estimate parameters for other time varying country
specific variables (such as GDP, for example,…) = so again this
6
approach is only valid when the interest is on bilateral /
country pair coefficients
𝑙𝑛𝑋𝑖𝑗𝑑 = π‘Ž0 + π‘Ž1 𝐼𝑖𝑑 + π‘Ž2 𝐼𝑗𝑑 + π‘Ž3 ln⁑(𝑑𝑖𝑗 ) + (π‘Ž4 𝐼𝑑 )+πœ€π‘–π‘—
3.- To proxy MTR with remoteness indexes, computed as the (GDP weighted)
average distance of trader “i” to all countries/regions other than “j” (and vice versa).
𝑅𝐸𝑀𝑖 = ∑π‘š≠𝑗
o
o
π‘‘π‘–π‘š
⁄π‘Œ or
π‘š
𝑑𝑖𝑗
𝑅𝐸𝑀𝑖 = ∑𝑗 π‘Œ
𝑗 ⁄π‘Œ
It is the only option if we are interested in country – specific variables
(country specific dummies would preclude the estimation of such
parameters)
Two major drawbacks:
 Resistance to trade is measured only with distance
 Difficult to find a good way of measuring distance “ii”
Can we use a standard panel data approach with FE/RE (or other) estimators? :
-
Using Fixed Effects or RE standard Panel Data estimator.
o
Yes, and apart from controlling MTR terms, the use of standard Panel Data
estimations help us to control, in addition, for bilateral / country pair
heterogeneity (bilateral / country pair fixed effects)….. BUT ATTENTION:
those country pair time invariant effects cannot be estimated with Fixed
Effects panel data estimator if our interest relies on other time invariant
bilateral variables (such as borders, common language, trade agreement,….)
o
The use of RE is an option if we want to get time invariant coefficients (at the
risk, as ever, of bias in coefficients)
4.- OTHER EMPIRICAL (more advanced) ISSUES.
-
There are a handful of issues of (sometimes critical) interest:
o
o
How to deal with of zero trade
Bias for log model estimation in the (highly probable) presence of
heteroskedasticity
o Some extra-cautions when working with disaggregated data such as
sectors, firms,…
o Endogeneity in gravity equation: causation between trade and trade
policy could be reversed when, for example in the case of the signature
of a FTA, there exist a selection of countries based on intensity of trade,
and not the other way round.
o Spatial correlation
o Omitted variables biasing coefficients systematically (relationship
between trade and migration, for example)
7
o
o
-
Several authors have proposed a dynamic gravity equation in place of the
traditional static gravity equation
…..and some others….
How to deal with zeros:
-
Reasons for zeros:
o
o
o
-
Real zero trade
Rounded to zero trade
Missing values for sometimes unknown reasons (non reported by
countries, error in dissemination or manipulation,….)
….
The problem is that, in many times, the researcher doesn’t know what
proportions of different types of zeroes does he have in his dataset.
Alternatives:
o
o
o
Simply truncate the sample to avoid zero cases (delete “ij” cases with
zeroes): only OK if zeros are true missings and thus randomly distributed
across “n” and “t”
Substitute zeros by small numbers (1, for example): only appropriate if
real zero or almost zero trade BUT arbitrary level generate unexpected
impact on parameters
Not to use logs, and estimate the model in levels:


o
6
With a linear estimator. NO: theoretical foundation of the gravity
equation implies multiplicative form
With a non-linear estimator:
ο‚· (Pseudo) Poisson maximum likelihood (ML) estimator
applied to the levels of trade estimating directly the nonlinear form6.
ο‚· Tobit (that allows a significant proportion of zeros) on
the log of trade plus a constant: the critique is that Tobit
is applies for left-censored zeros only when those have
the economical meaning of zeros (no trade or almost no
trade because of prohibitive trade costs, for example)
To control for the “selection bias” using a Heckman procedure (Heckman
2- stages least squared estimation that introduces in the specification the
inverse of the so called Mills ratio). However, that method requires
Silva, J. S., & Tenreyro, S. (2006). The log of gravity. The Review of Economics and statistics, 88(4), 641-658.
8
“instrumental” variables that may explain the selection (zero or positive
trade) but not the value of positive trade.
-
Log inducing bias in presence of heteroskedasticity
The Gravity model is basically defined as:
𝛼
𝛼
𝛼
𝑋𝑖𝑗 = 𝛼0 π‘Œπ‘– 1 π‘Œπ‘— 2 𝐷𝑖𝑗3 πœ€π‘–π‘—
Where the random term εij have the standard property:
𝐸[πœ€π‘–π‘— /π‘Œπ‘– π‘Œπ‘— 𝐷𝑖𝑗 ] = 1
The model is then usually linearized taking the following simple form:
𝑙𝑛𝑋𝑖𝑗 = 𝛼0 + 𝛼1 π‘™π‘›π‘Œπ‘– + 𝛼2 π‘™π‘›π‘Œπ‘— + 𝛼3 𝑙𝑛𝐷𝑖𝑗 + ln(πœ€π‘–π‘— )
-
The problem is that, as Jansen’s inequality states, E[ln(ε)]≠lnE[ε]. The
expectation of a log of a random variable E[ln(ε)] not only depends on the mean
of that variable E[ε] but also on higher order moments (such as the variance)
V[ε]. Then when the random term in the original (nonlinear) model presents
heteroskedasticity,
𝑽[πœΊπ’Šπ’‹ ] = πˆπ’Šπ’‹ = 𝒇(π’€π’Š , 𝒀𝒋 , π‘«π’Šπ’‹ )
Then the expected value of its logarithm E[ln(ε)], that is also a function of σij, is
also a function of the explanatory variables:
𝑬[𝒍𝒏(πœΊπ’Šπ’‹ )] = 𝒇(πˆπ’Šπ’‹ ) = 𝒇(π’€π’Š , 𝒀𝒋 , π‘«π’Šπ’‹ )
The result is therefore that some of the parameters in the log model might be
biased and inconsistent.
-
A way of solving this problem is to assume a pattern of heteroskedasticity where
conditional variance depends on conditional mean, that is, a Poisson distribution
for the endogenous variable where E[yi/X]=V[yi/X]. Then a PPML (Poisson
pseudo- maximum likelihood estimator) traditionally used for count data can be
used to consistently estimate the model. One interesting extra - point is that this
estimator is applied for the model in LEVELS so no logs are needed and thus, at
the same time, we fix the problem of zeros.
9
5.- EMPIRICAL EXERCISES USUALLY COVERED WITH GRAVITY MODELING
-
Simulate scenarios for international trade adjustment according to changes in
main explanatory variables
-
Quantify trade potential between two countries. Basically, a gravity equation is
used using data only of those countries that may have supposedly reached their
trade potential and then, after some adjustments, the estimated equation is
applied to pair of countries out of the sample: the real trade is then compared with
predicted (potential) trade.
-
Evaluate / Quantify the impact of policy issues: Free Trade Agreement, Tariff
cuts/rises (Only make sense in the case of a specific product ), Currency unions,
Political blocs, patent rights, and other various trade distortions.
-
Measure bilateral trade resistance / cost.
A gravity equation can also be used “in reverse” to measure bilateral trade costs at
an aggregate level. The idea is to solve a theoretical gravity equation for the trade
costs term instead of trade flows and to express these costs as a function of the
observable trade data and this allows to estimate the tariff equivalent of non tariff
barriers
10
STATA HANDS ON SESSION
DO File: DO_MANIPULATION_COMMENTED
MANIPULATION OF DATA (Previous to Econometrics)
(Steps 1 to 7 as described in Chapter 3 – UNCTAD/WTO.)
Several operations to perform before estimation (see DO_MANIPULATION_COMMENTED):
-
Download datasets from sources and import them into a single software format
(stata dta, E-Views wf,..)
Homogenize formats of different datasets, list of countries, names for countries,
names for variables, “names” for years
Replace missings (ceros for trade, for example or functional 999 for real missings,
year of WTO accession for example)
Generate the structure for the gravity model data set: all possible combinations
of countries and years (if panel) adapting different structures
Merge different files into a single one
Generate dummies for year, country, and year-country
Compute log variables (for GDP, trade and distance)
Step 1:
-
-
Import CSV trade flows (tradeflows.csv), label variables and save to .dta
Import txt file “joinwto.txt” with year of accession for each country and save it in .dta
format
Import CSV file “GDP.csv” with GDP data for each countries from 1960 to 2006, replace
BELGIUM and LUXEMBOURG by BENELUX, compute BENELUX GDP with the sum of both
countries and change names for year variables save it in .dta format
Open STATA datafile containing the rest of explanatory variables, fix BENELUX problem,
change some variable names, label some other variables and save it in .dta format
Basically, at the end of that Step 1, four different STATA files are created and stored in the
default directory:
1.
tradeflows.dta (endogenous variable) in a Panel dataset for YEARS and PAIRS
of countries in LONG format
11
2.
joinwto.dta (explanatory variable wtoaccesion) in a Cross Section dataset for
INDIVIDUAL countries
3.
GDP.dta (explanatory variables GDP’s) in a Panel dataset for YEARS and
INDIVIDUAL countries in WIDE format
4.
CEPII.dta (other explanatory variables in LONG format) in a Cross Section
dataset for PAIRS of countries
12
Step 2:
-
Starting with “tradeflows.dta”, create the FULL structure of the datafile: PANEL DATA for
YEARS and every possible combination (PAIR) of countries filling with “zeros” the pairs
newly created. The temporary file created is "gravity_temp1.dta"
-
Reshape GDP.dta to LONG Panel set and create a duplicate (GDP is going to be used as
both importers’s GDP and exporter’s GDP)
Step 3:
reshape long stub, i(i) j(j)
\
j new variable
reshape long yr, i(countrycode) j(year)
rename yr gdp
-
And MERGE those two new files (“GDP_exporter.dta” and “GDP_importer.dta”) with
"gravity_temp1.dta" keeping those observations (PAIRS of countries) with information in
both files.
13
-
MERGE “joinWTA.dta” with that file creating two new variables: join_exporter and
join_importer .
-
The new temporary file created is "gravity_temp3.dta"
-
MERGE data of both two new files “CEPII.dta” (previously saved) and “religion.dta” with
the previous.
The new temporary file created is "gravity_temp4.dta"
Step 4:
-
Step 5:
-
Create WTO accession dummies depending on whether one, none or both countries are
members of WTO or not (onein, nonein, bothin)
The new PERMANENT file created is "gravity.dta" and basically contains the core dataset
(endogenous and exogenous variables, except for country/country x time/time dummies
and some lasting transformations)
Step 6:
-
Create country/country x time/time dummies for the specification of MTR terms and time
fixed effects
In this block, due to memory restrictions, three different options are offered if the number
of dummies exceed the STATA capacity:
o Option selected in this example: Reduce the number of years (>1995→1996 – 2005)
o Compute country-period (and not country-year dummies)
o Make a balanced panel (reducing the sample to those countries having the
information for the same time period).
14
Step 7:
-
Create logs of variables GDP’s, and distance
Compute five year average of some variables
Create a subset with OECD countries for the period 2000-2005
ECONOMETRIC ESTIMATIONS OF GRAVITY EQUATIONS
-
Load dataset “gravity_OECD_2000_2005.dta”
REG1: ESTIMATE A CROSS SECTION BASIC REGRESION AND PERFORM SOME BASIC
CHECKS:
o Estimate the simplest log-linear gravity model regression for the year 2005 using only
lgdp_exporter, lgdp_importer and ldistance and interpret parameters/elasticities
o Check if GDP elasticities are close to unitary as predicted by theory:


o
Theory predicts a value around 1 for both elasticities
A difference between origins GDP and destination GDPs is expected, a lower
estimation for importer GDPs would suggest evidence of home market effects
(due to barriers to entry or national product differentiation).
Check if trade elasticity is significantly more sensible to trade barriers in 2005 than in
2000
 Procedure: compare basic estimation for different years (2000 Vs 2005) using
seemingly unrelated estimation (STATA suest command)
META analysis for 2500 gravity equations estimations.
Table extracted from Head, K., & Mayer, T. (2013). Gravity equations: Workhorse,
toolkit, and cookbook. Handbook of international economics, 4.
-
REG2: ESTIMATE ANOTHER CROSS SECTION REGRESSION WITH ADDITIONAL VARIABLES
o
o
7
Estimate, with robust inference, for 2005 adding more variables:
reg limports contig comlang_off onein colony REPlandlocked PARTlandlocked
religion ldist lgdp* if year==2005, robust
Compare REG1 and REG2 regressions7
For that, it is useful to download “eststo” command
15
o
-
REG3: ADDING DUMMIES TO CONTROL FOR MTR EFFECT
o
o
o
o
o
o
o
-
Check elasticities obtained:
 How do you compute the elasticity for dummy variables?
 Adjacency coefficient usually lies in the vicinity of 0.5 (Head, K 2003)
suggesting that trade is about 65% higher as a result of sharing a border. To
omit this variable may cause an upward bias in distance parameter (both are
negatively related to each other)
 Contiguity and common language effects seem to have very comparable
effects, with coefficients around 0.5, about half the effects of colonial links.
(Head, K., & Mayer, T. (2013), see table above))
 According to some papers, common links (lenguaje, colony,…) may cause very
significant rises in trade (up to two, three times or even more…)
 The effect of FT agreements may also have a very significant impact on trade
(for obvious reasons) but the size depends crucially in a long list of different
features about this FTA: large estimated effects albeit with large standard
deviations.
Keep only 2000 - 2005 observations with origin or destination an OECD country
3.1 Try to estimate REG2, with robust inference, for a cross section in 2005 adding
country dummies importer_* and exporter_* to control for MTR with country fixed
effects (add also year* dummies)
 We cannot include other country specifics variables such as REPlandlocked
PARTlandlocked lgdp_importer lgdp_exporter
3.2 How can we estimate the parameters of country specifics?. A pooled OLS
regression for a short period (2000-2005) could be a solution for country specific that
varies over time (GDP’s for example, but not for country time-invariant variables (such
as REPlandlocked, PARTlandlocked)
 Repeat previous regression for the period 2000-2005
3.3. What if we now add country x time dummies allowing for MTR time variants?
 The answer is that, now we cannot estimate neither country specific time –
invariant (including country dummies) or country specific time - variant
coefficients (such as GDP’s)
3.4. What if we now add country-pair dummies allowing to control for paired
heterogeneity?
 Adding “pairid” fixed effects does not allow to estimate the coefficients for
“country pairs” such as distance, colony, onein,…..
 SO IF WE CONTROL FOR ALL FIXED EFFECTS AT THE SAME TIME (COUNTRY,
YEAR, COUNTRY X YEAR, AND COUNTRY-PAIRS) WE THEN LOSE THE REST OF
PARAMETERS (except for fixed effects)
Compare common coefficients for the four regression reg2, reg3.1, reg3.2, reg3.3 and
reg3.4
Results comparing common coefficients (when we can) suggest:
 the distance coefficient is biased towards zero empirically when committing
the mistake of not controlling for MTR terms and,
 on the contrary, GDP’s effects seems quite relevant positive bias.
REG4: PANEL DATA (Step 8 in UNCTAD-WTO document)
o
Set panel data structure
16
o
o
o
Estimate with panel data fixed effects including, also, time effects for controlling
global economic effects and time-varying fixed effects both for the exporter and the
importer
Using fixed effects, we will lose the possibility to estimate country – paired variables
(at least using fixed effects).
Consider the possibility of RE Vs FE doing a Haussman test or Seemly Uncorrelated
Regressions.
SIMULATION EXERCISE: EFFECT OF RTA (Nafta)8
“The gravity equation provides a way of looking for evidence of trade diversion through the ex-post
analysis of trade flows. Suppose that countries “i” and “j” belong to a common RTA, whereas country
“k” does not. If, after the RTA’s formation, “i” imports more from “j” and less from “k”, trade
diversion is likely. If, in contrast, country “i” imports more from “j” and from “k”, trade creation is
likely”.
-
A data file (agGravityData.dta) should be previously constructed according to instructions
of pg.131.d.1.1
We open the data file (already created):
use "agGravityData.dta", clear
-
Create NAFTA dummies for intra-trade and for imports of NAFTA members from other
countries
gen nafta = (ccode=="CAN" | ccode=="MEX" | ccode=="USA")
label var nafta "1 if home is nafta member"
gen pnafta = (pcode=="CAN" | pcode=="MEX" | pcode=="USA")
label var pnafta "1 if partner is nafta member"
gen intra_nafta = (ccode=="CAN" | ccode=="MEX" | ccode=="USA") & (pcode=="CAN" |
pcode=="MEX" | pcode=="USA")
replace intra_nafta = 0 if year < 1994
label var intra_nafta "1 if trade bewteen nafta members"
gen imp_nafta_rest = (ccode=="CAN" | ccode=="MEX" | ccode=="USA") & (pcode!="CAN" &
pcode!="MEX" & pcode!="USA")
replace imp_nafta_rest = 0 if year < 1994
label var imp_nafta_rest "1 if nafta's imports from the rest of the world"
-
Declare a panel (or times series panel), generate some logarithms
egen id = group(ccode pcode)
tsset id year
gen lnV = log(imp_tv)
label var lnV "value of imported goods in logarithm"
gen lncGDP = log(cgdp_current)
label var lncGDP "partner's current GDP in logarithm"
gen lnpGDP = log(pgdp_current)
label var lnpGDP "home's current GDP in logarithm"
gen lnD = log(km)
label var lnD "bilateral distance in logarithm"
-
8
And estimate a gravity equation for logarithms of value of imports (lnV) including logs of
GDPs, distance, both NAFTA dummies, year dummies and fixed effects for pairs of
countries. The interpretation of both coefficients might be used as an empirical test
about trade creation and/or trade diversion.
A regional trilateral trade agreement signed by Canada, Mexico, and the United States, that came into force on January 1, 1994.
17
xtreg lnV lncGDP lnpGDP lnD intra_nafta imp_nafta_rest _Iyear_*, fe robust
-
We then interact NAFTA dummies with years in order to see the changes of NAFTA
impacts along time
xi: xtreg lnV lncGDP lnpGDP lnD
vce(robust)
-
i.year i.year*intra_nafta i.year*imp_nafta_rest , fe
Finally, we also follow similar structure to test export diversion, generating the dummy
capturing the exports of NAFTA towards the rest of the world
gen exp_nafta_rest = (pcode=="CAN" | pcode=="MEX" | pcode=="USA") & (ccode!="CAN" &
ccode!="MEX" & ccode!="USA")
replace exp_nafta_rest = 0 if year < 1994
label var exp_nafta_rest "1 if nafta's exports to the rest of the world"
-
And running the previous regression including this new dummy
xtreg lnV lncGDP lnpGDP lnD intra_nafta imp_nafta_rest exp_nafta_rest _Iyear_*, fe robust
18
Download