Announcement

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

  • Create a control group matching categorical and continuous variables

    Dear all,

    I am analyzing whether a CEO turnover (c. 600 events) has a long-term impact on operating performance (OROA). The performance measure needs to be control-group adjusted according to Barber & Lyon's (1995) method on performance matching, replicating a study by Huson et al (2004):
    "The Barber and Lyon matching method is performed as follows. Each sample firm is matched to comparison firms with the same two-digit Compustat SIC code whose performance measures over the year before the turnover are within 10% of the sample firm’s performance. If there are no such firms, we match performance within the 10% filter using all firms with the same one-digit SIC code. For firms without matches after this procedure, we use all firms with performance within the filter bounds regardless of SIC code. Each sample firm’s performance is adjusted by subtracting the median performance of its control group. Changes over time in adjusted performance are then calculated. This procedure is intended to isolate the component of performance change due to management turnover from that attributable to mean reversion of industry and firm-specific factors."
    I have started working with the following code (provided in another post by Clyde Schechter):

    Code:
    //    CREATE A FILE OF JUST CONTROLS
    //    AND RENAME THE VARIABLES
    preserve
    keep if Turnover == 0
    ds digitSNICode, not
    rename (`r(varlist)') =_ctrl
    tempfile controls
    save `controls'
    
    //    BRING BACK THE DATA & KEEP ONLY CASES
    restore
    keep if Turnover == 1
    
    //    UNIQUELY IDENTIFY EACH OBSERVATION
    gen long obs_no = _n
        
    //    MATCH EXACTLY ON industry
    joinby digitSNICode using `controls'
    drop if missing(CompanyID_ctrl)    // NO MATCHES AVAILABLE
    
    //    RETAIN THE BEST MATCH ON Oroa
    gen delta = abs(ROABencht1-ROABencht1_ctrl)
    set seed 1234 // OR YOUR FAVORITE SEED NUMBER
    gen double shuffle1 = runiform()
    gen double shuffle2 = runiform()
    by obs_no (delta shuffle1 shuffle2), sort: keep if _n == 1
    
    //    DO MATCHED-PAIRS CONTRAST OF ΔOROA
    ttest ΔOROAt1 = ΔOROAt1_ctrl
    ttest ΔOROAt2 = ΔOROAt2_ctrl
    ttest ΔOROAt3 = ΔOROAt3_ctrl
    ttest ΔOROAt4 = ΔOROAt4_ctrl
    ttest ΔOROAt5 = ΔOROAt5_ctrl
    signrank ΔOROAt1 = ΔOROAt1_ctrl
    Example of data:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long CompanyID int DataYearFiscal byte digitSNICode double OROA byte(Turnover Forcedvoluntary Externalinternal) double(OROABencht1 ΔOROAt1 ΔOROAt2 ΔOROAt3 ΔOROAt4 ΔOROAt5) long obs_no
     4439 2003 36 -.04915325039492575 1 1 1 -.07741066001215728      .22272353698888614    .24526468099117826    .2070861361194029     .1842730402112826   .16822035497415502  1
     4439 2010 36  .08991175238780026 1 0 0  .08267176320689994     .005212132256435936  -.019725221574862728 .0028022073235805106 -.0035566400596804965   .01218513049042734  2
     4439 2017 36 -.04200150345689208 1 1 0  .05170152234995411                       .                     .                    .                     .                    .  3
    11217 2011 37  .08588490190467506 1 0 0  .05487186432516215    -.002163254978648124  -.028028425956137932  -.02155970090503217 -.0025182226052173073                    .  4
    11217 2015 37  .05235364171994484 1 1 1  .03331216342012998      .02344087334172642    .03810638083480089                    .                     .                    .  5
    11749 2003 35  .08413924018161763 1 0 0  .09756216837420838     .027389656764810505    .05585132489637447   .05579974889759513    .05984083348573367   .06479133144232914  6
    11749 2015 35  .08504513774054068 1 1 0  .10549224549590794     -.01435056012096908 -.0055005880656577855                    .                     .                    .  7
    12368 2002 24  .08318350376446791 1 0 0  .11296369024242207     -.04306698316209534   -.06389330759031134  -.05434671259222728   -.05386740271099181  -.04718012827033796  8
    12368 2007 24  .06578356197208411 1 1 0 .059096287531430265  -.00029587388096490724  .0013750022879044435  .004276616331534248 -.0055565821222064715  .001959509424053027  9
    12368 2015 24  .07974227070623513 1 1 0  .07816717273954116     .008121646728602591                     .                    .                     .                    . 10
    14620 2002 36  .08546592268679788 1 0 0  .07212821775939694      .01314055916512076   .013658768790948392  .018273746688369036   -.01848108483466524 -.002028746154982039 11
    14620 2011 36 .041675167639177925 1 0 0   .0894547155276769     -.02238569583768947  -.037939325255589504  -.02790289384112015  -.033005737841186385 -.017465641478006957 12
    14620 2016 36  .07198907404966995 1 0 0  .05644897768649052      .02599907002574505                     .                    .                     .                    . 13
    15654 2001 60 .034678194703205656 1 0 0  .05284249332736598     -.02910856264413426  -.031498695920840494 -.028081573849146228  -.026712287040164977 -.032482318648909846 14
    15654 2006 60 .020360174678456133 1 0 0 .026130206287201002     .009818236401323295    .01661679244678696 -.006198615169238298  -.008783657343166988 -.000829885418673515 15
    15654 2015 60  .01271143716920228 1 0 0 .017220618795199306   -.0040012524889815135                     .                    .                     .                    . 16
    15654 2016 60 .013219366306217792 1 1 0  .01271143716920228 -.000015344186305469784                     .                    .                     .                    . 17
    15671 2005 60 .016680512631667588 1 0 0 .016528150458850407      .00232949012412988   .028479166900531448  .022758048251130814  .0030165824485197217  .001859122543328321 18
    15671 2017 60  .01518404240786432 1 0 0 .015047092025365751                       .                     .                    .                     .                    . 19
    15699 2005 67    .526054101666628 1 0 0  .12466413971787736        .060169078650274    -.1203588451450908   -.3256334960945835    .10925619243292707   .06134370876412283 20
    end
    ----------

    The problems I currently have are the following:
    1. The matching needs to take into account that I don't have an equal number of observations in ΔOROAt. I.e., currently an observation with the entire 5-year window (ΔOROAt1 ΔOROAt2 ΔOROAt3 ΔOROAt4 ΔOROAt5) can be matched to an observation containing only e.g. ΔOROAt1. How can I adjust for that in the code? Ideally, that would be the first criteria in the matching procedure.
    2. I'm not really sure how the "retain the best match" procedure actually works right now. Can that be adjusted to strictly follow the "within 10%"-rule?
    3. How can I make sure this is followed: "For firms without matches after this procedure, we use all firms with performance within the filter bounds regardless of SIC code."?

    Many thanks,
    Carl-Johan

  • #2
    In order to work this out, you need to show a data example that contains both case and control observations: your example has Turnover == 1 in every observation.

    Next, your code doesn't look to me like it is all that closely related to the description of the method in the material you quoted. I see there that the most critical aspect of the matching is "...performance measures over the year before the turnover are within 10% of the sample firm’s performance. [emphasis added]" Your code doesn't deal with this at all, nor, as far as I can see, could it possibly as your data, or at least your example, has no apparent information about which year the turnover in a firm took place.

    Finally I am confused by all those ΔOROAt* variables: your code devotes a lot of attention to them, but I don't know what they are supposed to mean, and they don't appear to have anything to do with the matching itself.

    Comment


    • #3
      Clyde, thanks for the reply.

      Here is a dataex including controls.

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input long CompanyID int DataYearFiscal byte digitSNICode double OROA byte(Turnover Forcedvoluntary Externalinternal) double(OROABencht1 ΔOROAt1 ΔOROAt2 ΔOROAt3 ΔOROAt4 ΔOROAt5)
       4439 1997 36                    . 0 . .                    .                      .                     .                    .                     .                     .
       4439 1998 36   .12971378187737384 0 . .                    .                      .                     .                    .                     .                     .
       4439 1999 36   .10354958914580546 0 . .   .12971378187737384    -.10201277313228432   -.25954671171749466   -.2071244418895311   -.17886703227229958                     .
       4439 2000 36  .027701008745089524 0 . .   .10354958914580546    -.23338251898592627   -.18096024915796274  -.15270283954073122                     .                     .
       4439 2001 36  -.12983292984012082 0 . .  .027701008745089524    -.10511166875724681   -.07685425914001527                    .                     .                     .
       4439 2002 36  -.07741066001215728 0 . .  -.12983292984012082     .08067967944519508                     .                    .                     .                     .
       4439 2003 36  -.04915325039492575 1 1 1  -.07741066001215728     .22272353698888614    .24526468099117826    .2070861361194029     .1842730402112826    .16822035497415502
       4439 2004 36   .14531287697672887 0 . .  -.04915325039492575      .2170072713739467    .17882872650217138   .15601563059405107     .1399629453569235     .1318250136018257
       4439 2005 36   .16785402097902097 0 . .   .14531287697672887    -.01563740086948323   -.03845049677760354  -.05450318201473113   -.06264111376982893   -.05540112458892861
       4439 2006 36   .12967547610724564 0 . .   .16785402097902097   -.060991640779895634   -.07704432601702323  -.08518225777212103    -.0779422685912207                     .
       4439 2007 36   .10686238019912533 0 . .   .12967547610724564     -.0388657811452479  -.047003712900345704  -.03976372371944538                     .                     .
       4439 2008 36   .09080969496199774 0 . .   .10686238019912533   -.024190616992225397  -.016950627811325072                    .                     .                     .
       4439 2009 36   .08267176320689994 0 . .   .09080969496199774    -.00089794257419748                     .                    .                     .                     .
       4439 2010 36   .08991175238780026 1 0 0   .08267176320689994    .005212132256435936  -.019725221574862728 .0028022073235805106 -.0035566400596804965    .01218513049042734
       4439 2011 36   .08788389546333587 0 . .   .08991175238780026   -.026965210755763053  -.004437781857319814 -.010796629240580821   .004945141309527015  -.038210230037846155
       4439 2012 36   .06294654163203721 0 . .   .08788389546333587  -.0024099249328554256  -.008768772316116433  .006972998233991404  -.036182373113381766   -.12988539892022796
       4439 2013 36   .08547397053048045 0 . .   .06294654163203721     .01616858151518223    .03191035206529007 -.011245019282083102    -.1049480450889293                     .
       4439 2014 36   .07911512314721944 0 . .   .08547397053048045     .00938292316684683   -.03377244818052634  -.12747547398737252                     .                     .
       4439 2015 36   .09485689369732728 0 . .   .07911512314721944   -.027413600797265333   -.12111662660411152                    .                     .                     .
       4439 2016 36   .05170152234995411 0 . .   .09485689369732728    -.13685839715421935                     .                    .                     .                     .
       4439 2017 36  -.04200150345689208 1 1 0   .05170152234995411                      .                     .                    .                     .                     .
      11217 1997 37                    . 0 . .                    .                      .                     .                    .                     .                     .
      11217 1998 37  .040901436051318164 0 . .                    .                      .                     .                    .                     .                     .
      11217 1999 37  .032060501110426264 0 . .  .040901436051318164   -.009441198438083803  -.044518000514338046  -.03191034665781428  -.014892122526642342    .01927966508510444
      11217 2000 37   .03146023761323436 0 . .  .032060501110426264   -.035677065573446146   -.02306941171692238 -.006051187585750441    .02812060002599634    .04938555444911721
      11217 2001 37 -.003616564463019881 0 . .   .03146023761323436   -.022469148219730478  -.005450924088558538  .028720863523188242    .04998581794630911   .055595200191809684
      11217 2002 37  .008991089393503881 0 . . -.003616564463019881    .029625877987695705    .06379766559944249   .08506262002256335    .09067200226806392    .08616598847831239
      11217 2003 37  .026009313524675823 0 . .  .008991089393503881     .05119001174291872     .0724549661660396   .07806434841154017    .07355833462178864   .041763309061945725
      11217 2004 37    .0601811011364226 0 . .  .026009313524675823     .05543674203486765    .06104612428036822   .05654011049061669   .024745084930773785   -.06923750542680757
      11217 2005 37   .08144605555954347 0 . .    .0601811011364226     .02687433666862144    .02236832287886991 -.009426702680972995   -.10340929303855434 -.0053092368112604565
      11217 2006 37   .08705543780504404 0 . .   .08144605555954347    .001103368455749043  -.030691657104093863  -.12467424746167521  -.026574191234381324   .004438846345131586
      11217 2007 37   .08254942401529251 0 . .   .08705543780504404    -.03630103934959444   -.13028362970717577   -.0321835734798819  -.001170535900368988                     .
      11217 2008 37   .05075439845544961 0 . .   .08254942401529251    -.12577761591742426  -.027677559690130367  .003335477889382543                     .                     .
      11217 2009 37 -.043228191902131737 0 . .   .05075439845544961    .004117465869712539    .03513050344922545                    .                     .                     .
      11217 2010 37   .05487186432516215 0 . . -.043228191902131737      .1291130938068068                     .                    .                     .                     .
      11217 2011 37   .08588490190467506 1 0 0   .05487186432516215   -.002163254978648124  -.028028425956137932  -.02155970090503217 -.0025182226052173073                     .
      11217 2012 37   .05270860934651402 0 . .   .08588490190467506   -.059041463535650845   -.05257273848454508  -.03353126018473022                     .                     .
      11217 2013 37  .026843438369024215 0 . .   .05270860934651402   -.019396445926384044 -.0003549676265691831                    .                     .                     .
      11217 2014 37   .03331216342012998 0 . .  .026843438369024215    .025510203350920625                     .                    .                     .                     .
      11217 2015 37   .05235364171994484 1 1 1   .03331216342012998     .02344087334172642    .03810638083480089                    .                     .                     .
      11217 2016 37    .0567530367618564 0 . .   .05235364171994484     .01906490253498603                     .                    .                     .                     .
      11217 2017 37   .07141854425493087 0 . .    .0567530367618564                      .                     .                    .                     .                     .
      11749 1997 35                    . 0 . .                    .                      .                     .                    .                     .                     .
      11749 1998 35 -.023100936524453695 0 . .                    .                      .                     .                    .                     .                     .
      11749 1999 35   .06459054209919261 0 . . -.023100936524453695     .12860591886371223    .11888556655565906   .12066310489866207    .10724017670607132                     .
      11749 2000 35   .10550498233925854 0 . .   .06459054209919261    .031194087932012754   .032971626275015764  .019548698082425015                     .                     .
      11749 2001 35   .09578463003120537 0 . .   .10550498233925854   -.007942813965050158  -.021365742157640907                    .                     .                     .
      11749 2002 35   .09756216837420838 0 . .   .09578463003120537    -.01164538984958774                     .                    .                     .                     .
      11749 2003 35   .08413924018161763 1 0 0   .09756216837420838    .027389656764810505    .05585132489637447   .05579974889759513    .05984083348573367    .06479133144232914
      11749 2004 35   .12495182513901888 0 . .   .08413924018161763     .06927425308896522    .06922267709018588   .07326376167832442    .07821425963491989  -.028774196916572584
      11749 2005 35   .15341349327058285 0 . .   .12495182513901888     .02841009213278463    .03245117672092317  .037401674677518634   -.06958678187397384    .04274395061321086
      11749 2006 35    .1533619172718035 0 . .   .15341349327058285    .003989508589359203    .00894000654595467   -.0980484500055378   .014282282481646896   .017870730979743094
      11749 2007 35   .15740300185994205 0 . .    .1533619172718035    .008991582544734006   -.09799687400675847  .014333858480426231    .01792230697852243   -.03211355940472364
      11749 2008 35   .16235349981653752 0 . .   .15740300185994205      -.102037958594897   .010292773892287693   .01388122239038389   -.03615464399286218  -.051571575028465835
      11749 2009 35  .055365043265045044 0 . .   .16235349981653752    .005342275935692226   .008930724433788423  -.04110514194945765    -.0565220729850613   -.05686125432062958
      11749 2010 35   .16769577575222974 0 . .  .055365043265045044      .1159191809852809    .06588331460203482   .05046638356643117   .050127202230862894   .029680094475495633
      11749 2011 35   .17128422425032594 0 . .   .16769577575222974   -.046447417885149875   -.06186434892075353 -.062203530256321804   -.08265063801168906                     .
      11749 2012 35   .12124835786707987 0 . .   .17128422425032594    -.06545279741884973     -.065791978754418  -.08623908650978526                     .                     .
      11749 2013 35   .10583142683147621 0 . .   .12124835786707987    -.01575611237117193   -.03620322012653919                    .                     .                     .
      11749 2014 35   .10549224549590794 0 . .   .10583142683147621   -.020786289090935536                     .                    .                     .                     .
      11749 2015 35   .08504513774054068 1 1 0   .10549224549590794    -.01435056012096908 -.0055005880656577855                    .                     .                     .
      11749 2016 35   .09114168537493886 0 . .   .08504513774054068    .014946519689709475                     .                    .                     .                     .
      11749 2017 35   .09999165743025015 0 . .   .09114168537493886                      .                     .                    .                     .                     .
      12368 1997 24                    . 0 . .                    .                      .                     .                    .                     .                     .
      12368 1998 24   .08920161233293261 0 . .                    .                      .                     .                    .                     .                     .
      12368 1999 24   .08363849795210085 0 . .   .08920161233293261     .03441657247238107   .023762077909489462   -.0060181085684647                     .                     .
      12368 2000 24   .12361818480531368 0 . .   .08363849795210085    .029325192290321225 -.0004549941876329372                    .                     .                     .
      12368 2001 24   .11296369024242207 0 . .   .12361818480531368    -.04043468104084577                     .                    .                     .                     .
      12368 2002 24   .08318350376446791 1 0 0   .11296369024242207    -.04306698316209534   -.06389330759031134  -.05434671259222728   -.05386740271099181   -.04718012827033796
      12368 2003 24   .06989670708032673 0 . .   .08318350376446791   -.034113121112357175  -.024566526114273117 -.024087216233037646    -.0173999417923838                     .
      12368 2004 24  .049070382652110736 0 . .   .06989670708032673    -.01127972943013194  -.010800419548896469 -.004113145108242622                     .                     .
      12368 2005 24  .058616977650194795 0 . .  .049070382652110736    .010025904879319529   .016713179319973376                    .                     .                     .
      12368 2006 24  .059096287531430265 0 . .  .058616977650194795    .007166584321889317                     .                    .                     .                     .
      12368 2007 24   .06578356197208411 1 1 0  .059096287531430265 -.00029587388096490724  .0013750022879044435  .004276616331534248 -.0055565821222064715   .001959509424053027
      12368 2008 24   .05880041365046536 0 . .   .06578356197208411   -.005312272152749403 -.0024106581091195983 -.012243856562860318   -.00472776501660082   .008176188961155961
      12368 2009 24   .06047128981933471 0 . .   .05880041365046536    .004572490212499156  -.005260708241241564  .002255383305017934   .015159337282774715     .0193667590890758
      12368 2010 24   .06337290386296451 0 . .   .06047128981933471   -.006931584410110915  .0005845071361485835  .013488461113905365    .01769588292020645    .01927098088690042
      12368 2011 24  .053539705409223794 0 . .   .06337290386296451  -.0023171069074812214    .01058684707027556  .014794268876576644   .016369366843270616                     .
      12368 2012 24   .06105579695548329 0 . .  .053539705409223794     .02042004552401628   .024627467330317364  .026202565297011336                     .                     .
      12368 2013 24   .07395975093324007 0 . .   .06105579695548329    .017111375784057865   .018686473750751838                    .                     .                     .
      12368 2014 24   .07816717273954116 0 . .   .07395975093324007    .005782519772995057                     .                    .                     .                     .
      12368 2015 24   .07974227070623513 1 1 0   .07816717273954116    .008121646728602591                     .                    .                     .                     .
      12368 2016 24   .08628881946814375 0 . .   .07974227070623513                      .                     .                    .                     .                     .
      14620 1997 36                    . 0 . .                    .                      .                     .                    .                     .                     .
      14620 1998 36   .08824711200401808 0 . .                    .                      .                     .                    .                     .                     .
      14620 1999 36   .08649401481588205 0 . .   .08824711200401808    .007522326044093239  -.016118894244621138 -.002781189317220198                     .                     .
      14620 2000 36   .09576943804811132 0 . .   .08649401481588205   -.014365797056485108 -.0010280921290841682                    .                     .                     .
      14620 2001 36   .07212821775939694 0 . .   .09576943804811132   -.010303515361313437                     .                    .                     .                     .
      14620 2002 36   .08546592268679788 1 0 0   .07212821775939694     .01314055916512076   .013658768790948392  .018273746688369036   -.01848108483466524  -.002028746154982039
      14620 2003 36    .0852687769245177 0 . .   .08546592268679788   .0003210638635474522   .004936041760968096  -.03181878976206618  -.015366451082382979   -.06473630051064148
      14620 2004 36   .08578698655034533 0 . .    .0852687769245177    .005133187523248275     -.031621643999786   -.0151693053201028    -.0645391547483613  -.011853886644523706
      14620 2005 36   .09040196444776598 0 . .   .08578698655034533    -.03213985362561363   -.01568751494593043  -.06505736437418894  -.012372096270351338   .003667728977331572
      14620 2006 36    .0536471329247317 0 . .   .09040196444776598   -.020302492843351075   -.06967234227160958  -.01698707416777198 -.0009472489200890721   -.04872679680858805
      14620 2007 36    .0700994716044149 0 . .    .0536471329247317    -.03291751074857531   .019767757355262296  .035807582602945205  -.011971965285553776                     .
      14620 2008 36  .020729622176156395 0 . .    .0700994716044149    .003315418675579093   .019355243923262003  -.02842430396523698                     .                     .
      14620 2009 36     .073414890279994 0 . .  .020729622176156395     .06872509335152051    .02094554546302153                    .                     .                     .
      14620 2010 36    .0894547155276769 0 . .     .073414890279994    -.03173972264081607                     .                    .                     .                     .
      14620 2011 36  .041675167639177925 1 0 0    .0894547155276769    -.02238569583768947  -.037939325255589504  -.02790289384112015  -.033005737841186385  -.017465641478006957
      14620 2012 36   .06706901968998744 0 . .  .041675167639177925    .009840222632909477    .01987665404737883  .014773810047312597   .030313906410492024                     .
      14620 2013 36    .0515153902720874 0 . .   .06706901968998744    -.00551719800343068  -.010620042003496914  .004920054359682513                     .                     .
      end
      Apologize for not being clear on how the data is structured.

      The data is structured as a panel with a dummy indicating every year with a turnover (and categorizing that turnover in whether it is forced or voluntary and whether the successor is recruited internally or externally). OROABencht1 is the performance the year prior to the event, (i.e. the main variable used for the matching). The ΔOROAt* variables indicate the performance in the years post the turnover - ΔOROAt1 is performance one year after, ΔOROAt2 is performance two years after etc. Their connection to the matching is simply a question of available data. If I match a turnover event with data 5 years after the turnover with a control only having data 1 year after the turnover, I can only compare the first year.

      Please let me know if you want me to clarify further.

      Many thanks for your assistance.

      Comment


      • #4
        OK, thanks. I think the following code does what you need:

        Code:
        //    VERIFY digitSNICode HAS TWO DIGITS
        assert length(string(digitSNICode, "%02.0f")) == 2
        
        //    CREATE A FILE OF POTENTIAL CONTROLS
        preserve
        keep if Turnover == 0
        drop Turnover
        ds DataYearFiscal, not
        rename (`r(varlist)') ctrl_=
        tempfile controls
        save `controls'
        
        //    NOW ALL THE CASES ONLY
        restore
        keep if Turnover == 1
        drop Turnover
        
        //    PAIR EACH CASE WITH ALL POSSIBLE MATCHES AMONG THE CONTROLS
        //    ENFORCING OROA BEING WITHIN 10% IN THE YEAR PRECEDING TURNOVER
        gen low = 0.9*OROABencht1
        gen high = 1.1*OROABencht1
        rangejoin ctrl_OROABencht1 low high using `controls', by(DataYearFiscal)
        keep if !missing(ctrl_CompanyID)
        gen log_ratio = abs(log(OROABencht1/ctrl_OROABencht1))
        
        
        //    FROM AMONG THESE PICK THE BEST DIGIT MATCH OF digitSNICode
        //    AND, IF TIES, CHOOSE THE CLOSEST OROA AMONG THEM
        gen byte digits_matching = 0
        replace digits_matching = 1 if floor(digitSNICode/10) == floor(ctrl_digitSNICode/10)
        replace digits_matching = 2 if digitSNICode == ctrl_digitSNICode
        gsort CompanyID digits_matching -log_ratio
        by CompanyID (digits_matching): keep if _n == _N
        It matches according to the following constraints, which are my understanding of the quoted methods in #1:

        1. No matter what, OROABench for the control must be within 10% of that of the case in the year preceding the turnover year.

        2. Subject to that constraint, select a 2-digit SNICode match if possible, if not, then a 1 digit SNICode, and if that's not possible, just ignore the SNICode.

        Now, the original instructions are not clear about what to do if, for example, there is a 1 digit SNICode match that has a closer OROABencht1 match than an also available 2 digit SNICode match. I have implemented the code so that the largest number of digits matching takes precedence over the closeness of the OROABencht1 match (although we never allow the OROABencht1 ratio to be outside the 0.9 to 1.1 range.) Moreover, if there are multiple observations with the same number of digits and equal OROABencht1 ratios, one is selected at random (and irreproducibly). (If you want to make it reproducible, be sure to set the -sortseed- near the top of the code. (See -help set sortseed- if you are not familiar with this.)

        This code only does the matching--it does not deal with the subsequent calculations.

        -rangejoin- is by Robert Picard and is available from SSC. While it can be emulated by -joinby- followed by an appropriate -keep- command, it is much faster and requires less memory--these are important considerations if your data set is large.

        When run on your example data, it finds suitable matches for 3 of the CompanyIDs--the rest have no available match in the example, though they might in the full data set.

        Comment


        • #5
          Many thanks - very appreciated.

          I have interpreted the matching method applied by Barber & Lyon the same way you have - with the largest number of digits matching taking precedence over the closeness of the OROABencht1 match.

          Two follow-up questions:
          1. As you may have noticed, many observations lack data in one or more of the ΔOROAt* variables. Is there a way to structure the code to make sure the control matches the number of data years available post the turnover - i.e. if the case has data available in ΔOROAt1, ΔOROAt2, ΔOROAt3 and ΔOROAt4 the control also needs to have data in ΔOROAt1_ctrl, ΔOROAt2_ctrl, ΔOROAt3_ctrl and ΔOROAt4_ctrl (so that I can actually compute the difference between them)? I would not want to exclude an observation based on this, but at least make sure I maximize the number of differences (e.g. ΔOROAt1-ΔOROAt1_ctrl) I can compute.
          2. It seems like the code only allows one case per firm. Many times a firm can have several turnover events during this time span - is it possible to keep them and conduct the same matching procedure on them?

          Comment


          • #6
            So this will implement the changes you asked for.

            Code:
            //    VERIFY digitSNICode HAS TWO DIGITS
            assert length(string(digitSNICode, "%02.0f")) == 2
            
            //    IDENTIFY NUMBER OF NON-MISSING VALUES AMONG ΔOROAt*
            egen int ycount = rownonmiss(ΔOROAt*)
            
            //    CREATE A FILE OF POTENTIAL CONTROLS
            preserve
            keep if Turnover == 0
            drop Turnover
            ds DataYearFiscal, not
            rename (`r(varlist)') ctrl_=
            tempfile controls
            save `controls'
            
            //    NOW ALL THE CASES ONLY
            restore
            keep if Turnover == 1
            egen long event = group(CompanyID DataYearFiscal)
            drop Turnover
            
            //    PAIR EACH CASE WITH ALL POSSIBLE MATCHES AMONG THE CONTROLS
            //    ENFORCING OROA BEING WITHIN 10% IN THE YEAR PRECEDING TURNOVER
            gen low = 0.9*OROABencht1
            gen high = 1.1*OROABencht1
            rangejoin ctrl_OROABencht1 low high using `controls', by(DataYearFiscal)
            keep if !missing(ctrl_CompanyID)
            gen log_ratio = abs(log(OROABencht1/ctrl_OROABencht1))
            
            //    CALCULATE THE DIGIT MATCH IN SNI CODE
            gen byte digits_matching = 0
            replace digits_matching = 1 if floor(digitSNICode/10) == floor(ctrl_digitSNICode/10)
            replace digits_matching = 2 if digitSNICode == ctrl_digitSNICode
            
            //    CALCULATE THE AMOUNT OF DATA AVAILABLE IN ΔOROAt* FOR THE PAIR
            gen common_years = min(ycount, ctrl_ycount)
            
            
            //    NOW SELECT THE "BEST" MATCH ACCORDING TO THESE PRIORITIES:
            //    MATCHING OF SNI CODE DIGITS DOMINATES
            //    NUMBER OF YEARS OF FOLLOW-UP DATA AVAILABLE TO CASE AND CONTROL IN COMMON
            //    WHICH, IN TURN, DOMINATES CLOSENESS OF OROABencht1 MATCH
            gsort event digits_matching common_years -log_ratio
            by event (digits_matching common_years): keep if _n == _N
            Note: In dealing with the number of years of follow-up data, I have not gone for the control with the largest amount of data. If, for example, the case has only two years of data, a control with 5 years of data offers no advantage over a control with 2 such years. So I have instead counted the number of years they both have and sought to maximize that. I have also assumed that this matching criterion is subordinate to matching the number of digits in the SNI Code but takes priority over closeness of the OROABencht1 match.

            Comment


            • #7
              Very helpful - this is precisely what I want.

              For the 567 cases the code finds matches for 363 (when adjusting the OROABencht1 range to 20% it increases to 371). Do you have any more suggestions on how I can adapt the code to increase the number of matches?

              Comment


              • #8
                Well, the only criterion in the matching that actually limits the availability of the match is the OROABencht1 ratio. The SNI Code digit matching and available follow-up data matching identify which of the available matches is best, but they never result in a case going unmatched.

                So the only two options for getting more matches that I can see are:

                1. Expand the pool of potential controls by getting more data, or,

                2. Relax the OROABencht1 range even farther.

                3. Forget about OROABencht1 and match on some other performance measure that shows greater similarity in the distributions of cases and controls. (I don't know your content area so I have no ideas what other performance measure(s) might be suitable here.)

                Unmatchable cases are the principal drawback of matched-pair study designs; one frequently encounters this problem. It is the principal reason matched-pair designs are infrequently used.

                Comment


                • #9
                  Thanks for all your help!

                  I will try a combination of 1 and 2 to expand the matched group even further.

                  Comment


                  • #10
                    I have been experimenting with the OROABencht1 range and only managed to increase the matched firms to 380, even when relaxing the range almost entirely. Since I have a large sample of control firms-years - vastly exceeding the number of case firm-years (567 case firm-years and 4372 control firm-years) I would expect all events to matched with that procedure.
                    Maybe I don't fully comprehend the code - could you please assist me in understanding why I get this result?
                    Last edited by Carl-Johan Andersson; 29 Apr 2019, 07:13.

                    Comment


                    • #11
                      Reviewing the code, I do not see anything that might prevent it from creating matches where controls meeting the matching condition might be found. I suggest you explore your data a bit. Pick a few cases for which the code has found no match, and then just working interactively in the Command window, see if you can find observations among the controls that are acceptable matches (but, evidently, were not found). Then post back a data example containing those cases and the would-be matches, and I'll try working with that to see where the code might be going wrong.

                      Or, you may find that there really just aren't good matches for some cases. If the unmatched cases mostly have values of OROABencht1 that are at the extremes of the distribution, then matches for them will be rare in the world, and even scarcer in finite samples.

                      Anyway, see if you can find some examples of a match that the code misses, and I'll try to figure out how to fix it.

                      Comment


                      • #12
                        Looking at the cases with no matches, it seems to be a trend that they have a negative OROABencht1 (though not necessarily extreme, e.g -1,6%, -0,4% etc). How does the following part of the code handle negative OROABencht1 cases? Is there a problem with the low high variables?

                        Code:
                        //    PAIR EACH CASE WITH ALL POSSIBLE MATCHES AMONG THE CONTROLS
                        //    ENFORCING OROA BEING WITHIN 10% IN THE YEAR PRECEDING TURNOVER
                        gen low = 0.9*OROABencht1
                        gen high = 1.1*OROABencht1
                        rangejoin ctrl_OROABencht1 low high using `controls', by(FiscalYear)
                        keep if !missing(ctrl_CompanyID)
                        gen log_ratio = abs(log(OROABencht1/ctrl_OROABencht1))
                        If you don't see any problem here, I will try to send you a new excerpt from the dataset containing no matches.

                        Comment


                        • #13
                          Yes, that is indeed a problem! When OROABencht1 is negative, then high will be less than low, and so nothing will match.

                          Code:
                          gen low = OROABencht1 - 0.10*abs(OROABencht1)
                          gen high = OROABencht1 + 0.1*abs(OROABencht1)
                          will fix this.

                          Comment


                          • #14
                            Many thanks - very helpful!

                            Comment


                            • #15
                              A follow-up question on this matching method. Would it be possible to change the code to allow for the following adjustment:

                              Instead of matching firm-years 1-to-1, match each sample firm-year to a mean OROAt* from all comparison firms satisfying the below criteria.

                              1. All firms with the same two-digit SIC code and OROABencht1 within 10% of the sample firm’s OROABencht1.
                              2. If there are no such firms: all firms with the same one-digit SIC code and OROABencht1 within 10% of the sample firm’s OROABencht1.
                              3. For firms without matches after this procedure: all firms with OROABencht1 within 10% of the sample firm’s OROABencht1 (regardless of SIC code).

                              Let me know if it needs clarification.

                              Appreciate all your help!

                              Comment

                              Working...
                              X