Announcement

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

  • Eventstudy using either the estudy or eventstudy2 command

    Hi,

    I am currently trying to conduct an event study for my master thesis. However, I do have some trouble with the two commands listed in the title of this thread.

    estudy:
    For some reason I can't get the grouped CAAR to make sense. From the data shown in the table I would assume that the grouped CAAR would be -4.61% and not -4.35% as shown in the picture below. This is the issue with all the grouped CAARs. Does anyone know why this happens?
    Furthermore, does anyone know if it possible to get the t-scores in the output instead of the command only showing p-values?
    Click image for larger version

Name:	Skærmbillede 2022-07-21 083842.png
Views:	1
Size:	87.4 KB
ID:	1674371




    eventstudy2:
    With this command I simply can't tell if I am doing something wrong. I am using the following command. However, I don't know if the command means that I am using the market model. I assume it does but I am not sure. For input I use discrete returns as I understood from the help-file that the code converts the returns to ln by itself. The output from eventstudy2 differs substantially from the output from the estudy command. If comparing the outputs in the event window [0,5] the CAAR from the estudy command is -27.28% while it for the eventstudy2 command is -16.36%. This just doesn't make much sense. I have tried using the exact same estimation windows, exact same event windows and so on. Hopefully someone can tell me what I am doing wrong here - maybe I misunderstood something in the eventstudy2 code as it is quite complicated to say the least.
    eventstudy2 security_id date using price_file, ret(security_return) mod(MA) marketfile(market_file) mar(return_mkt) idmar(mkt_ref) car1LB(0) car1UB(5) car2LB(-5) car2UB(-5) car3LB(0) car3UB(10) car4LB(-10) car4UB(10) car5LB(0) car5UB(15) car6LB(-15) car6UB(15) car7LB(0) car7UB(0) replace

    I look forward to hearing from you guys. I appreciate your time

  • #2
    Read the FAQ please on how to ask questions. Using Statalist is just like making wild mushroom risotto. If I asked you to make my favorite version of risotto, you'd likely need to know what the SPECIFIC ingredients are and the steps you do to make said dish. So far you've given improperly formatted code and no dataset to work work- you're asking us for help to make a dish, and you've not given the recipe (the code) or ingredients (the data).

    Precisely, you must give your dataset using dataex and your code that you've tried (formatted accordingly). No dataset, no code=no real assistance.

    I would assume that the grouped CAAR would be -4.61% and not -4.35% as shown in the picture below.
    why?


    You need to read the help files and articles describing these commands. They likely have different assumptions and do certain things under the hood which would explain these differences

    Comment


    • #3
      Hello Christian,

      Saw you responding on my post, I'm having the same problem. I recalculated the AR and CARs, these seem to be correct. However, I think there is something wrong in the average calculation.
      For the T-scores, you can add the command: "outputfile(filename)" in the estudy line. In the Excel output there is a tab with all T-scores

      Edit: MA is is market adjusted model, FM with one market index is the MM I guess.
      Last edited by Max Kerk; 21 Jul 2022, 06:03.

      Comment


      • #4
        This is my eventdate file - all events have the same date as I am examining the impact of WHO's announcement that COVID-19 officially became a pandemic. In this file I have the eventdate and a security ID:
        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input float(date sec_id)
        21986  1
        21986  2
        21986  3
        21986  4
        21986  5
        21986  6
        21986  7
        21986  8
        21986  9
        21986 10
        21986 11
        21986 12
        21986 13
        21986 14
        21986 15
        21986 16
        21986 17
        21986 18
        21986 19
        21986 20
        21986 21
        21986 22
        21986 23
        21986 24
        21986 25
        21986 26
        21986 27
        21986 28
        21986 29
        21986 30
        21986 31
        21986 32
        21986 33
        21986 34
        21986 35
        21986 36
        21986 37
        21986 38
        21986 39
        21986 40
        21986 41
        21986 42
        21986 43
        21986 44
        21986 45
        end
        format %d date

        Secondly I have my market-file - This file contains dates, price, return, log return and market reference:
        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input float date double return_mkt byte mkt_ref double price float log_mkt
        21686                     . 1 2116.505             .
        21689   -.00560405007311598 1 2104.644   -.005619812
        21690    .00618489397731886 1 2117.661    .006165846
        21691   -.00277523172972442 1 2111.784    -.00277909
        21692    -.0115196440545057 1 2087.457    -.01158651
        21693    .00362546390177149 1 2095.025   .0036189076
        21696   .000670159067314231 1 2096.429   .0006699346
        21697   -.00565580804310567 1 2084.572   -.005671863
        21698   -.00948492064558093 1   2064.8   -.009530189
        21699   .000814606741572931 1 2066.482   .0008142751
        21700   -.00979248790940346 1 2046.246    -.00984075
        21703  -.000577643157274353 1 2045.064 -.00057781005
        21704     .0159388654829383 1  2077.66    .015813176
        21705    .00874637813694253 1 2095.832     .00870835
        21706    .00398409796205035 1 2104.182   .0039761825
        21707     .0107880401980438 1 2126.882    .010730265
        21710     .0040547618532668 1 2135.506   .0040465635
        21711    .00198407309555678 1 2139.743   .0019821075
        21712    -.0024881492777404 1 2134.419    -.00249125
        21713     .0011914249264086 1 2136.962   .0011907157
        21714   -.00281240377695053 1 2130.952   -.002816366
        21717 -.0000417653705951127 1 2130.863 -.00004176624
        21718    .00940886392039281 1 2150.912    .009364876
        21719    .00496673039157343 1 2161.595    .004954437
        21720     .0100675658483667 1 2183.357    .010017226
        21721   -.00238165357291539 1 2178.157   -.002384494
        21724             4.130e+10 1 2178.166  4.131925e-06
        21725   -.00662805314195537 1 2163.729   -.006650116
        21726   -.00245825609399327 1  2158.41  -.0024612825
        21727    .00373978993796365 1 2166.482    .003732814
        21728    .00547662062274242 1 2178.347    .005461678
        21731    .00637685364177499 1 2192.238    .006356608
        21732    .00287788096000534 1 2198.547    .002873748
        21733    .00673126387564149 1 2213.346     .00670871
        21734   .000823188060068384 1 2215.168   .0008228495
        21735   -.00433375707846985 1 2205.568   -.004343175
        21738   -.00496561429980859 1 2194.616   -.004977984
        21739  -.000442446423428975 1 2193.645  -.0004425443
        21740    .00341577602574707 1 2201.138   .0034099554
        21741    .00191173838260031 1 2205.346   .0019099134
        21742    .00330968473881195 1 2212.645     .00330422
        21745   .000766051490410872 1  2214.34   .0007657582
        21746   -.00282341465176981 1 2208.088   -.002827408
        21747   -.00459764284756769 1 2197.936  -.0046082446
        21748   .000210652175495437 1 2198.399     .00021063
        21749   -.00172261723190368 1 2194.612  -.0017241027
        21752    .00139432391693837 1 2197.672   .0013933528
        21753    .00542164617831959 1 2209.587    .005407002
        21754    .00369480812477636 1 2217.751    .003687999
        21755   -.00488287458781449 1 2206.922   -.004894835
        21756    .00398111034282139 1 2215.708   .0039732065
        21759   -.00144603891848573 1 2212.504  -.0014470854
        21760   -.00411389086754187 1 2203.402   -.004122376
        21761   -.00718797568487284 1 2187.564   -.007213934
        21762   -.00657672186962288 1 2173.177   -.006598444
        21763    -.0106682520567815 1 2149.993   -.010725566
        21766    -.0244996146499082 1 2097.319   -.024804724
        21767    .00566532797347474 1 2109.201     .00564934
        21768    .00230039716461345 1 2114.053   .0022977553
        21769     .0155407645882105 1 2146.907    .015421243
        21770   -.00538635348433831 1 2135.343   -.005400912
        21773   -.00828719320502604 1 2117.647   -.008321723
        21774    .00797583355488421 1 2134.537    .007944195
        21775    -.0226166142821604 1 2086.261    -.02287629
        21776   -.00164073430889029 1 2082.838  -.0016420818
        21777     .0123216495954077 1 2108.502    .012246356
        21780     .0110542935221309 1  2131.81    .010993642
        21781   -.00573972352132689 1 2119.574   -.005756259
        21782    .00752556881713024 1 2135.525    .007497393
        21783   -.00180189883049833 1 2131.677  -.0018035242
        21784    -.0173778672847717 1 2094.633   -.017530635
        21787    .00505291380399349 1 2105.217     .00504019
        21788  -.000176703874232584 1 2104.845  -.0001767195
        21789    .00335986735365317 1 2111.917   .0033542356
        21790     .0100193331461418 1 2133.077    .009969472
        21791    .00255218166057763 1 2138.521   .0025489305
        21794  -.000906701407187634 1 2136.582  -.0009071127
        21795   -.00451983588741256 1 2126.925   -.004530081
        21796     .0107535526640572 1 2149.797    .010696145
        21797     .0113820049055795 1 2174.266    .011317717
        21798    .00212991418713251 1 2178.897    .002127649
        21801  -.000225802321082518 1 2178.405 -.00022582783
        21802   .000468232491203418 1 2179.425   .0004681229
        21803    .00688209045963949 1 2194.424    .006858517
        21804    .00336762631105013 1 2201.814   .0033619686
        21805     .0018144130248969 1 2205.809    .001812769
        21808   -.00450129634977466 1  2195.88   -.004511458
        21809    .00268092974115148 1 2201.767   .0026773424
        21810  -.000337002053350665 1 2201.025 -.00033705885
        21811    .00165740961597423 1 2204.673   .0016560376
        21812   -.00323267895057451 1 2197.546  -.0032379155
        21815   -.00173193189130059 1  2193.74  -.0017334335
        21816   -.00531877068385482 1 2182.072   -.005332966
        21817    .00114111725002648 1 2184.562   .0011404667
        21818  -.000506279977404975 1 2183.456 -.00050640816
        21819   -.00362452918675724 1 2175.542   -.003631114
        21822    .00205741833529305 1 2180.018   .0020553048
        21823   -.00988340463243873 1 2158.472    -.00993257
        21824    -.0171426824160797 1  2121.47   -.017291319
        21825    .00466044770842867 1 2131.357   .0046496214
        end
        format %d date

        Lastly I have my return-file - In this file I have the date, return of x security, security id, market reference, price and log returns.
        Code:
        21686        0 1 1 7.12         0
        21689 -.002809 1 1  7.1 -.0028129
        21690  .022535 1 1 7.26  .0222851
        21691 -.002755 1 1 7.24 -.0027587
        21692 -.009669 1 1 7.17 -.0097155
        21693  .009763 1 1 7.24  .0097155
        21696  .041436 1 1 7.54   .040601
        21697  .022546 1 1 7.71   .022296
        21698        0 1 1 7.71         0
        21699   .01297 1 1 7.81  .0128868
        21700        0 1 1 7.81         0
        21703 -.053777 1 1 7.39 -.0552772
        21704 -.005413 1 1 7.35 -.0054274
        21705 -.008163 1 1 7.29 -.0081968
        21706        0 1 1 7.29         0
        21707  .006859 1 1 7.34  .0068353
        21710  .020436 1 1 7.49  .0202299
        21711 -.008011 1 1 7.43 -.0080429
        21712 -.008075 1 1 7.37 -.0081081
        21713  .005427 1 1 7.41  .0054127
        21714   .00135 1 1 7.42  .0013486
        21717        0 1 1 7.42         0
        21718 -.010782 1 1 7.34 -.0108402
        21719  .001362 1 1 7.35  .0013614
        21720  .004082 1 1 7.38  .0040734
        21721  .017615 1 1 7.51  .0174618
        21724 -.014647 1 1  7.4 -.0147555
        21725 -.006757 1 1 7.35 -.0067797
        21726   .02449 1 1 7.53  .0241948
        21727 -.017264 1 1  7.4 -.0174151
        21728        0 1 1  7.4         0
        21731  .001351 1 1 7.41  .0013504
        21732        0 1 1 7.41         0
        21733  .021592 1 1 7.57  .0213627
        21734  .002642 1 1 7.59  .0026385
        21735  .002635 1 1 7.61  .0026316
        21738 -.013141 1 1 7.51 -.0132277
        21739 -.021305 1 1 7.35 -.0215352
        21740  .004082 1 1 7.38  .0040734
        21741   .01355 1 1 7.48  .0134591
        21742  .001337 1 1 7.49   .001336
        21745 -.012016 1 1  7.4 -.0120888
        21746  .001351 1 1 7.41  .0013504
        21747        0 1 1 7.41         0
        21748        0 1 1 7.41         0
        21749 -.006748 1 1 7.36 -.0067705
        21752 -.001359 1 1 7.35 -.0013597
        21753  .020408 1 1  7.5  .0202027
        21754  .001333 1 1 7.51  .0013325
        21755 -.002663 1 1 7.49 -.0026667
        21756 -.010681 1 1 7.41 -.0107383
        21759        0 1 1 7.41         0
        21760 -.005398 1 1 7.37 -.0054127
        21761  .005427 1 1 7.41  .0054127
        21762  .002699 1 1 7.43  .0026954
        21763 -.001346 1 1 7.42 -.0013468
        21766 -.013477 1 1 7.32 -.0135687
        21767  .006831 1 1 7.37  .0068073
        21768 -.006784 1 1 7.32 -.0068073
        21769        0 1 1 7.32         0
        21770 -.005464 1 1 7.28 -.0054795
        21773        0 1 1 7.28         0
        21774 -.034341 1 1 7.03 -.0349442
        21775 -.029872 1 1 6.82 -.0303272
        21776        0 1 1 6.82         0
        21777  .024927 1 1 6.99   .024621
        21780  .052933 1 1 7.36  .0515794
        21781 -.001359 1 1 7.35 -.0013597
        21782 -.010884 1 1 7.27  -.010944
        21783  .019257 1 1 7.41  .0190741
        21784 -.020243 1 1 7.26 -.0204506
        21787 -.012397 1 1 7.17 -.0124742
        21788  .012552 1 1 7.26  .0124742
        21789 -.016529 1 1 7.14 -.0166671
        21790 -.004202 1 1 7.11 -.0042105
        21791  .001406 1 1 7.12  .0014054
        21794 -.005618 1 1 7.08 -.0056338
        21795 -.016949 1 1 6.96 -.0170944
        21796  .027299 1 1 7.15  .0269329
        21797  .002797 1 1 7.17  .0027933
        21798 -.006974 1 1 7.12  -.006998
        21801 -.011236 1 1 7.04 -.0112995
        21802        0 1 1 7.04         0
        21803  .024148 1 1 7.21  .0238608
        21804   -.0319 1 1 6.98   -.03242
        21805  .034384 1 1 7.22   .033806
        21808   .00277 1 1 7.24  .0027663
        21809 -.015193 1 1 7.13 -.0153099
        21810  .033661 1 1 7.37  .0331064
        21811  .001357 1 1 7.38   .001356
        21812   .00813 1 1 7.44  .0080972
        21815        0 1 1 7.44         0
        21816 -.024194 1 1 7.26  -.024491
        21817  .001377 1 1 7.27  .0013764
        21818  .004127 1 1  7.3  .0041181
        21819   .00411 1 1 7.33  .0041011
        21822  .002729 1 1 7.35  .0027248
        21823  .010884 1 1 7.43  .0108255
        21824  -.02288 1 1 7.26  -.023146
        21825  .001377 1 1 7.27  .0013764
        end
        format %d date
        Finally the code I am using:
        eventstudy2 sec_id date using price_file, ret(sec_ret) mod(FM) marketfile(market_file) mar(return_mkt) idmar(mkt_ref) car1LB(0) car1UB(5) car2LB(-5) car2UB(-5) car3LB(0) car3UB(10) car4LB(-10) car4UB(10) car5LB(0) car5UB(15) car6LB(-15) car6UB(15) car7LB(0) car7UB(0) replace

        Comment


        • #5
          Originally posted by Max Kerk View Post
          Hello Christian,

          Saw you responding on my post, I'm having the same problem. I recalculated the AR and CARs, these seem to be correct. However, I think there is something wrong in the average calculation.
          For the T-scores, you can add the command: "outputfile(filename)" in the estudy line. In the Excel output there is a tab with all T-scores

          Edit: MA is is market adjusted model, FM with one market index is the MM I guess.
          Max is correct; FM with one factor is the MM. MA is the market adjusted model. See helpfile.

          Comment


          • #6
            Dear Christian,

            Jared is correct; there are things going on "under the hood", in particular the Maynes & Rumsey algorithm to handle missing returns and defining appropirate datelines, see helpfile of eventstudy2.

            For a comparison of commands, please see my 2021 Stata Journal article.

            There is also another post on Statalist where I reply to a gentleman with the name "Glen". There, I write about why it is not easy to replicate and reconcile eventstudy2's results with one own*s Excel-based calculations.

            Best
            Thomas

            Comment


            • #7
              Hi there,

              I am currently attempting an event study using the eventstudy2 command. I have actually done the event study manually but want to use this command as it automatically completes the robustness tests. I was following a guide here https://thedatahall.com/event-study-...mand-in-stata/, however whenever I attempt the command, I receive this error when state is ''preparing security_return'': ''variables date __000005 do not uniquely identify observations in the using data r(459)''.

              I have spent countless hours trying to figure out why this is, my data and formatting appear to be the exact same as the website and tutorial video.

              Any help or advice on this matter would be greatly appreciated!
              Thanks, Adam

              Comment


              • #8
                Dear Sir,

                Thank you for using eventstudy2.

                1) Please use the sample files that come with the installation (findit eventstudy2) and make the command run on them; this is not related to your problem but ensures that there are no other issues.
                2) It seems that there are duplicates in your files where there should be not be any. Use the command "isid [your firm id] [your date variable]" on all your files, and see that you do not get any error there.

                Best
                Thomas Kaspereit

                Comment


                • #9
                  Hi Thomas

                  Thanks a lot for getting back to me.
                  I ran the sample files for the command and there was no issues. When I ran the isid command for my variables it gave me '' firm_id does not uniquely identify observations in the using data r(459)'', when I ran a duplicates report I got

                  Duplicates in terms of returndate

                  --------------------------------------
                  Copies | Observations Surplus
                  ----------+---------------------------
                  1 | 1 0
                  62 | 62 61
                  64 | 38784 38178
                  127 | 127 126
                  --------------------------------------

                  As far as I can see, the duplicates in the stock return are coming from the return happening to be the same on different days, as I have rounded them to two decimal places. is there a way to mitigate that?

                  Thanks, Adam

                  Comment


                  • #10
                    Dear Sir,

                    Same returns values are not the problem, but same firmid-date-combinations are the problem. Or same marketid-date combinations in the market return file.

                    Best
                    Thomas

                    Comment


                    • #11
                      Hi Thomas,

                      Thanks for the help, I eventually sorted the problem. However if it's not too much trouble I have another question. When I run it successfully, Stata runs an infinite loop of events despite me having only 3 in my event data file. Would you have any idea why this could be happening?

                      Comment

                      Working...
                      X