Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Proper Format of Data for Gravity Model

    I am a novice with Stata and I am trying to organize my data for a gravity model of trade. I got separate export and import trade data from the OECD with a column for country and then each column for each month ( Jan 1970, Feb 1970, March 1970..etc). I am wondering if this format is proper to do a regression of the gravity model. I also adding distance and terror data to these datasets. I am wanting to see how terrorism affects imports and exports. Here is an excerpt example of how an export dataset looks in Excel:
    country a Country b Jan-1970 Feb-1970 Mar-1970 Apr-1970 May-1970 Jun-1970 Jul-1970 Aug-1970 Sep-1970 Oct-1970 Nov-1970 Dec-1970 Jan-1971 Feb-1971 Mar-1971 Apr-1971
    afghanistan Australia .. .. 1000 .. .. 9000 .. .. .. .. .. .. 1000 .. .. ..
    afghanistan Austria 35000 10000 17000 14000 7000 23000 26000 31000 13000 82000 50000 48000 22000 30000 14000 19000
    afghanistan Belgium .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
    afghanistan Canada 12000 17000 2000 5000 55000 11000 28000 19000 105000 18000 46000 77000 693000 2000 38000 5000
    afghanistan Chile .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
    afghanistan Czech Republic .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
    I'm sorry, but I don't know how to show it in the Stata Command.

    If this is not the correct format, can you please explain to me how I can put this data into the correct format? Please explain as plainly as possible because I am new to Stata.

  • #2
    Samira,
    Here your data is displayed in "wide" format, which prevents you to run the proper analysis you want in Stata (notably because it prevents you to declare panel data and to run a regression on all country-year observations simultaneously).
    Consider reshaping your data into long format, with the reshape long command (type help reshape, and see the many examples of reshaping issues in this forum, via the Search tool)
    Code:
    
               long
            +------------+                  wide
            | i  j  stub |                 +----------------+
            |------------|                 | i  stub1 stub2 |
            | 1  1   4.1 |     reshape     |----------------|
            | 1  2   4.5 |   <--------->   | 1    4.1   4.5 |
            | 2  1   3.3 |                 | 2    3.3   3.0 |
            | 2  2   3.0 |                 +----------------+
            +------------+
    An alternative to reshape, is to re-extract the OECD data, and going to the extracting option to specify that you want a long format (although the "long" term isn't used in OECD websites).

    Then, to perform a real gravity model for trade, you'll have to add at least information on the country size (GDP) and the bilateral distance (you could find them on the CEPII website, in the dataset called gravity), and the terror data you want to investigate.
    You'll also have to declare your data to be panel data
    Code:
    xtset country year
    Then you could run your gravity model.

    I hope this helps,
    Charlie

    Ps: As asked per FAQ, please use dataex to report your data (available from SSC); Also, you might think that gravity model is a trivial notion everybody knows, but all Stata users are not international economists. So in order to increase the probabilities of answers, don't use such specific terms in your topic name.

    Comment

    Working...
    X