Announcement

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

  • How to match each firm-year observation in order to calculate performance-matched discretionary accrual

    (Sorry for inaccurate language, i am not a native speaker)

    I am trying to calculate the performance-matched discretionary accrual according to Kothari et al. 2005.

    (S.P. Kothari, Andrew J. Leone, Charles E. Wasley, Performance matched discretionary accrual measures, Journal of Accounting and Economics, Volume 39, Issue 1, 2005, Pages 163-197, ISSN 0165-4101, https://doi.org/10.1016/j.jacceco.2004.11.002. (https://www.sciencedirect.com/scienc...65410104000849))

    Kothari et al. match each firm-year observation with another from the same two-digit SIC Code and year with the closest return on assets in the current year. They then calculate the performance-matched discretionary accrual for firm i in year t by subtracting the matched firm's Jones-model discretionary accrual from the firm's Jones-Model discretionary accrual in year t. How can i match the observations in the same way using Stata?

    I was able to compute the discretionary accrual (tac) and the two-digit SIC Code, resulting in the following.

    Code:
    gen tac=(ib-oancf)/at
    gen sic2=floor(sic/100)
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double fyear float(sic2 tac) double(ib oancf at) float roa
    1991 50            .    10.02   8.814  395.351    .0344504
    1992 50   -.04179324     .283  16.806  365.151 -.005249883
    1993 50   .007632459    9.484   6.697  417.626   .03276616
    1994 50   -.01147438   10.463  15.255  425.814  .034552645
    1995 50   -.02054418   16.012   24.76  437.846   .05203199
    1996 50   .030819055   23.025   9.531  529.584   .06226585
    1997 50   .024234116   35.657  22.823  670.559   .07629008
    1998 50    .01960454   41.671  28.525   726.63   .08227846
    1999 50    .03455954   35.163  10.051  740.998  .066836886
    2000 50  -.037195783   18.531  46.093  701.854   .02880941
    2001 50   -.03650902  -58.939 -33.315  710.199  -.13831194
    2002 50   -.06637999   -12.41  34.733  686.621  -.02838538
    2003 50   -.01611952    3.504  14.572  709.292  .002406625
    2004 50   -.04563142   18.572  50.938   732.23   .02955219
    2005 50     .1033077   35.163 -40.482  978.819    .0464805
    2006 50      .082432   59.447 -21.239 1067.633     .081883
    2007 50     .0550929   75.745  16.926  1362.01   .08523285
    2008 50    .01185674     80.6  64.451 1377.511   .08704758
    2009 50   -.07878558   44.628 153.156 1501.042   .04276229
    2010 50   -.02362292   73.139 108.598 1703.727   .06368567
    2011 50  -.015550613   67.723  94.217 2195.653   .04258824
    1992 37            .  -19.781  62.208 1706.454 -.007493317
    1993 37    .06958055  127.441   8.705 1665.921   .12967542
    1994 37  -.006602954     25.2    36.2   1815.1  .021100765
    1995 37 -.0013222413     84.3    86.7   2015.8  .065978765
    1996 37   .006151404     92.4      80   2218.6   .06044352
    1997 37      .066258    237.9    90.9   3181.3   .12123974
    1998 37   -.00792129     67.2    92.4   3257.3    .0334019
    1999 37  .0030086266     77.3    67.5   3563.4   .03538755
    2000 37      .012011     79.9    37.1   3794.5  .031598367
    2001 37   .008301489    145.7   114.2   3723.1   .04324353
    2002 37   -.02299159     79.7   165.3   3702.5  .033896018
    2003 37    .10530722    344.2   -45.7   4832.1    .0792409
    1992 36            .   21.026  34.755  240.762   .14423372
    1993 36   .009087813   31.636  29.448  280.054    .1775979
    1994 36  -.063130684   40.521  58.201  334.684   .19218427
    1995 36    .03264871   55.186  44.259  601.083   .14345606
    1996 36    .03993791   87.463  63.457  768.765   .17776954
    1997 36    .03788414  108.837  79.713  936.303   .18162604
    1998 36    .06904709  146.727  82.078 1300.587   .17356317
    1999 36    -.1881043   87.635 332.281 1672.529   .09589251
    2000 36    .38665995    868.1   221.4   3970.5    .3678126
    2001 36    -.3482433  -1287.7      95   2499.7   -.7683722
    2002 36    -.4822579    -1145    60.5   1144.2    -.771019
    2003 36    -.1010313    -76.7    38.9   1296.9 -.063304804
    2004 36    .02174416     31.3     3.1   1428.1   .02324767
    2005 36   .018836217     85.5    58.6     1535   .06039088
    2006 36   .004625407     94.2    87.1   1611.4   .03506268
    2007 36  -.017686484    113.3   141.8   1764.8   .06606981
    2008 36   -.12466002    -44.4   175.6     1921 -.019885477
    2009 36   -.28401875   -465.7    79.9   1343.6   -.3489134
    2010 36   -.04420959     77.2   136.6   1474.5   .05805358
    1992 38            .    -.528   3.807   25.664 -.020417705
    1993 38   -.09328242   -1.256   1.138   22.725 -.065258525
    1994 38   -.25760177   -4.184    1.67   15.075   -.2866335
    1995 38    -.1319403     .924   2.913    11.79   .08049195
    1996 38     .1615776     .701  -1.204   20.258   .03756541
    1997 38   -.19370125    1.549   5.473   20.516   .08178982
    1998 38   -.13014232   -3.328   -.658   18.661  -.17491025
    1999 38   -.13557687   -2.207    .323   13.986  -.16731016
    2000 38   -.16909766    -.808   1.557   11.608  -.06917643
    2001 38   -.23776706   -1.738   1.022    8.635   -.1997684
    2002 38   -.12345107     .084    1.15     7.85  .012484076
    2003 38    -.0866242    -.218    .462    6.044  -.03424884
    2004 38    .07677035    1.345    .881    6.245   .20768616
    2005 38    .12409928      1.9   1.125    8.153   .15074205
    2006 38   .008708451    1.005    .934   14.341   .06986961
    2007 38   -.21818563   -4.673  -1.544   27.171  -.16462405
    2008 38    -.3221449  -11.049  -2.296   21.401   -.4173169
    1992 28            .   11.367  23.854  371.724    .0472797
    1993 28  .0008447127    8.621   8.307  423.202   .03502819
    1994 28   -.04457682   -1.703  17.162  592.318  .002930858
    1995 28   -.03040765   18.817  36.828  634.853   .04761417
    1996 28   -.05715024  -11.461  24.821  613.407  -.02645226
    1997 28   -.02209789   17.408  30.963  631.866   .04391754
    1998 28   -.05134633   24.211  56.655  908.936   .04288861
    1999 28  -.036268782   36.972  69.938 1160.266   .04966792
    2000 28    .01929213   55.508  33.124 1610.435     .046996
    2001 28    -.0962833  -35.674 119.384 2390.008 -.014669825
    2002 28   -.10701512  -93.567   162.2 2296.924  -.06803969
    2003 28   -.05988705   19.444     157 2329.268 .0082648285
    2004 28   -.21504566 -314.737 186.162 2003.842  -.12655589
    2005 28   -.09237505   62.176 247.281 1623.383   .02696714
    2006 28   .010508303   59.992  42.933  927.239   .09976824
    2007 28   -.06532512  -13.581  46.991 1288.165  .007259163
    1991 36            .    -.725   -.427    2.231   -.3249664
    1992 36    -.1653967      -.5   -.131    2.213  -.22593763
    1993 36  -.013556258     .383    .413     2.69    .1654275
    1994 36    .20446096     .767    .217    4.181 -.011719684
    1995 36    .19492944   -1.101  -1.916    6.435  -.16923077
    1996 36    -.4618493   -2.761    .211    4.969   -.3672771
    1997 36    .07868787     .937    .546     5.45    .1774312
    1998 36   -.39688075    -3.48  -1.317    3.228  -1.0693928
    1999 36   -.25867411   -1.121   -.286    4.575   -.2450273
    2000 36     .2915847    1.164    -.17    6.373    .1845285
    2001 36  -.005962655      .67    .708   17.867  .027089046
    1992 45            .     -475     843    18706  -.03726077
    1993 45    -.0787448      -96    1377    19326 -.005847045
    1994 45   -.07145814      228    1609    19486   .01898799
    1995 45   -.10207328      196    2185    19556  .018306402
    end
    format %ty fyear

    I would really appreciate any help. Thank you.

  • #2
    Your English is excellent! And thank you for providing a complete reference. Unfortunately, as I am not in the field of finance or economics, my institution does not allow me behind the paywall on this article, so I have been able to read only its abstract.

    When creating matched pairs, there is always a group that is designated as the treatment group (or exposed group, or group of interest) and another group that serves as controls. One then picks, for each observation in the treatment group, an observation from the control group, according to some criterion, to match it with. Your matching criterion is clear: same year and sic2 code and nearest value of roa. But I do not see anything in your example data that indicates which observations are in the treatment group, and which in the control group. Presumably you have that information in your data set but did not include it with your example. To illustrate the matching approach I have added an additional variable to your example, called group, coded 0 for control group and 1 for treatment group.

    I also note that "nearest roa" is ambiguous: do you mean the smallest difference in roa, or the ratio closest to 1? Here I assume you want smallest difference. (The article's abstract doesn't say which way they do this; I presume that in the full text it does say that somewhere, or perhaps it is just following some convention widely known in your field but not to me.)

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte group double fyear float(sic2 tac) double(ib oancf at) float roa
    1 1991 50            .    10.02   8.814  395.351    .0344504
    0 1992 50   -.04179324     .283  16.806  365.151 -.005249883
    1 1993 50   .007632459    9.484   6.697  417.626   .03276616
    1 1994 50   -.01147438   10.463  15.255  425.814  .034552645
    0 1995 50   -.02054418   16.012   24.76  437.846   .05203199
    1 1996 50   .030819055   23.025   9.531  529.584   .06226585
    1 1997 50   .024234116   35.657  22.823  670.559   .07629008
    1 1998 50    .01960454   41.671  28.525   726.63   .08227846
    0 1999 50    .03455954   35.163  10.051  740.998  .066836886
    1 2000 50  -.037195783   18.531  46.093  701.854   .02880941
    1 2001 50   -.03650902  -58.939 -33.315  710.199  -.13831194
    0 2002 50   -.06637999   -12.41  34.733  686.621  -.02838538
    0 2003 50   -.01611952    3.504  14.572  709.292  .002406625
    1 2004 50   -.04563142   18.572  50.938   732.23   .02955219
    0 2005 50     .1033077   35.163 -40.482  978.819    .0464805
    1 2006 50      .082432   59.447 -21.239 1067.633     .081883
    0 2007 50     .0550929   75.745  16.926  1362.01   .08523285
    0 2008 50    .01185674     80.6  64.451 1377.511   .08704758
    0 2009 50   -.07878558   44.628 153.156 1501.042   .04276229
    1 2010 50   -.02362292   73.139 108.598 1703.727   .06368567
    0 2011 50  -.015550613   67.723  94.217 2195.653   .04258824
    1 1992 37            .  -19.781  62.208 1706.454 -.007493317
    0 1993 37    .06958055  127.441   8.705 1665.921   .12967542
    1 1994 37  -.006602954     25.2    36.2   1815.1  .021100765
    0 1995 37 -.0013222413     84.3    86.7   2015.8  .065978765
    1 1996 37   .006151404     92.4      80   2218.6   .06044352
    1 1997 37      .066258    237.9    90.9   3181.3   .12123974
    0 1998 37   -.00792129     67.2    92.4   3257.3    .0334019
    0 1999 37  .0030086266     77.3    67.5   3563.4   .03538755
    1 2000 37      .012011     79.9    37.1   3794.5  .031598367
    1 2001 37   .008301489    145.7   114.2   3723.1   .04324353
    0 2002 37   -.02299159     79.7   165.3   3702.5  .033896018
    1 2003 37    .10530722    344.2   -45.7   4832.1    .0792409
    1 1992 36            .   21.026  34.755  240.762   .14423372
    1 1993 36   .009087813   31.636  29.448  280.054    .1775979
    0 1994 36  -.063130684   40.521  58.201  334.684   .19218427
    0 1995 36    .03264871   55.186  44.259  601.083   .14345606
    1 1996 36    .03993791   87.463  63.457  768.765   .17776954
    1 1997 36    .03788414  108.837  79.713  936.303   .18162604
    1 1998 36    .06904709  146.727  82.078 1300.587   .17356317
    0 1999 36    -.1881043   87.635 332.281 1672.529   .09589251
    1 2000 36    .38665995    868.1   221.4   3970.5    .3678126
    1 2001 36    -.3482433  -1287.7      95   2499.7   -.7683722
    1 2002 36    -.4822579    -1145    60.5   1144.2    -.771019
    0 2003 36    -.1010313    -76.7    38.9   1296.9 -.063304804
    0 2004 36    .02174416     31.3     3.1   1428.1   .02324767
    0 2005 36   .018836217     85.5    58.6     1535   .06039088
    0 2006 36   .004625407     94.2    87.1   1611.4   .03506268
    1 2007 36  -.017686484    113.3   141.8   1764.8   .06606981
    1 2008 36   -.12466002    -44.4   175.6     1921 -.019885477
    1 2009 36   -.28401875   -465.7    79.9   1343.6   -.3489134
    1 2010 36   -.04420959     77.2   136.6   1474.5   .05805358
    0 1992 38            .    -.528   3.807   25.664 -.020417705
    1 1993 38   -.09328242   -1.256   1.138   22.725 -.065258525
    0 1994 38   -.25760177   -4.184    1.67   15.075   -.2866335
    0 1995 38    -.1319403     .924   2.913    11.79   .08049195
    0 1996 38     .1615776     .701  -1.204   20.258   .03756541
    0 1997 38   -.19370125    1.549   5.473   20.516   .08178982
    0 1998 38   -.13014232   -3.328   -.658   18.661  -.17491025
    1 1999 38   -.13557687   -2.207    .323   13.986  -.16731016
    1 2000 38   -.16909766    -.808   1.557   11.608  -.06917643
    1 2001 38   -.23776706   -1.738   1.022    8.635   -.1997684
    1 2002 38   -.12345107     .084    1.15     7.85  .012484076
    0 2003 38    -.0866242    -.218    .462    6.044  -.03424884
    1 2004 38    .07677035    1.345    .881    6.245   .20768616
    0 2005 38    .12409928      1.9   1.125    8.153   .15074205
    1 2006 38   .008708451    1.005    .934   14.341   .06986961
    0 2007 38   -.21818563   -4.673  -1.544   27.171  -.16462405
    1 2008 38    -.3221449  -11.049  -2.296   21.401   -.4173169
    0 1992 28            .   11.367  23.854  371.724    .0472797
    0 1993 28  .0008447127    8.621   8.307  423.202   .03502819
    0 1994 28   -.04457682   -1.703  17.162  592.318  .002930858
    0 1995 28   -.03040765   18.817  36.828  634.853   .04761417
    0 1996 28   -.05715024  -11.461  24.821  613.407  -.02645226
    1 1997 28   -.02209789   17.408  30.963  631.866   .04391754
    0 1998 28   -.05134633   24.211  56.655  908.936   .04288861
    0 1999 28  -.036268782   36.972  69.938 1160.266   .04966792
    1 2000 28    .01929213   55.508  33.124 1610.435     .046996
    0 2001 28    -.0962833  -35.674 119.384 2390.008 -.014669825
    0 2002 28   -.10701512  -93.567   162.2 2296.924  -.06803969
    1 2003 28   -.05988705   19.444     157 2329.268 .0082648285
    0 2004 28   -.21504566 -314.737 186.162 2003.842  -.12655589
    1 2005 28   -.09237505   62.176 247.281 1623.383   .02696714
    1 2006 28   .010508303   59.992  42.933  927.239   .09976824
    0 2007 28   -.06532512  -13.581  46.991 1288.165  .007259163
    1 1991 36            .    -.725   -.427    2.231   -.3249664
    1 1992 36    -.1653967      -.5   -.131    2.213  -.22593763
    0 1993 36  -.013556258     .383    .413     2.69    .1654275
    0 1994 36    .20446096     .767    .217    4.181 -.011719684
    0 1995 36    .19492944   -1.101  -1.916    6.435  -.16923077
    0 1996 36    -.4618493   -2.761    .211    4.969   -.3672771
    0 1997 36    .07868787     .937    .546     5.45    .1774312
    0 1998 36   -.39688075    -3.48  -1.317    3.228  -1.0693928
    1 1999 36   -.25867411   -1.121   -.286    4.575   -.2450273
    1 2000 36     .2915847    1.164    -.17    6.373    .1845285
    0 2001 36  -.005962655      .67    .708   17.867  .027089046
    0 1992 45            .     -475     843    18706  -.03726077
    1 1993 45    -.0787448      -96    1377    19326 -.005847045
    1 1994 45   -.07145814      228    1609    19486   .01898799
    0 1995 45   -.10207328      196    2185    19556  .018306402
    end
    format %ty fyear
    
    
    //    SEPARATE THE TREATMENT AND CONTROL GROUPS
    preserve
    keep if group == 0     // CONTROLS
    drop group
    ds fyear sic2, not
    local vbles `r(varlist)'
    rename (`vbles') =0
    tempfile controls
    save `controls'
    
    restore
    keep if group == 1
    drop group
    ds fyear sic2, not
    rename (`vbles') =1
    
    gen `c(obs_t)' pair_num = _n
    joinby fyear sic2 using `controls', unmatched(master)
    gen roa_diff = abs(roa1 - roa0)
    
    set seed 1234
    set sortseed 5678
    
    by pair_num (roa_diff), sort: keep if _n == 1
    reshape long `vbles', i(pair_num) j(group)
    In your example data, many observations go unmatched--that is, there is no observation at all in the "control group" that matches the treatment group observation's sic2 and year. This may also happen, though probably only to a limited extent, in your full data set as well. If, however, you find that a large number of your treatment group observations have no match, then your data may not be suitable for this approach as the loss of data may be excessive.

    The final result of the code shown is a data set of matched pairs. Each pair is identified by the pair_num variable, and there are either one (no match found) or two (match found) observations with that pair number. When there is a match, one is from the treatment group and the other is from the control group, and is the match with the closest possible value of roa. Note also that this matching is done with replacement, which means that the same control may match to more than one treatment observation if it happens to be the best possible match for both (or all) of them. Again, the abstract of the article does not say whether they matched with or without replacement, so I assumed they matched with replacement as this approach minimizes the number of unmatched or poorly matched observations, and is also simpler to do. (For most analyses, matching without replacement has no statistical advantages over matching with replacement, although some people prefer matching without replacement for aesthetic reasons.)

    Comment

    Working...
    X