+ Reply to Thread
Results 1 to 7 of 7

Thread: building Panel Data

  1. #1
    Points: 2,958, Level: 33
    Level completed: 39%, Points required for next Level: 92

    Posts
    38
    Thanks
    3
    Thanked 0 Times in 0 Posts

    building Panel Data



    Hi All,

    I am trying to build a panel data set, which shows flows from 23 developed country to 18 developing country for the period from 1995 to 2010.

    In fact, its the first time for me. So, I put each developed country in 288 row (18 developing for 16 years) with the 18 developing for 16 years period as follows.

    UK Albania
    UK 16 row
    . Albania
    . Algeria
    288 row 16 row
    UK Algeria
    .
    .

    US Albania
    16 row
    . Albania
    . Algeria
    16 row
    Algeria
    288row .
    US .

    then I put the ID "1" for the first developed (to declare the dataset), "2" for the second; and so on until the number "23". and the year from 1995 - 2010 repeated for each developing country.

    Is this structure true, is the ID done well.

    Thank you for your help

  2. #2
    RoboStataRaptor
    Points: 7,402, Level: 57
    Level completed: 26%, Points required for next Level: 148
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,026
    Thanks
    9
    Thanked 243 Times in 236 Posts

    Re: building Panel Data

    I think that looks fine. If I were doing this I'd use something like:
    Code: 
    clear
    set obs 23
    gen developed=_n
    expand 18
    bysort developed : gen developing=_n
    expand 16
    bysort developed developing : gen year=1994 + _n
    Then set up value labels for the developed and developing countries:
    Code: 
    label define developed 1 "UK" 2 "USA" ...
    label values developed developed
    label define developing 1 "Albania" ...
    label values developing developing

  3. The Following User Says Thank You to bukharin For This Useful Post:

    momo (07-28-2012)

  4. #3
    Points: 2,958, Level: 33
    Level completed: 39%, Points required for next Level: 92

    Posts
    38
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: building Panel Data

    Thank you very much, your programming is wonderful.

    Now I have developed ID var. from 1-23 each num. repeats 288 time.

    And developing ID var. takes values from 1-18 (for eighteen developing country) each num. repeats 16 time, and this structure repeats 23 (one time with each developed country)

    As I mentioned before the question is, for declare the panel data set in STATA, which variables I have to choose.

    The time variable is YEAR but which one is the panel ID variable, is it the developed ID OR developing ID.

    your help much appreciated.

  5. #4
    RoboStataRaptor
    Points: 7,402, Level: 57
    Level completed: 26%, Points required for next Level: 148
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,026
    Thanks
    9
    Thanked 243 Times in 236 Posts

    Re: building Panel Data

    Short answer - I don't know. Most panel analyses seem to assume that observations are clustered within panels rather than both within and across panels. Somebody else might have some suggestions...

  6. #5
    Probably A Mammal
    Points: 14,507, Level: 78
    Level completed: 15%, Points required for next Level: 343
    bryangoodrich's Avatar
    Location
    Sacramento, California, United States
    Posts
    1,956
    Thanks
    223
    Thanked 419 Times in 387 Posts

    Re: building Panel Data

    If you're modeling flows between countries, wouldn't the unit be the two country pair? It seems to me that your panel is a pair of countries marking the observation. Something like

    Code: 
    Outflow Inflow Year Value
         UK     Y1 1995 10000
         UK     Y2 1995 10202
    ...
         UK    Y18 1995 10203
         UK     Y1 1996 19292
    ...
         UK    Y18 2000 29292
         US     Y1 1995 10101
    ...
    Each of the (UK, Y1), etc. represent a single unit. You would create a primary key for this table that represents that unit. That way, you have Units and Time variables that represent each observation. You could then cross tab the values for each unit and time to represent the panel.

  7. #6
    RoboStataRaptor
    Points: 7,402, Level: 57
    Level completed: 26%, Points required for next Level: 148
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,026
    Thanks
    9
    Thanked 243 Times in 236 Posts

    Re: building Panel Data

    ... but if each two country pair is the analysis unit, you're assuming that (for example) exports from Germany to the UK are independent of exports from Germany to Australia. This doesn't seem a reasonable assumption.

  8. #7
    Probably A Mammal
    Points: 14,507, Level: 78
    Level completed: 15%, Points required for next Level: 343
    bryangoodrich's Avatar
    Location
    Sacramento, California, United States
    Posts
    1,956
    Thanks
    223
    Thanked 419 Times in 387 Posts

    Re: building Panel Data


    Good point. If the interest is to model the flow of goods from one country, then it seems you'd want that country (on the LHS) to be the unit of analysis. Each country to which its goods are flowing (the RHS) is just one instance from the sample of its outflows, right? I don't see anything wrong with going that route.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats