economic trade analysis tool gravity model of bilateral trade n.
Skip this Video
Loading SlideShow in 5 Seconds..
Economic Trade Analysis Tool (Gravity Model of Bilateral Trade) PowerPoint Presentation
Download Presentation
Economic Trade Analysis Tool (Gravity Model of Bilateral Trade)

Loading in 2 Seconds...

play fullscreen
1 / 43

Economic Trade Analysis Tool (Gravity Model of Bilateral Trade) - PowerPoint PPT Presentation

  • Uploaded on

Economic Trade Analysis Tool (Gravity Model of Bilateral Trade). Isaac A. Asiamah . Project Oriented Computer Science Dowling College. Presentation Breakdown. Aims & Objectives of Project Background Phases Tasks & Dependencies User Externals System Design Input/Output Documentation

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Economic Trade Analysis Tool (Gravity Model of Bilateral Trade)' - paul

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
economic trade analysis tool gravity model of bilateral trade

Economic Trade Analysis Tool(Gravity Model of Bilateral Trade)

Isaac A. Asiamah

Project Oriented Computer Science

Dowling College

presentation breakdown
Presentation Breakdown
  • Aims & Objectives of Project
  • Background
  • Phases
  • Tasks & Dependencies
  • User Externals
  • System Design
  • Input/Output
  • Documentation
  • Future Objectives
  • Q&A
  • Acknowledgements
aims objectives of project
Aims & Objectives of Project

The main objective of this project was to write an application based on

the gravity model of bilateral trade that will ease the process of analyzing

the flow of Trade between trading nations.


  • This tool is targeted towards an academic audience such as people who might be doing graduate level work in economics and applied mathematics .
  • We believe this tool ,with further polishing ,will be very useful mainly to economists who need access to analyzed Trade Flow information between specific countries based on a wide variety of factors which are within their choice .
  • This will allow the user to improve and better predict the volume of trade between specific countries by adding and removing several factors in order to improve the Model.
  • The gravity equation is a popular formulation for statistical analyses of bilateral flows between different geographical entities or regions.
  • It was adapted from Newton’s law of gravitation.
  • In 1962 Jan Tinbergen proposed that roughly the same functional form could be applied to international trade flows. However, it has since been applied to a whole range of what we might call “social interactions” including migration, tourism, and foreign direct investment.
  • Newton’s Law of Gravitation has an application in terms of the flow of trade and Import/Export between two countries

F = Gm1m2


F = The force of attraction

m1 = mass of object 1

m2 = mass of object 2

r = the distance

G = is a constant.

G is a gravitational constant depending on the units of

measurement for mass and force.



F = The Flow of Trade

GDPi = GDP of country i

GDPj = GDP of country j

d = distance between economic capitals of countries i and j.

K = is a constant.

F = Gm1m2


F = The force of attraction

m1 = mass of object 1

m2 = mass of object 2

r = the distance

G = is a constant.


The economics version can linearized and due to the additive nature of Logarithms we convert it to the formula

Ln(F) = ln(GDPi) + ln(GDPj) – ln(d) +ln(k)

before we start
Before we start ….
  • While working on this project I realized most of my course mates had a problem understanding what I was doing. And very recently I heard a comment like “I don’t even know what Bilateral means".
  • So I took these comments to heart and in order not to confuse anyone I put a few terms and their definitions together to make this presentation a little clearer.

Some Keywords

  • Bilateral - pertaining to, involving, or affecting two or both sides, factions, parties
  • Model - Model (abstract), an abstraction or conceptual object used in the creation of a predictive formula
  • Time invariant factors – Factors that are not expected to change with time
  • Dummy variable - An extra variable we include in regression analysis to improve the predictive output of the model by allowing us to include subgroups such male /female ,married /single etc.
  • Regression - examines the relation of a dependent variable (response variable) to specified independent variables (explanatory variables).
proposed features functionality
Proposed Features /Functionality
  • Java based although originally started in java script
  • Calculate the flow of trade between two given countries based on factors such as
    • balance of trade
    • Gross Domestic Product(GDP)
    • geographical location
    • Political regime and diplomatic ties
  • Must plot a chart to represent the calculated Trade flow data over the number of years based on the user’s input
  • The data must be analyzed using Regression in order to predict future trade patterns based on the user’s input.



- Graphical User Interface

- Data Analysis and Prediction Functions

- Code to Link input and Output

- Code to Polish Output



GUI related Testing and Fixing

Code functionality related Fixes

Output and I/O link related fixes


-Error Handling




- Help

- Download Instructions

design breakdown
Design Breakdown

The project was divided into the following phases in order to expedite the

completion. However ,from hindsight the project would have started

differently had I been aware of some of the dependencies.

Design Process Breakdown

1. Input - GUI

2. Data - IMF/World bank ,BEA,Dept of Commerce,Econstat

sourced data for import/export, balance of trade, and distances

3. Computation - implementing the algorithm & regression analysis

4. Output - Output Generation

system design
System Design






designing the gui

The Graphical User Interface was designed using Net beans.

features of the gui

To allow selection of countries, years, and time invariant variables from a list


To select options for time invariant variable effect on output format desired by the user.


To compute Trade flow or Trade potential for a region or to compute trade flow data for future analysis.


There is one main text field labeled Output .It’s main purpose is to display the computed data for trade flows and regression.


Datasets Needed:

  • Distances between capitals based on great circle method
  • Real GDP values for countries
  • Export/Import Data for countries
  • Balance of Trade Data for countries

Distances were obtained from Raymond Robertson and Jon Haveman of Macalester College’s Economics Department.

  • US Economic data

U.S. Department of Commerce Bureau of Economic Analysis

  • Non US Economic data

  • The code was written in java and the GUI was also written using Netbeans.
  • It Calculates the trade flow for each pair of selected countries based on the GDP,balance of trade between trading partners ,and other factors such as distance, common borders, language and diplomatic ties.
  • A lot of good ideas on how to compute the trade flows was also learned from some of the papers I read.
  • I also learned a lot on how to implement the regression analysis .I decided to adopt the Java Matrix library .i.e. JAMA and used the included the regression code using JAMA’s library.
  • I also wrote a little library of functions for performing calculations such as

standard deviation ,covariance ,variance etc.This is also included as part of the source folder


case = 2 countries only

variable declaration:

Fij Flow of Trade from i to j,

GDPi ,GDP of country i,

GDPj ,GDP of country j,

Balance of trade between country i and country j

Distance - proxy for time taken to travel from i to j

Z – Time Invariant factors causing -/+ bilateral effect

- common language -- value of either 1 or 0

- colonial links -- value of either 1 or 0

- tariffs -- value of either 1 or 0

eij the normal random error term.

ln(Fij) = Bo +B1 ln(GDPi) + B2 ln(GDPj)- B3 ln(Distance)

+B4 (language) + eij

The Beta’s are the regression coefficients obtained after performing regression analysis.

input output
Input /Output

In designing the I/O aspect of this program we tried as

much as possible to emphasize these three principles

and we will strive to stick to them as other advanced

versions of the program is released.

  • Simplicity
  • Ease of use
  • Clear, readable output
elements of input
Elements of Input
  • CountrySelection

examples :

      • Ghana
      • United States
      • Nigeria
      • China

This choice is based on the relative availability

and ease of access to data for calculations


  • Mode of Input

The four countries are selected from a combo-list, or drop down

list of countries.

elements of input1
Elements of Input
  • Date Range Selection

The selected range of dates is limited to years between 1980 and 1990 due to the availability of data for those countries. Further expansions will be made to this range of dates in future releases.

  • Mode of Input
    • The range of years is input by selecting the desired dates from two combo lists of dates
    • The dates are selected from two lists from which the begin year chosen MUST be lower than the end year chosen.
elements of input2
Elements of Input
  • Time Invariant Variable Selection
    • The dummy variables are selected by choosing from a variable list.
    • All dummy variables included will have to be assigned an effect by the user in order to be considered as valid for input in the program.
  • Variable Effects
    • This part has already been coded so the effect of a time invariant variable is automatically updated when a variable is selected.

Positive effect = 1

Negative effect = 0

elements of input3
Elements of Input
  • Compute Trade Flow
    • The user must click this button to compute the trade flow values for the selected input
    • It will be invalid to click this push button when no values have been entered.
  • Predict Trade Flow
    • The user must click this button to generate trade flow predictions from the selected input
    • It will also be considered invalid input if the same countries are clicked or the years are the same since we don’t have month to month data on balance of trade.
elements of output
Elements of Output


The graphing system employed by this program is used for both

the computations and predictions of the trade flow values given the

years specified.

  • The output can be displayed currently as a Line Graph

We hope we can extend the program to plot other types of charts in

the future .

  • The button Plot Graph just displays the ordinary line Graph with

actual trade flow values

  • The data analysis button also plots two line graphs which show the

actual and predicted values of the model along side each other.

elements of output1
Elements of Output

Regression Output

When performing regression analysis the following terms are displayed in the Output text field. These values and table can be saved and imported to be used in other programs .

  • Standard error term
  • The residual values i.e.. Difference between predicted and actual trade flow values in a table and also the
  • Correlation coefficients

The documentation for this project includes

  • System Design
  • User Manual
  • This presentation features

- Readme

- User Manual :Step by Step guide to using this product.

This presentation will be available in the docs

Tab on and

user manual readme
User Manual - Readme
  • Go to Download Page and Download Current Version
  • Unzip package and save to a desired folder on your machine

NB: There isn’t a gzipped version on blondie currently. It will be uploaded soon .

  • Windows Users : Go to start -> Click Run ->Navigate to Directory where you unzipped the package -> Type “ java – jar GravModel.jar “

Linux Users : Open a terminal -> Navigate to directory where you unzipped the package -> Type “java –jar GravModel.jar ”

4. The following visuals will show you how to use some of the current

features of the program.

error handling
Error Handling
  • Since this is the first public release it’s fairly pragmatic to assume

that this program is chocked full with logical errors .

  • So the debugging process never stops I’m continually thinking of

new cases the program can crash and finding a way to

Handle that error.

So far I’ve come up with a few Input Errors and how they’re handled

in the problem.

more on error handling
More on Error Handling …
  • You’ll receive these same error messages if you attempt to perform regression analysis with
    • An invalid combination of countries
    • An invalid selection of years

This product is released under the GNU Product

license .It is freely available to everyone to download ,copy and revise.

Be Aware that all revisions that you make to this software will also be affected by the GPL License and the subsequent products will

also be infected by the conditions of

the GPL.

future objectives open issues
Future Objectives /Open Issues
  • Adding functionality to extend prediction of future trade patterns ,this would allow the user to generate values of 3,5 and 10 year outlook data for trade
  • I just started learning about Qt and since this current version is written in java ,I believe a more light weight Qt version will be a good idea
  • Extend the list of countries and integrate sql in order to store all data for GDP,balance of trade etc in a database .

This project is available on two main web pages

i) Blondie @

ii) Source forge @

If you want to join this project as a developer or have any helpful

suggestions and constructive criticisms you can forward all such correspondence to


Any Questions or Comments ?

  • Macalester College Department of Economics, Western Hemispheric Research.
  • Bureau of Economic Analysis, Department of Commerce. 2006. Current-dollar and real gross domestic product. Washington, DC: BEA. March 30
  • United States Census Bureau
  • Keith Head. Gravity for beginners. February 2003.
  • R.G Keesing. The history of Newton's apple tree, contemporary physics.November 1998.
  • Helga Kristjnsdttir. A gravity model for exports from iceland. 2005.
  • Population Potentials and Development Levels : Empirical Findings in the European Union by J. Andres Fa´ı˜naa,* and J. Lopez-Rodr´ıguez
  • A SUR-EC-AR System Gravity Model of Trade by Jaya Krishnakumar
  • The Java Matrix Package

First of all I’ll like to thank God for keeping me alive and giving me the strength and health to bring this phase of the project to completion.

Prof. Bernstein for his Insight and his supervision and guidance.

My classmates Jon Ihm,Mike Fiero ,Nikolay Darakev, Georgi “Jones” Darakev and Gregory Mcquillan for their support and making it easier for me to work with them although I’m not a computer science major.

And lastly ,the Economics , Math and Computer Science faculty