Announcement

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

  • Event Study help

    Hi

    i'm doing a 'market model' style event study. I'm looking at the effects of a Fed announcement upon a currency.

    As i have no market returns to compute abnormal returns, I will be calculating the theoretical variation in the currency over the preceding 300 days before the event. i will use the mean variation during the estimation window. Theoretical variation (over 300 days, estimation window) = SUM (t=300) [ Variation ]/300.

    I have currently undertaken the following steps in preparation for my event study (from do file):
    gen ret = ln(px_last[_n+1] / px_last[_n])
    destring date, ignore("/") replace
    gen day_cnt = _n
    gen target_day = day_cnt if date==20092017
    egen max_target_day = max(target_day)
    gen evday = day_cnt-max_target_day
    drop day_cnt target_day
    max_target_day
    sort evday
    gen evt_window=1 if evday>=-10 & evday<=10
    gen est_window=1 if evday<=302 & evday>=-2

    (px_last is the exchange rate on that date)

    (I'm a stata newbie, but i believe that 'gen window floor (day_cnt/300)' would be a command i may use. but i dont know how to get further.)

    Thank you
    Last edited by Arthur Jones; 09 Mar 2019, 10:08.

  • #2
    Cross-posted at https://stats.stackexchange.com/ques...-exchange-rate

    Please note our policy on cross-posting, which is that you are asked to tell us about it.

    There is no data example here, but your handling of dates can, I surmise, only cause problems. If you start with string dates such as

    Code:
    "20/09/2017"
    then applying destring to such dates can only produce nonsense. Consider for example

    Code:
    "10/10/2017" 
    as another date. After stripping out the slashes and forcing to integers these dates become

    Code:
    10102017
    20092017
    and are no longer even in the right order. They differ also by nearly 10 million (days?), or about 27000 years.

    The way to handle such dates is through the daily() or date() function, as illustrated by

    Code:
    . display %td daily("20/09/2017", "DMY")
    20sep2017
    For explanation, see

    Code:
    help datetime
    That's just one detail, but an important one. Otherwise it's hard to say whether you are on the right lines without a data example.






    Comment


    • #3
      Thanks for your data example. Did you read https://www.statalist.org/forums/help#stata on how to use dataex to do it? Here is your example again, with the correct way to produce numeric dates added at the end.

      I am bailing out now, as event studies in economics are outside my field, but others may be able to help.

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str10 date float px_last
      "29/12/2017" 3.3125
      "28/12/2017" 3.3127
      "27/12/2017" 3.3166
      "26/12/2017" 3.3092
      "22/12/2017" 3.3376
      "21/12/2017" 3.3066
      "20/12/2017" 3.2961
      "19/12/2017" 3.2911
      "18/12/2017" 3.2889
      "15/12/2017" 3.3024
      "14/12/2017" 3.3353
      "13/12/2017" 3.3174
      "12/12/2017" 3.3192
      "11/12/2017" 3.3038
      "08/12/2017" 3.2935
      "07/12/2017" 3.2933
      "06/12/2017" 3.2353
      "05/12/2017" 3.2429
      "04/12/2017" 3.2454
      "01/12/2017" 3.2578
      "30/11/2017" 3.2681
      "29/11/2017"  3.244
      "28/11/2017" 3.2135
      "27/11/2017" 3.2262
      "24/11/2017" 3.2322
      "23/11/2017" 3.2225
      "22/11/2017" 3.2248
      "21/11/2017" 3.2541
      "20/11/2017" 3.2574
      "17/11/2017" 3.2593
      "16/11/2017" 3.2775
      "14/11/2017" 3.3152
      "13/11/2017" 3.2794
      "10/11/2017" 3.2837
      "09/11/2017" 3.2505
      "08/11/2017" 3.2505
      "07/11/2017" 3.2729
      "06/11/2017" 3.2519
      "03/11/2017" 3.3138
      "01/11/2017"  3.266
      "31/10/2017" 3.2713
      "30/10/2017" 3.2805
      "27/10/2017" 3.2356
      "26/10/2017" 3.2973
      "25/10/2017" 3.2348
      "24/10/2017" 3.2474
      "23/10/2017" 3.2354
      "20/10/2017" 3.1938
      "19/10/2017" 3.1708
      "18/10/2017" 3.1707
      "17/10/2017" 3.1605
      "16/10/2017" 3.1694
      "13/10/2017"  3.146
      "11/10/2017"  3.173
      "10/10/2017" 3.1804
      "09/10/2017" 3.1883
      "06/10/2017" 3.1555
      "05/10/2017" 3.1539
      "04/10/2017" 3.1349
      "03/10/2017" 3.1438
      "02/10/2017" 3.1546
      "29/09/2017" 3.1625
      "28/09/2017" 3.1829
      "27/09/2017" 3.1932
      "26/09/2017" 3.1662
      "25/09/2017" 3.1597
      "22/09/2017"  3.125
      "21/09/2017" 3.1382
      "20/09/2017" 3.1335
      "19/09/2017" 3.1355
      "18/09/2017" 3.1376
      "15/09/2017" 3.1104
      "14/09/2017" 3.1209
      "13/09/2017" 3.1353
      "12/09/2017" 3.1262
      "11/09/2017" 3.1029
      "08/09/2017" 3.0872
      "06/09/2017" 3.1002
      "05/09/2017" 3.1174
      "04/09/2017" 3.1393
      "01/09/2017" 3.1404
      "31/08/2017" 3.1491
      "30/08/2017" 3.1596
      "29/08/2017" 3.1646
      "28/08/2017" 3.1669
      "25/08/2017"  3.159
      "24/08/2017" 3.1482
      "23/08/2017" 3.1424
      "22/08/2017"  3.163
      "21/08/2017" 3.1651
      "18/08/2017" 3.1472
      "17/08/2017" 3.1753
      "16/08/2017" 3.1524
      "15/08/2017" 3.1702
      "14/08/2017" 3.1901
      "11/08/2017" 3.1937
      "10/08/2017"  3.176
      "09/08/2017" 3.1557
      "08/08/2017" 3.1265
      "07/08/2017"  3.126
      "04/08/2017" 3.1318
      "03/08/2017" 3.1146
      "02/08/2017" 3.1137
      "01/08/2017" 3.1265
      "31/07/2017" 3.1254
      "28/07/2017" 3.1316
      "27/07/2017" 3.1507
      "26/07/2017" 3.1384
      "25/07/2017" 3.1725
      "24/07/2017" 3.1466
      "21/07/2017" 3.1433
      "20/07/2017" 3.1213
      "19/07/2017" 3.1488
      "18/07/2017" 3.1565
      "17/07/2017" 3.1824
      "14/07/2017" 3.1796
      "13/07/2017" 3.2116
      "12/07/2017" 3.2084
      "11/07/2017" 3.2545
      "10/07/2017" 3.2557
      "07/07/2017" 3.2811
      "06/07/2017" 3.2984
      "05/07/2017" 3.2891
      "04/07/2017" 3.3096
      "03/07/2017" 3.3018
      "30/06/2017" 3.3082
      "29/06/2017" 3.3029
      "28/06/2017" 3.2797
      "27/06/2017"  3.314
      "26/06/2017" 3.2968
      "23/06/2017" 3.3427
      "22/06/2017" 3.3422
      "21/06/2017" 3.3358
      "20/06/2017" 3.3274
      "19/06/2017" 3.2828
      "16/06/2017" 3.2919
      "14/06/2017" 3.2752
      "13/06/2017" 3.3144
      "12/06/2017" 3.3189
      "09/06/2017" 3.2968
      "08/06/2017" 3.2615
      "07/06/2017" 3.2696
      "06/06/2017" 3.2782
      "05/06/2017" 3.2966
      "02/06/2017" 3.2457
      "01/06/2017" 3.2504
      "31/05/2017"  3.227
      "30/05/2017" 3.2579
      "29/05/2017" 3.2569
      "26/05/2017" 3.2602
      "25/05/2017" 3.2752
      "24/05/2017" 3.2776
      "23/05/2017" 3.2702
      "22/05/2017" 3.2666
      "19/05/2017" 3.2543
      "18/05/2017" 3.3758
      "17/05/2017" 3.1391
      "16/05/2017" 3.0968
      "15/05/2017" 3.1094
      "12/05/2017" 3.1224
      "11/05/2017" 3.1399
      "10/05/2017" 3.1674
      "09/05/2017" 3.1894
      "08/05/2017" 3.1981
      "05/05/2017" 3.1775
      "04/05/2017" 3.1887
      "03/05/2017" 3.1662
      "02/05/2017" 3.1514
      "28/04/2017" 3.1768
      "27/04/2017" 3.1846
      "26/04/2017" 3.1743
      "25/04/2017" 3.1472
      "24/04/2017" 3.1279
      "20/04/2017" 3.1473
      "19/04/2017" 3.1529
      "18/04/2017" 3.1081
      "17/04/2017" 3.1001
      "13/04/2017" 3.1442
      "12/04/2017" 3.1256
      "11/04/2017" 3.1374
      "10/04/2017" 3.1316
      "07/04/2017" 3.1464
      "06/04/2017" 3.1434
      "05/04/2017" 3.1206
      "04/04/2017" 3.0935
      "03/04/2017" 3.1146
      "31/03/2017"  3.122
      "30/03/2017" 3.1508
      "29/03/2017" 3.1197
      "28/03/2017" 3.1413
      "27/03/2017" 3.1266
      "24/03/2017"  3.108
      "23/03/2017" 3.1407
      "22/03/2017" 3.0879
      "21/03/2017" 3.0879
      "20/03/2017" 3.0724
      "17/03/2017" 3.0916
      "16/03/2017"  3.119
      "15/03/2017" 3.1037
      "14/03/2017" 3.1691
      "13/03/2017" 3.1529
      "10/03/2017" 3.1419
      "09/03/2017"  3.193
      "08/03/2017" 3.1704
      "07/03/2017" 3.1193
      "06/03/2017" 3.1375
      "03/03/2017" 3.1155
      "02/03/2017" 3.1534
      "01/03/2017" 3.0938
      "24/02/2017" 3.1104
      "23/02/2017" 3.0631
      "22/02/2017" 3.0646
      "21/02/2017" 3.0964
      "20/02/2017" 3.0878
      "17/02/2017" 3.0978
      "16/02/2017" 3.0898
      "15/02/2017" 3.0574
      "14/02/2017" 3.0852
      "13/02/2017" 3.1103
      "10/02/2017" 3.1151
      "09/02/2017" 3.1273
      "08/02/2017" 3.1156
      "07/02/2017"  3.121
      "06/02/2017" 3.1193
      "03/02/2017"  3.123
      "02/02/2017" 3.1217
      "01/02/2017" 3.1281
      "31/01/2017" 3.1486
      "30/01/2017" 3.1265
      "27/01/2017" 3.1409
      "26/01/2017" 3.1744
      "25/01/2017" 3.1701
      "24/01/2017" 3.1705
      "23/01/2017" 3.1646
      "20/01/2017" 3.1743
      "19/01/2017" 3.2018
      "18/01/2017" 3.2232
      "17/01/2017" 3.2116
      "16/01/2017" 3.2414
      "13/01/2017" 3.2176
      "12/01/2017" 3.1868
      "11/01/2017"  3.197
      "10/01/2017" 3.1941
      "09/01/2017" 3.1997
      "06/01/2017" 3.2226
      "05/01/2017" 3.1988
      "04/01/2017" 3.2213
      "03/01/2017"  3.265
      "02/01/2017" 3.2859
      "30/12/2016" 3.2552
      "29/12/2016" 3.2538
      "28/12/2016" 3.2778
      "27/12/2016" 3.2734
      "26/12/2016"   3.28
      "23/12/2016" 3.2703
      "22/12/2016" 3.2916
      "21/12/2016" 3.3309
      "20/12/2016" 3.3503
      "19/12/2016" 3.3695
      "16/12/2016" 3.3879
      "15/12/2016" 3.3651
      "14/12/2016" 3.3715
      "13/12/2016" 3.3344
      "12/12/2016" 3.3377
      "09/12/2016" 3.3802
      "08/12/2016" 3.3753
      "07/12/2016" 3.3925
      "06/12/2016"   3.41
      "05/12/2016"  3.423
      "02/12/2016" 3.4769
      "01/12/2016" 3.4645
      "30/11/2016" 3.3858
      "29/11/2016" 3.3928
      "28/11/2016" 3.3876
      "25/11/2016" 3.4141
      "24/11/2016" 3.3968
      "23/11/2016" 3.3903
      "22/11/2016" 3.3563
      "21/11/2016" 3.3516
      "18/11/2016" 3.3818
      "17/11/2016" 3.4211
      "16/11/2016" 3.4262
      "14/11/2016" 3.4344
      "11/11/2016" 3.4023
      "10/11/2016" 3.3932
      "09/11/2016" 3.2254
      "08/11/2016" 3.1686
      "07/11/2016" 3.2061
      "04/11/2016" 3.2362
      "03/11/2016"  3.242
      "01/11/2016" 3.2317
      "31/10/2016" 3.1936
      "28/10/2016" 3.2006
      "27/10/2016" 3.1665
      "26/10/2016" 3.1405
      "25/10/2016" 3.1127
      "24/10/2016" 3.1223
      "21/10/2016" 3.1563
      "20/10/2016"  3.142
      "19/10/2016"  3.169
      "18/10/2016" 3.1877
      "17/10/2016" 3.2046
      "14/10/2016" 3.2062
      "13/10/2016" 3.1787
      "11/10/2016" 3.1954
      "10/10/2016" 3.2065
      "07/10/2016" 3.2212
      "06/10/2016"  3.228
      "05/10/2016" 3.2213
      "04/10/2016"  3.258
      "03/10/2016" 3.2099
      "30/09/2016" 3.2624
      "29/09/2016" 3.2597
      "28/09/2016" 3.2167
      "27/09/2016" 3.2343
      "26/09/2016" 3.2424
      "23/09/2016"  3.244
      "22/09/2016" 3.2206
      "21/09/2016" 3.2069
      "20/09/2016" 3.2589
      "19/09/2016"  3.273
      "16/09/2016" 3.2629
      "15/09/2016" 3.3026
      "14/09/2016" 3.3448
      "13/09/2016"  3.314
      "12/09/2016" 3.2476
      "09/09/2016" 3.2741
      "08/09/2016" 3.2143
      "06/09/2016" 3.1964
      "05/09/2016" 3.2834
      "02/09/2016" 3.2569
      "01/09/2016" 3.2573
      "31/08/2016" 3.2267
      "30/08/2016" 3.2401
      "29/08/2016" 3.2307
      "26/08/2016" 3.2657
      "25/08/2016" 3.2345
      "24/08/2016" 3.2249
      "23/08/2016" 3.2351
      "22/08/2016" 3.2007
      "19/08/2016"  3.205
      "18/08/2016" 3.2392
      "17/08/2016" 3.2064
      "16/08/2016" 3.2022
      "15/08/2016" 3.1864
      "12/08/2016" 3.1922
      "11/08/2016" 3.1444
      "10/08/2016" 3.1274
      "09/08/2016" 3.1454
      "08/08/2016" 3.1728
      "05/08/2016" 3.1655
      "04/08/2016" 3.1934
      "03/08/2016" 3.2385
      "02/08/2016" 3.2591
      "01/08/2016" 3.2655
      "29/07/2016" 3.2489
      "28/07/2016" 3.2918
      "27/07/2016" 3.2619
      "26/07/2016" 3.2761
      "25/07/2016"  3.286
      "22/07/2016" 3.2565
      "21/07/2016" 3.2719
      "20/07/2016"   3.26
      "19/07/2016" 3.2498
      "18/07/2016" 3.2537
      "15/07/2016" 3.2802
      "14/07/2016" 3.2526
      "13/07/2016" 3.2643
      "12/07/2016" 3.2956
      "11/07/2016" 3.3094
      "08/07/2016"    3.3
      "07/07/2016" 3.3675
      "06/07/2016"   3.33
      "05/07/2016" 3.3033
      "04/07/2016" 3.2696
      "01/07/2016" 3.2364
      "30/06/2016"  3.213
      "29/06/2016" 3.2206
      "28/06/2016" 3.3032
      end
      
      gen ndate = daily(date, "DMY")
      format ndate %td
      Last edited by Nick Cox; 09 Mar 2019, 11:14.

      Comment


      • #4
        As said, I can't advise how to go further. But I glanced at the rest of the code you gave.

        You work in terms of observation numbers _n but your data are only for trading days.

        You should consider whether

        Code:
        sort ndate 
        gen ret = ln(px_last[_n+1] / px_last)
        gen evt_window= inrange(ndate - mdy(9, 20, 2017), -10, 10)
        gen est_window= inrange(ndate - mdy(9, 20, 2017), -2, 302)
        is closer to what you want (and avoids creating variables you don't need).

        Comment

        Working...
        X