In my doctoral thesis I analyze the cross-border spillovers from nationally implemented macroprudential policy via international lending with the help of a gravity model applied to international banking asset holdings.
These notes contain information about the gravity equation, it’s theoretical foundations, applications and estimation.
The gravity model has been a workhorse model of international trade analysis for decades. My interest is however in applying the gravity model to international banking. This should be kept in mind when reading the notes.
My GitHub repository for gravity equations can be found at github.com/anorring/Gravity-equations.
Chapter 3: Analyzing bilateral trade using the gravity equation
The WTO and UNCTAD have co-published an on-line book with a chapter focused on the practical use of gravity models. You can find the chapter here.
From empirics to theory:
The gravity equation in the general, multiplicative formulation:
\(X_{ij} = G S_i M_j \phi_{ij}\)
where \(X_{ij}\) is the monetary value of exports from coutry i to country j, \(S_i\) and \(M_j\) denote all the exporter- and importer-specific factors (such as the GDP) that make the total of exporter country’s willingness to supply and the importer country’s willingness to demand. \(G\) is a variable independent of the countries in the bilateral pair (such as the level of world liberalization). \(\phi_{ij}\) represent the ease of exporter access to the importer’s market, i.e. the inverse of bilateral trade costs.
The importance of the “multilateral trade-resistance” term - Anderson and van Wincoop (2003):
Thus the gravity equation takes the following form:
\(X_{ij} = \frac{Y_i Y_j}{Y} ( \frac{t_{ij}}{\Pi_i P_j} )^{1 - \sigma}\)
where \(Y\) denotes world GDP, \(Y_i\) and \(Y_j\) the GDP of countries i and j respectively, \(t_{ij}\) (one plus the tariff equivalent of overall trade costs) is the cost in j of importing a good from i, \(\sigma\) > 1 is the elasticity of substitution and \(\Pi_i\) and \(P_j\) represent exporter and importer ease of market access or country i’s outward and country j’s inward multilateral resistance terms. The multilateral resistance terms are low if a country is remote from world markets (remoteness can mean physical distance or other trade costs).
Note that all variables in the above formulation can vary across time.
The standard procedure has long been simply taking natural logs of the equation and estimate the obtained log-linear equations using OLS. Consider the version of the model that includes MRT:
\(ln X_{ijt} = a_0 + a_1 ln Y_{it} + a_2 ln Y_{jt} + a_3 ln t_{ijt} + a_4 ln \Pi_{it} + a_5 ln P_{jt} + \varepsilon_{ijt}\)
Variables that capture trade costs:
Variables that capture MTR-terms:
Case A: Interest of the research focuses on the coefficient of a bilateral variable
Use the time-varying country dummies for importer and exporter countries to capture all country-specific characteristics. This will control for a country’s overall level of imports/exports:
\(ln X_{ijt} = a_0 + a_1 I_{it} + a_2 I_{jt} + a_3 ln t_{ijt} + a_4 I_{t} + u_{ijt}\)
where \(I_t\) is a time dummy independent of the country pair and \(I_{nt}\) are exporter/importer time-varying individual effects (thus they can take into account the fact that MRT can change over time).
Trade costs are usually assumed to take the form:
\(t_{ij} = d_{ij}^{\delta_1}*exp(\delta_2 cont_{ij} + \delta_3 lang_{ij} + \delta_4 ccol_{ij} + \delta_5 col_{ij} + \delta_6 landlock_{ij} + \delta_7 RTA_{ij})\)
where \(d_{ij}\) is bilateral distance and the other controls are dummies for a common border, common language, common colonizer, colonial relation, either country being landlocked or members of a regional trade agreement. All these variables have been found to have a statistically significant effect on bilateral trade.
#In STATA:
#tab (year), gen (year_)
#gen impyear = group(importer year)
#gen expyear = group(exporter year)
#tab (impyear), gen (impyear__)
#tab (expyear), gen (expyear__)
#xtreg lnexports lndist cont lang ccol col landlock RTA impyear_* expyear_* year_*, robust
#or with random effects - check suitability with the Hausman test:
#xtreg lnexports lndist cont lang ccol col landlock RTA impyear_* expyear_* year_*, re robust
NB: The observations usually fitted to the gravity equation exhibit heterogeneity arising from different sources. The error term is highly unlikely to be homoskedastic, and thus heteroskedasticity robust standard errors should be used systematically (option [robust] in [reg]). One should often also control for clustering by using option [cluster]. (Outliers can pose problems: you can find them with the Hadi test [hadimvo])
Controlling for country-pair effects: you can use fixed effects if the independent country-pair variables are time-varying (such as membership of a common RTA). Using fixed effects with time-invariant controls results in perfect collinearity:
#In STATA:
#tab (year), gen (year_)
#gen impyear = group(importer year)
#gen expyear = group(exporter year)
#tab (impyear), gen (impyear__)
#tab (expyear), gen (expyear__)
#xtreg lnexports RTA impyear_* expyear_* year_*, fe robust
Case B: Interest of the research focuses on the country-specific variable (relevant for MY THESIS)
Using the country fixed effects makes it impossible to estimate the partial effects of country-specific explanatory variables, because they are perfectly collinear with time-varying country fixed effects. This problem arrises e.g. when we want to know what the effect of the size of the economies is on bilateral trade, or of the differencies in policies. Then there are two options: use time-invariant country fixed effects or control for MTR using a different method.
Consider first the use of time-invariant country fixed effects and additional country-specific controls, when we are interested in the effect of the economic mass on trade:
\(ln X_{ijt} = a_0 + a_1 ln GDP_{it} + a_2 ln GDP_{jt} + a_3 ln t_{ijt} + a_4 I_{i} + a_5 I_{j} + a_6 I_{t} + u_{ijt}\)
This approach can be used, when the sample period is relatively short: the idea is that the MTR’s do not vary very much over a short sample period (see Baldwin and Taglioni, 2006). It is not optimal, because we do know that the MTR’s are not time-invariant as e.g. the geographical composition of a country’s trade varies. The upside is that one can add many control variables and other variables of interest to the basic gravity equation, such as the quality on insitutions or infrastructure.
#In STATA:
#gen lnGDPexp= ln (GDPexp)
#gen lnGDPimp= ln (GDPimp)
#xtreg lnexports lnGDPexp lnGDPimp lndist importer_* exporter_* year_*, robust
Another option is to estimate the MTR by measuring remoteness. There are multiple ways of doing this:
#The simple remoteness measure in STATA:
#Compute the share of GDP in world GDP
#bys exporter year: egen gdptotal = sum(gdp)
#gen gdpshare = gdp / gdptotal
#Compute the spatially weighted GDP share
#bys exporter year: egen remoteness = total(dist*gdpshare)
#Compute the spatially weighted GDP share according to Head (2003)
#bys exporter year: egen Remoteness_head=total(dist/gdpshare)
Take note of the three typical mistakes in the traditional gravity set-ups:
Relevant for MY THESIS
The three traditional approaches to handling zero trade:
1. Truncate the sample by dropping zero observations - the usual strategy of log-linearising the model does this
This is correct if zeros are randomly distributed, i.e. not informative. This however hardly ever the case: zero trade might reflect prohibitively high transportation costs.
2. Add a small constant, say 1 dollar, to the value of trade before taking logs
Incorrect: an ad hoc procedure, with no guarantee of it reflecting the underlying expected values -> inconsistent estimates
3. Estimate the model in levels, i.e. in the multiplicative form
Cannot be estimated with OLS.
What estimator should be used with zero trade flows?
Depends on the assumed nature of the zeros: are they missing observations recorded as zeros or the result of firms’ decision not to export?
Reporting errors
Tobit
PPML - Pseudo Poisson maximum likelihood method
#In STATA (though why not the ppml command):
#option fe controls for country-pair fixed effects
#xtpoisson exports lndist cont lang ccol col landlock RTA exporter_* importer_*, fe, robust
Selection model à la Heckman