Announcement

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

  • I need help to create a variable

    Hi Statlistas!

    I am currently working on a dataset (tradedata from 2004--2016) where I have created a dummy-variable called "Crisis". I want this variable to represent the global financial crisis of 2008 and therefore I have definied it as a dummy based on time, so that year 2008 and 2009 takes on a value of 1 (and all other years takes on a value of 0). However, my teacher critized me for defining it this way and suggested that I would define it based on a drop in GDP. How do I perform this in stata? I.e. how do I create a dummy variable that takes on the value of 1 when GDP drops below a certain percentage? (for example). If you have any better suggestions on how to create the variable I would be beyond grateful!

    When I defined "Crisis" based on Year, it was fairly easy to this in Stata, where I used this code:

    Code:
    gen Crisis=0
    replace Crisis=1 if Year==2008
    replace Crisis=1 if Year==2009
    This is how my dataset looks like:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str15 Importer str30 Exporter double Imports int Year double(GDPimporter GDPexporter) byte Crisis
    "France"          "United Arab Emirates"       648410.85 2004  2115742488204.619 147824370319.94556 0
    "Portugal"        "Qatar"                      20200.001 2004  189187437298.2369 31734065934.065933 0
    "Italy"           "Turkey"                   4933186.063 2004 1798314750434.5667 404786740091.19604 0
    "Sweden"          "Croatia"                   129844.593 2004  381705425301.7458   41574530815.5047 0
    "Germany"         "Honduras"                      114180 2004 2819245095604.6685  8772194250.270214 0
    "United Kingdom"  "Seychelles"                107903.697 2004 2398555474185.2803  839319927.2727273 0
    "Belgium"         "Guatemala"                  16508.368 2004  370885026074.0005 23965275995.721386 0
    "Denmark"         "Jamaica"                      281.633 2004 251373036671.06207 10150978154.548418 0
    "Hungary"         "Grenada"                           10 2004 104066609517.92836  599118592.5925926 0
    "Poland"          "Grenada"                       20.445 2004  255102252843.3946  599118592.5925926 0
    "Cyprus"          "Guatemala"                      111.9 2004        17422375000 23965275995.721386 0
    "Finland"         "Madagascar"                   120.726 2004 196768065557.48697   4363934494.37405 0
    "United Kingdom"  "Argentina"                 565319.435 2004 2398555474185.2803 164657930452.78662 0
    "Estonia"         "Bermuda"                     2401.643 2004 12059201242.236025         4484703000 0
    "Denmark"         "Cayman Islands"               544.001 2004 251373036671.06207                  . 0
    "United Kingdom"  "Ghana"                     373534.056 2004 2398555474185.2803   8881368538.07671 0
    "Ireland"         "Niger"                       1830.913 2004  193870350136.5781  3052898739.467802 0
    "Portugal"        "Turkey"                    438144.182 2004  189187437298.2369 404786740091.19604 0
    "Luxembourg"      "Albania"                        1.843 2004 34685281847.529175  7314865175.619896 0
    "Cyprus"          "Sierra Leone"                   69.88 2004        17422375000 1448536630.8917043 0
    "France"          "Aruba"                     114299.367 2004  2115742488204.619 2228279329.6089387 0
    "France"          "Uganda"                      40355.88 2004  2115742488204.619  7940362799.179966 0
    "Netherlands"     "United Arab Emirates"      552146.414 2004  650532654581.5743 147824370319.94556 0
    "France"          "Korea, Rep."              3896355.152 2004  2115742488204.619  764880644710.6486 0
    "Ireland"         "Guatemala"                    678.881 2004  193870350136.5781 23965275995.721386 0
    "Portugal"        "Marshall Islands"              13.092 2004  189187437298.2369 131334599.99999999 0
    "Lithuania"       "Israel"                      8566.473 2004 22649930576.254345 135445033199.46452 0
    "Latvia"          "Burma"                         44.896 2004 14373269155.717443 10567354056.404905 0
    "France"          "Kenya"                     104704.863 2004  2115742488204.619 16095337093.836601 0
    "Greece"          "Cape Verde"                     4.202 2004 240521260988.32877  924318490.7598001 0
    "Finland"         "Suriname"                      40.744 2004 196768065557.48697 1484092538.4052672 0
    "Denmark"         "Micronesia, Fed. Sts."           .451 2004 251373036671.06207          240097000 0
    "Spain"           "United Arab Emirates"      114508.018 2004 1069555500372.4857 147824370319.94556 0
    "Greece"          "Panama"                     36830.984 2004 240521260988.32877        15013381700 0
    "Sweden"          "Grenada"                        2.865 2004  381705425301.7458  599118592.5925926 0
    "France"          "Armenia"                     2418.218 2004  2115742488204.619   3576615240.41616 0
    "Belgium"         "Singapore"                 576391.156 2004  370885026074.0005 114188557567.15183 0
    "Luxembourg"      "Russian Federation"         10377.366 2004 34685281847.529175  591016690742.7976 0
    "Germany"         "Namibia"                        56809 2004 2819245095604.6685  6606858786.011735 0
    "Cyprus"          "Lao PDR"                       10.788 2004        17422375000  2366398119.882102 0
    "France"          "Chad"                        8635.427 2004  2115742488204.619  4414929219.996487 0
    "Cyprus"          "Sri Lanka"                    3340.98 2004        17422375000  20662525941.29855 0
    "France"          "Macao"                     129318.691 2004  2115742488204.619 10585624890.927675 0
    "Slovenia"        "Lebanon"                       90.002 2004 34470227453.911316  20955223880.59701 0
    "Slovak Republic" "Micronesia, Fed. Sts."          2.894 2004  57240535137.81972          240097000 0
    "United Kingdom"  "Lebanon"                    23348.289 2004 2398555474185.2803  20955223880.59701 0
    "Poland"          "United States of America" 2119431.616 2004  255102252843.3946      1.2274928e+13 0
    "Ireland"         "St. Lucia"                    302.161 2004  193870350136.5781  893107210.7888889 0
    "Slovenia"        "Japan"                     243779.972 2004 34470227453.911316  4815148854362.112 0
    "Slovenia"        "Dominican Republic"           542.206 2004 34470227453.911316 22692574473.346703 0
    "Sweden"          "El Salvador"                  1152.92 2004  381705425301.7458        13724810900 0
    "Belgium"         "Macedonia, FYR"             33987.668 2004  370885026074.0005    5682719260.0763 0
    "Slovak Republic" "Burkina Faso"                   51.43 2004  57240535137.81972  4838551099.709853 0
    "Germany"         "Algeria"                      1027560 2004 2819245095604.6685  85324998813.60402 0
    "Hungary"         "Antigua and Barbuda"               84 2004 104066609517.92836  919577148.1481481 0
    "Greece"          "Senegal"                    23358.596 2004 240521260988.32877  8031344381.098982 0
    "Slovenia"        "China"                     478261.592 2004 34470227453.911316 1955347004963.2708 0
    "Poland"          "El Salvador"                 1705.208 2004  255102252843.3946        13724810900 0
    "Italy"           "Sao Tome and Principe"        230.504 2004 1798314750434.5667 104486043.47856033 0
    "Germany"         "Georgia"                        27725 2004 2819245095604.6685  5125363000.834724 0
    "France"          "Central African Republic"   10816.053 2004  2115742488204.619 1270080250.6526783 0
    "Slovak Republic" "United States of America"   473561.68 2004  57240535137.81972      1.2274928e+13 0
    "Hungary"         "Marshall Islands"                 899 2004 104066609517.92836 131334599.99999999 0
    "Germany"         "United States of America"    50013340 2004 2819245095604.6685      1.2274928e+13 0
    "Netherlands"     "Liberia"                     5767.585 2004  650532654581.5743 474699999.99999994 0
    "France"          "Botswana"                    4662.285 2004  2115742488204.619  8957467706.535404 0
    "Slovak Republic" "Indonesia"                  110238.41 2004  57240535137.81972  256836875295.4519 0
    "Germany"         "Sri Lanka"                     315858 2004 2819245095604.6685  20662525941.29855 0
    "Greece"          "Georgia"                    55843.759 2004 240521260988.32877  5125363000.834724 0
    "Netherlands"     "Turkmenistan"                  23.643 2004  650532654581.5743  6838351088.466884 0
    "France"          "Burkina Faso"                9099.416 2004  2115742488204.619  4838551099.709853 0
    "Ireland"         "Argentina"                  48110.391 2004  193870350136.5781 164657930452.78662 0
    "Italy"           "Canada"                   1669866.099 2004 1798314750434.5667 1023196003074.5581 0
    "Netherlands"     "Qatar"                       6147.113 2004  650532654581.5743 31734065934.065933 0
    "Slovak Republic" "Japan"                     583910.219 2004  57240535137.81972  4815148854362.112 0
    "Hungary"         "Burma"                            127 2004 104066609517.92836 10567354056.404905 0
    "Slovak Republic" "Maldives"                         1.2 2004  57240535137.81972       1226829562.5 0
    "United Kingdom"  "El Salvador"                13337.098 2004 2398555474185.2803        13724810900 0
    "Italy"           "Angola"                     35355.777 2004 1798314750434.5667 19640853733.597954 0
    "Greece"          "Fiji"                            .124 2004 240521260988.32877  2727507212.925563 0
    "Denmark"         "Indonesia"                 171495.119 2004 251373036671.06207  256836875295.4519 0
    "Cyprus"          "Comoros"                          .03 2004        17422375000  368143118.6899598 0
    "France"          "Trinidad and Tobago"       299136.315 2004  2115742488204.619 13280275123.035402 0
    "Malta"           "Sierra Leone"                    .029 2004  6062780269.058296 1448536630.8917043 0
    "Cyprus"          "Jordan"                      2601.052 2004        17422375000 11411390409.026798 0
    "Greece"          "Cayman Islands"               4399.51 2004 240521260988.32877                  . 0
    "Ireland"         "Mongolia"                       4.844 2004  193870350136.5781 1992066808.0959773 0
    "Finland"         "Iceland"                    14637.984 2004 196768065557.48697 13722824251.300367 0
    "Luxembourg"      "Algeria"                       214.85 2004 34685281847.529175  85324998813.60402 0
    "Czech Republic"  "India"                     179433.013 2004 119162172468.26823  699688852930.2765 0
    "Denmark"         "Cape Verde"                   580.211 2004 251373036671.06207  924318490.7598001 0
    "United Kingdom"  "Equatorial Guinea"           24050.36 2004 2398555474185.2803  4410764338.667325 0
    "Hungary"         "C�te d'Ivoire"                 4053 2004 104066609517.92836  16554441846.51915 0
    "Lithuania"       "Uruguay"                     1447.599 2004 22649930576.254345 13686329890.119078 0
    "France"          "Cayman Islands"              9186.492 2004  2115742488204.619                  . 0
    "Netherlands"     "Albania"                     2898.103 2004  650532654581.5743  7314865175.619896 0
    "Latvia"          "Lebanon"                       68.513 2004 14373269155.717443  20955223880.59701 0
    "Austria"         "Burkina Faso"                 393.007 2004  300904221504.8423  4838551099.709853 0
    "Netherlands"     "Philippines"              2643034.758 2004  650532654581.5743  91371242495.85616 0
    "Greece"          "Armenia"                      813.247 2004 240521260988.32877   3576615240.41616 0
    end
    Thanks in advance. Kindly regards,

    Gabriel Bladh

  • #2
    Gabriel:
    two issues (at least) with your teacher's suggestion:
    - which is the GDP the decrease refers to (Importer? Exporter? Both of them?);
    - which is the percentage reduction in GDP that defines crisis vs non-crisis?
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo, thanks for the reply.

      1. Both Importes and Exporters, I think.
      2. I don´t quite know actually. I thought that I could create a "drop" in GDP based on a decline in GDP, somehow. I don´t really know how to measure crisis in another way than the way that I did with a year-dummy. Maybe I need data on GDP growth rate?

      Comment


      • #4
        You could look at negative GDP growth. However, that's arguably not appropriate for the "global financial crisis." I think using 2008-2009 is fair because there are other countries that could be experiencing a contraction in growth due to unrelated factors between 2010 and 2016. If you define the crisis variable on some arbitrary cut off, then you're essentially capturing recessionary periods (some of which will contain the financial crisis). For what it's worth, and to illustrate the point I'm trying to make, here's an example dataset using Gross State Product (GSP) for US states. Note, the official dates for the Great Recession in the United States were December 2007 to June 2009. If I were to define the crisis as a period with negative growth, I would capture other recessionary periods unrelated to the financial crisis. For example, states like Texas experienced 5 consecutive declines in GSP growth (YTY%) starting in the second half of 2015, and Alaska had significant declines in GSP (post Great Recession), not because of the Great Recession/Financial Crisis, but due to the global commodity bust.

        Also, for purposes of defining a "crisis" variable as a negative growth rate in GSP, here's how I would proceed using an example data set.

        Code:
        bys region (quarter): gen gr_gsp = 100*(gsp/gsp[_n-4]-1)
        drop if missing(gr_gsp)
        
        generate crisis = (gr_gsp < 0 ) // defined as negative YTY growth
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input str20 region double gsp float(quarter gr_gsp)
        "Alabama" 161934 184   5.610049
        "Alabama" 163974 185   5.151981
        "Alabama" 165470 186   5.102358
        "Alabama" 166495 187   3.869165
        "Alabama" 166821 188   3.017896
        "Alabama" 169261 189  3.2242916
        "Alabama" 171456 190   3.617574
        "Alabama" 172156 191   3.400102
        "Alabama" 171941 192   3.069158
        "Alabama" 174068 193   2.839993
        "Alabama" 174268 194   1.640071
        "Alabama" 170307 195 -1.0740259
        "Alabama" 168708 196  -1.880296
        "Alabama" 167954 197 -3.5124204
        "Alabama" 168176 198  -3.495765
        "Alabama" 168420 199 -1.1079991
        "Alabama" 170249 200   .9134125
        "Alabama" 173562 201  3.3390095
        "Alabama" 177097 202   5.304562
        "Alabama" 177933 203   5.648379
        "Alabama" 176898 204   3.905456
        "Alabama" 179679 205   3.524389
        "Alabama" 181916 206   2.721108
        "Alabama" 184166 207   3.503004
        "Alabama" 185386 208   4.798245
        "Alabama" 187043 209    4.09842
        "Alabama" 185204 210  1.8074276
        "Alabama" 185881 211   .9312251
        "Alabama" 189436 212  2.1846309
        "Alabama" 189037 213  1.0660651
        "Alabama" 191125 214   3.197015
        "Alabama" 191678 215   3.118662
        "Alabama" 189855 216   .2211829
        "Alabama" 193038 217  2.1165168
        "Alabama" 196549 218   2.837933
        "Alabama" 196423 219   2.475506
        "Alabama" 197189 220   3.862948
        "Alabama" 199563 221  3.3801634
        "Alabama" 201277 222   2.405507
        "Alabama" 201187 223   2.425378
        "Alabama" 201898 224   2.388064
        "Alabama" 204140 225  2.2935114
        "Alabama" 204389 226   1.546128
        "Alabama" 206378 227  2.5801866
        "Alabama" 208970 228   3.502759
        "Alabama" 209810 229  2.7775056
        "Alabama" 211134 230    3.30008
        "Alabama" 213903 231   3.646222
        "Alaska"   42872 184   14.27353
        "Alaska"   44653 185   14.76855
        "Alaska"   45349 186  11.447248
        "Alaska"   45840 187   6.263619
        "Alaska"   46658 188   8.830938
        "Alaska"   48964 189   9.654447
        "Alaska"   49866 190   9.960528
        "Alaska"   51298 191  11.906631
        "Alaska"   52981 192  13.551803
        "Alaska"   56566 193  15.525692
        "Alaska"   58266 194  16.845144
        "Alaska"   54032 195   5.329642
        "Alaska"   51403 196  -2.978426
        "Alaska"   50044 197 -11.529894
        "Alaska"   49377 198 -15.255896
        "Alaska"   51027 199  -5.561519
        "Alaska"   52405 200  1.9493026
        "Alaska"   53656 201   7.217649
        "Alaska"   54691 202  10.762095
        "Alaska"   55785 203   9.324475
        "Alaska"   55341 204   5.602519
        "Alaska"   58985 205   9.931787
        "Alaska"   59197 206   8.239016
        "Alaska"   61514 207  10.269786
        "Alaska"   60746 208   9.766719
        "Alaska"   61464 209  4.2027636
        "Alaska"   61013 210   3.067723
        "Alaska"   60338 211   -1.91176
        "Alaska"   60694 212 -.08560234
        "Alaska"   59328 213  -3.475205
        "Alaska"   60263 214 -1.2292463
        "Alaska"   58946 215  -2.307004
        "Alaska"   58791 216 -3.1354005
        "Alaska"   58917 217  -.6927589
        "Alaska"   58395 218  -3.099746
        "Alaska"   56667 219 -3.8662505
        "Alaska"   53098 220  -9.683455
        "Alaska"   53554 221  -9.102636
        "Alaska"   52211 222 -10.589948
        "Alaska"   50931 223 -10.122293
        "Alaska"   49682 224  -6.433387
        "Alaska"   50377 225   -5.93233
        "Alaska"   50788 226 -2.7254794
        "Alaska"   51320 227   .7637784
        "Alaska"   51976 228  4.6173663
        "Alaska"   51791 229  2.8068364
        "Alaska"   52987 230   4.329763
        "Alaska"   54403 231   6.007404
        "Arizona" 241787 184   10.80676
        "Arizona" 244659 185   8.981452
        "Arizona" 250886 186   8.313725
        "Arizona" 256505 187   9.105101
        end
        format %tq!Qq-YY quarter
        Last edited by Justin Niakamal; 12 Jan 2019, 12:15.

        Comment


        • #5
          Thanks so much for the help, Justin Blasongame!


          I think I managed to create a variable like you suggested, but this is just for the importer. I used this commandos:

          Code:
          gen gr_gdp = 100* (GDPimporter/GDPimporter[_n-4]-1)
          gen crisis=(gr_gdp<0)
          gen crisiseuro=Euro*crisis
          Is this the way to do it, or should I do it like this:

          Code:
          gen gr_gdp = 100* (GDPimporter/GDPexporter[_n-4]-1)
          gen crisis=(gr_gdp<0)
          gen crisiseuro=Euro*crisis
          Also, what is the gr_gdp variable tells me? Should I include the variable in the regression? The regression that I used know is this:

          Code:
          xtreg lnimports lnGDPimporter lnGDPexporter lnDistance lnimporterpopulation lnexporterpopulation Tradeagreements Landlockedexporter Euro crisiseuro crisis Colony Comlang_off Contig gr_gdp, fe robust
          With this kind of variable, there can be a crisis at any year between 2004-2016 (the years which my data consists of), is it possible to reduce that, so I just look at what happens between 2008-2010, and not the years before or after that?

          This is how the data looks like with the the commando with GDPimporter/GDPexporter:

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input double(lnimports lnGDPimporter lnGDPexporter lnDistance) int Year float(crisis crisiseuro) byte Euro
            4.109068870544434 26.430057525634766 21.726654052734375  9.699665069580078 2004 0 0 1
            7.427595615386963 26.430057525634766 23.040836334228516  9.078567504882813 2004 0 0 1
            5.930883407592773 26.430057525634766  22.80693244934082   9.30491828918457 2004 0 0 1
            11.52767276763916 26.430057525634766  23.02813148498535  6.233914852142334 2004 0 0 1
           10.742878913879395 26.430057525634766  24.32407569885254  7.959193706512451 2004 0 0 1
            5.603976726531982 26.430057525634766 21.516952514648438  8.404396057128906 2004 0 0 1
            2.025381326675415 26.430057525634766 22.232093811035156  8.483724594116211 2004 0 0 1
           7.4221673011779785 26.430057525634766  23.03888511657715  8.484992027282715 2004 0 0 1
            7.888939380645752 26.430057525634766 22.894996643066406  9.304105758666992 2004 0 0 1
            7.469412803649902 26.430057525634766 22.259838104248047  8.672261238098145 2004 0 0 1
           10.236309051513672 26.430057525634766  25.09075164794922 7.7774577140808105 2004 0 0 1
           12.943277359008789 26.430057525634766  24.89585304260254  6.958908557891846 2004 0 0 1
           3.1597201824188232 26.430057525634766 23.700878143310547  8.757314682006836 2004 0 0 1
           11.918264389038086 26.430057525634766 24.899322509765625  8.841007232666016 2004 0 0 1
            9.487003326416016 26.430057525634766 23.081035614013672  8.972580909729004 2004 0 0 1
            9.174396514892578 26.430057525634766 25.719289779663086    8.3536958694458 2004 0 0 1
           12.150086402893066 26.430057525634766 25.238197326660156   9.19556713104248 2004 0 0 1
            6.342255115509033 26.430057525634766  23.15787696838379  7.802321434020996 2004 0 0 1
           1.3759914636611938 26.430057525634766 18.444074630737305  9.552101135253906 2004 0 0 1
            9.767420768737793 26.430057525634766 25.486080169677734  9.183858871459961 2004 0 0 1
            9.466147422790527 26.430057525634766 23.432207107543945  9.180505752563477 2004 0 0 1
           2.8610572814941406 26.430057525634766 22.207313537597656  8.517511367797852 2004 0 0 1
            6.519496917724609 26.430057525634766 21.384445190429688  8.495288848876953 2004 0 0 1
            7.722383499145508 26.430057525634766 24.366180419921875  9.075462341308594 2004 0 0 1
            5.383159160614014 26.430057525634766 22.388227462768555  8.426852226257324 2004 0 0 1
            .7659328579902649 26.430057525634766 19.296552658081055  9.461549758911133 2004 0 0 1
            5.956924915313721 26.430057525634766  20.37041473388672    8.7913179397583 2004 0 0 1
            5.219344615936279 26.430057525634766 20.035228729248047  8.960711479187012 2004 0 0 1
          -1.8201589584350586 26.430057525634766  16.88518714904785   9.63743782043457 2004 0 0 1
           11.031723976135254 26.430057525634766 23.210670471191406  8.334248542785645 2004 0 0 1
           11.044038772583008 26.430057525634766 24.163143157958984  7.217124938964844 2004 0 0 1
           12.559203147888184 26.430057525634766 24.223472595214844  7.464330673217773 2004 0 0 1
            2.133100748062134 26.430057525634766 20.644567489624023   8.55543327331543 2004 0 0 1
            9.869824409484863 26.430057525634766    23.082763671875  9.070832252502441 2004 0 0 1
            9.852150917053223 26.430057525634766 22.644855499267578  9.037650108337402 2004 0 0 1
            11.17016315460205 26.430057525634766 27.139841079711914   9.67965316772461 2004 0 0 1
           10.648253440856934 26.430057525634766  23.52992057800293  8.547163009643555 2004 0 0 1
           13.646940231323242 26.430057525634766 27.362985610961914  9.022687911987305 2004 0 0 1
            8.756970405578613 26.430057525634766 22.894853591918945  9.193085670471191 2004 0 0 1
            8.381043434143066 26.430057525634766 23.899871826171875    9.2113037109375 2004 1 1 1
            8.409673690795898 26.430057525634766 23.342327117919922  7.969537734985352 2004 0 0 1
            6.833615779876709 26.430057525634766  20.54810333251953  8.854153633117676 2004 1 1 1
           12.796358108520508 26.430057525634766 25.875953674316406  9.041974067687988 2004 0 0 1
            12.14148998260498 26.430057525634766  26.27170753479004  9.264248847961426 2004 0 0 1
            5.319790363311768 26.430057525634766  24.80823516845703  8.136408805847168 2004 0 0 1
            5.476518154144287 26.430057525634766  24.18065643310547   8.29106616973877 2004 0 0 1
           12.793291091918945 26.430057525634766 26.300567626953125  7.209117412567139 2004 0 0 1
            6.796091556549072 26.430057525634766  21.80019760131836  7.187053203582764 2004 0 0 1
           10.687023162841797 26.430057525634766 22.884342193603516  7.931599140167236 2004 0 0 1
           3.2465689182281494 26.430057525634766 20.073129653930664  8.988420486450195 2004 0 0 1
            8.179983139038086 26.430057525634766 22.357467651367188  7.757308006286621 2004 0 0 1
           10.761991500854492 26.430057525634766  23.94561195373535  7.754681587219238 2004 0 0 1
           3.7820966243743896 26.430057525634766 20.176443099975586  8.500774383544922 2004 0 0 1
           1.0061314105987549 26.430057525634766 20.798742294311523  9.404891014099121 2004 0 0 1
            7.953655242919922 26.430057525634766 23.299699783325195   8.25559139251709 2004 0 0 1
            7.812648296356201 26.430057525634766 22.707563400268555  8.738405227661133 2004 0 0 1
            7.309637546539307 26.430057525634766 22.795225143432617  8.622230529785156 2004 0 0 1
            4.602636814117432 26.430057525634766 22.915754318237305  9.009078979492188 2004 0 0 1
           15.058122634887695 26.430057525634766 26.700031280517578   6.52925443649292 2004 0 0 1
            4.332889080047607 26.430057525634766 19.978193283081055    8.5794038772583 2004 0 0 1
            9.574542045593262 26.430057525634766 21.678096771240234  6.850272178649902 2004 0 0 1
            6.379464626312256 26.430057525634766 21.412439346313477    8.7495756149292 2004 0 0 1
            9.109384536743164 26.430057525634766   22.9072208404541   8.51797103881836 2004 1 1 1
           10.231914520263672 26.430057525634766 22.398086547851563  9.099616050720215 2004 0 0 1
            4.982571601867676 26.430057525634766  22.92661476135254   9.01504898071289 2004 0 0 1
            8.148465156555176 26.430057525634766 23.342470169067383  9.210250854492188 2004 0 0 1
             8.85025405883789 26.430057525634766 21.453781127929688  8.363076210021973 2004 0 0 1
            8.350140571594238 26.430057525634766  22.48036003112793  9.203435897827148 2004 0 0 1
            5.973827362060547 26.430057525634766 22.299880981445313    8.3732328414917 2004 0 0 1
           11.550970077514648 26.430057525634766  25.82713508605957  9.378711700439453 2004 0 0 1
            9.515949249267578 26.430057525634766  22.64581298828125  8.174971580505371 2004 0 0 1
            7.575038909912109 26.430057525634766 23.339662551879883  9.368439674377441 2004 0 0 1
            .7134398818016052 26.430057525634766 20.090478897094727  8.520466804504395 2004 0 0 1
            6.038238525390625 26.430057525634766 21.459932327270508   8.65477180480957 2004 0 0 1
           11.378223419189453 26.430057525634766 24.811357498168945 7.8195672035217285 2004 0 0 1
           2.3341805934906006 26.430057525634766  20.63942527770996   8.95383358001709 2004 0 0 1
            5.735904216766357 26.430057525634766  21.11806869506836  9.008349418640137 2004 0 0 1
           12.794537544250488 26.430057525634766  27.65395164489746  8.842537879943848 2004 0 0 1
             7.20329475402832 26.430057525634766  23.27472496032715  8.783731460571289 2004 0 0 1
            8.068872451782227 26.430057525634766  21.58463478088379  9.019624710083008 2004 0 0 1
             8.96318531036377 26.430057525634766  22.57732582092285  9.064332008361816 2004 0 0 1
            8.623270034790039 26.430057525634766  22.71317481994629  6.700648307800293 2004 1 1 1
            5.857281684875488 26.430057525634766   19.7418270111084  8.968419075012207 2004 0 0 1
           13.728191375732422 26.430057525634766 26.726625442504883  7.150717258453369 2004 0 0 1
           -4.074542045593262 26.430057525634766  18.91638946533203  9.341985702514648 2004 0 0 1
            5.888057708740234 26.430057525634766 22.806617736816406  8.487581253051758 2004 0 0 1
           7.0957207679748535 26.430057525634766 22.022462844848633  8.565576553344727 2004 0 0 1
            4.705784320831299 26.430057525634766  21.98674774169922   9.03543472290039 2004 1 1 1
            7.647375583648682 26.430057525634766 25.445804595947266  9.064820289611816 2004 0 0 1
            6.616827964782715 26.430057525634766 22.771770477294922   8.58780288696289 2004 0 0 1
            3.210198402404785 26.430057525634766 18.464563369750977  8.598708152770996 2004 0 0 1
             8.66943645477295 26.430057525634766 23.845304489135742  9.013547897338867 2004 0 0 1
           11.280980110168457 26.430057525634766 25.970518112182617  8.066198348999023 2004 0 0 1
            4.787883281707764 26.430057525634766 21.093820571899414  8.560819625854492 2004 0 0 1
           10.029143333435059 26.430057525634766  23.86501693725586  6.905978679656982 2004 0 0 1
            4.292074680328369 26.430057525634766 20.927698135375977  8.893835067749023 2004 0 0 1
            2.640841484069824 26.430057525634766 19.250795364379883  9.731990814208984 2004 0 0 1
           11.448460578918457 26.430057525634766  25.32050895690918  9.435242652893066 2004 0 0 1
            8.485320091247559 26.430057525634766 23.501794815063477  8.674907684326172 2004 0 0 1
            9.049849510192871 26.430057525634766  24.92449951171875  9.329839706420898 2004 0 0 1
          end
          Last edited by Gabriel Bladh; 14 Jan 2019, 07:28.

          Comment


          • #6
            Hi Gabriel,

            My example was using quarterly data, and since you're using annual data you'll want to change
            Code:
            gen gr_gdp = 100* (GDPimporter/GDPimporter[_n-4]-1)
            to
            Code:
             gen gr_gdp = 100* (GDPimporter/GDPimporter[_n-1]-1)
            Also, as mentioned before, defining the crisis period as negative growth will capture recessionary periods across these countries, rather than defining the Finanical Crisis as a period in time. This is correct
            Code:
             gen gr_gdp = 100* (GDPimporter/GDPimporter[_n-1]-1)
            I assume you'll want GDP growth for the same country, just be careful with how your data is structured/sorted.
            Also, what is the gr_gdp variable tells me? Should I include the variable in the regression? The regression that I used know is this:
            This tells you GDP growth, which is a good measure of the business cycle and how recessions are dated (loosely speaking of course, there's more that goes into recession start and end dates).
            With this kind of variable, there can be a crisis at any year between 2004-2016 (the years which my data consists of), is it possible to reduce that, so I just look at what happens between 2008-2010, and not the years before or after that?
            Yes, you can pick any time period using an if. For example,
            Code:
             xtreg y x z if  year > 2007 & year < 2011, fe
            Again, a caveat, negative GDP growth is not a crisis.

            Comment


            • #7
              Thanks so much for the help, I really appriciate it.

              Just a last question (I hope). When I use this commando:

              Code:
              gen gr_gdp = 100* (GDPimporter/GDPimporter[_n-1]-1)
              do I only look at the GDP growth for importers? Do I have to create a similar variable for exporters or can I use this commando to include both importers and exporter?

              Code:
              (GDPimporter/GDPexporter[_n-1]-1)
              Again, thanks a lot!

              Comment


              • #8
                I would say it depends on your research question/model.

                I would stick with this for importers
                Code:
                gen gr_gdp = 100* (GDPimporter/GDPimporter[_n-1]-1)
                And for exporters

                Code:
                gen gr_gdp = 100* (GDPexporter/GDPexporter[_n-1]-1)

                Comment

                Working...
                X