Announcement

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

  • Ranking variables into deciles.

    Hello,

    I am currently trying to measure investment efficiency based on Biddle, Hilary, and Verdi in 2009 (How does financial reporting quality relate to investment efficiency?).
    Here is sample of my data:

    Code:
     
    gvkey fyear sic sic_2 invest capx cash_w lev_w lev_1_w xrd aqc sppe at_lg
    1004 2013 5080 50 1.115483 6.214822 0.0417427 0.2640741 -0.2640741 178 15.3 0 2136.9
    1004 2014 5080 50 5.967641 11.20252 0.0248693 0.0386451 -0.0386451 114 1 40.3 2199.5
    1004 2015 5080 50 3.524695 29.9661 0.0205941 0.089835 -0.089835 110 0 0 1515
    1045 2013 4512 45 2.797297 23.23534 0.4375159 0.6530412 -0.6530412 100 -206 128 23510
    1045 2014 4512 45 3.974397 36.91624 0.191045 0.3830834 -0.3830834 5.072 0 33 42278
    1045 2015 4512 45 10.76539 42.75499 0.1587581 0.4187704 -0.4187704 5.802 0 35 43771
    1045 2016 4512 45 12.98633 39.83562 0.1445213 0.4645048 -0.4645048 6.945 0 123 48415
    1050 2013 3564 35 8.432193 28.18833 0.2408081 0.841197 -0.841197 52.8 104.432 0.215 94.104
    1050 2014 3564 35 8.475721 5.312716 0.0555524 0.297074 -0.297074 76.7 44.399 7.738 348.536
    1050 2015 3564 35 26.17039 4.024049 0.095358 0.3809057 -0.3809057 90.1 37.481 0 414.365
    1050 2016 3564 35 7.833648 2.392121 0.0790256 0.2043472 -0.2043472 90.2 0 0 598.819
    1062 2013 6799 67 6.881711 4.925184 0.0064763 0 0 611.1 0 0 468.013
    1062 2014 6799 67 6.287024 4.375733 0.000591 0 0 725.2 0 0 252.142
    1062 2015 6799 67 2.479092 4.682548 0.0123179 0 0 790 0 0 223.333
    1062 2016 6799 67 2.911833 4.270411 0.0263566 0 0 654.3 0 0 162.35
    1072 2013 3670 36 2.897789 10.37891 0.3360072 0 0 718 1.6 0.795 2601.995
    1072 2014 3670 36 8.609598 11.28391 0.353673 0 0 595.4 0 0.088 2384.988
    1072 2015 3670 36 2.468549 24.07052 0.3858464 0 0 603.7 0 1.084 2459.015
    1075 2013 4911 49 9.360869 9.918662 0.000712 0.2090094 -0.2090094 96 0 0 13379.62
    1075 2014 4911 49 12.93368 8.504842 0.0005629 0.2243901 -0.2243901 102.5 0 0 13508.69
    1075 2015 4911 49 14.10227 9.758029 0.0027588 0.2418963 -0.2418963 91.9 0 0 14313.53
    1075 2016 4911 49 6.248275 10.97001 0.000591 0.2676148 -0.2676148 89.7 0 0 15028.26
    1076 2013 7359 73 19.03485 4.925184 0.1579439 0.0635298 -0.0635298 67.2 0 6.841 1812.929
    1076 2014 7359 73 26.28182 4.375733 0.0136057 0.2700807 -0.2700807 62.5 0 6.032 1827.176
    1076 2015 7359 73 15.7515 4.682548 0.0151284 0.1844936 -0.1844936 61.9 0 7.515 2456.844
    1076 2016 7359 73 8.873837 4.270411 0.1237666 0.1321288 -0.1321288 52.1 0 19.393 2658.875
    1078 2013 2834 28 4.725221 14.20059 0.1204433 0.0503905 -0.0503905 150.823 580 0 67234.95
    1078 2014 2834 28 13.36112 18.23878 0.1038344 0.0793425 -0.0793425 115.277 3317 0 42953
    1078 2015 2834 28 6.662629 18.70261 0.1483949 0.1422411 -0.1422411 88.476 235 0 41275
    1078 2016 2834 28 9.360869 19.5637 0.4551846 0.501394 -0.501394 65.386 80 0 41247
    1084 2013 7370 73 7.659079 0 0.092827 0 0 0 0 0 0.237
    1084 2014 7370 73 23.1202 0 0.0853659 0 0 0 0 0 0.328
    1084 2015 7370 73 3.079134 0 0.9285714 0 0 0 0 0 0.028
    1084 2016 7370 73 11.70583 0 3.562657 0 0 0 0 0 0.026
    1094 2013 5160 51 12.3351 8.731312 0.1182003 0.0680132 -0.0680132 0 0 0 299.28
    1094 2014 5160 51 12.90598 10.03506 0.134938 0.3003989 -0.3003989 0 86.14 0 323.43
    1094 2015 5160 51 12.71292 5.331375 0.0799942 0.213597 -0.213597 0 0 0 467.984
    1094 2016 5160 51 13.98514 10.78806 0.1382454 0.2421362 -0.2421362 0 0 0 489.774
    1096 2013 6500 65 7.460923 13.70049 0.0294928 0.4042114 -0.4042114 0 0 0.797 4386.182
    1096 2014 6500 65 9.360869 2.491499 0.0225836 0.6061386 -0.6061386 0 -12.612 15.634 5452.995
    1096 2015 6500 65 12.67648 2.758143 0.0116972 0.4573994 -0.4573994 0 7.574 20.751 7993.684
    1096 2016 6500 65 11.81735 2.328146 0.028077 0.4328883 -0.4328883 0 2.522 41.201 8602.132


    I have measured the investment as the sum of capital expenditures, R&D expenditures, and acquisitions minus sales of PPE, scaled by lagged total assets.

    Code:
    gen invest  = ((xrd + capx + aqc - sppe) *100) / at_lg


    Then, I have to do the next step:
    “We first rank firms into deciles based on their cash balance and their leverage (we multiply leverage by minus one before ranking so that, as for cash, it is increasing with the likelihood of over investment) and re-scale them to range between zero and one. We then create a composite score measure, OverFirm, which is computed as the average of ranked values of the two partitions variables.”

    another explanation :
    "we rank firms into deciles based on the firms’ levels of cash balance (ranging from 0.1 at the lowest to 1.0 at the highest) and on leverage (ranging from 1 at the highest to 0.1 at the lowest). Thereafter, we obtain the averages of both deciles for each firm-year observation. Firms with less than the median decile value are likely to under-invest, whereas firms with more than the median decile value are likely to overinvest "

    Code:
    gen lev_1 = lev_w * -1
    winsor lev_1 , gen (lev_w_1) p(.01)
    egen lev1rank = group (lev_1_w)
    egen cashrank = group (cash_w)
    egen maxlev1=max(lev1rank)
    egen maxcash=max(cashrank)
    gen lev1rankmax = lev1rank / maxlev1
    gen cashrankmax = cashrank / maxcash
    egen avelev1rankmax = mean(lev1rank)
    egen avecashrankmax = mean(cashrank)
    gen overfirm = 0
    replace overfirm = 1  if lev1rank > avelev1rankmax
    replace overfirm = 1  if cashrank > avecashrankmax
    I have a doubt about this conclusion. I hope someone can help me on this.
    Thank you in advance


    Regards,

  • #2
    First, you can xtset your data. Then, instead of calculating the lag first you can just include a factor variable notation (L.at instead of at_lg) in the invest equation.

    Look at egen with the pctile function. That is, instead of your group function (and you can't have the space before (leve_1_w), you have percentile. Then you can convert the full percentiles into your deciles using generate with the inrange.

    Comment


    • #3
      Originally posted by Phil Bromiley View Post
      First, you can xtset your data. Then, instead of calculating the lag first you can just include a factor variable notation (L.at instead of at_lg) in the invest equation.

      Look at egen with the pctile function. That is, instead of your group function (and you can't have the space before (leve_1_w), you have percentile. Then you can convert the full percentiles into your deciles using generate with the inrange.

      Thanks Phil for your replay. I already did xtset and L.at before using these codes:

      Code:
      xtset  gvkey  fyear
      gen at_lg = L.at

      I used these code, kindly correct my work if it is wrong:

      Code:
      egen lev1rank = pctile (lev_1_w)
      egen cashrank = pctile (cash_w)


      how can convert the full percentiles into my deciles using generate with the inrange?

      Thank in advance.


      Comment

      Working...
      X