Announcement

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

  • Calculating cost of equity through fama and french 3 factor model

    Hello,

    I have to calculate the cost of equity capital based on fama and french 3 factor model. For this, I had a monthly data from Fama and french website (http://mba.tuck.dartmouth.edu/pages/....html#Research ) . I used rangestat command to calculate the market betas for the 3 factors as below

    Code:
    rangestat (reg) ret mktrf smb hml, interval(month -60 -1) by(permno)
    Then i caculated the monthly expected returns as

    Code:
    gen ce=rf+mkt+sb+hl+ce
    where
    mkt, sb, and hl are calculated as

    Code:
    gen mkt=b_mktrf*mktrf
    gen sb=b_smb*smb
    gen hl=b_hml*hml
    final data file looks like the one below.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double(permno date) float month double ret float(year mktrf smb hml rf) double(reg_nobs b_mktrf b_smb b_hml b_cons) float(mkt sb hl ce returns)
    10026 11353   1   .01587301678955555 1991   4.69  3.79 -1.84 .52  .                    .                       .                      .                      .           .             .             .         .         0
    10026 11381   2                 .375 1991   7.19  3.95  -.54 .48  1                    .                       .                      .                      .           .             .             .         .         0
    10026 11409   3   .05681818351149559 1991   2.65  3.89 -1.23 .44  2                    .                       .                      .                      .           .             .             .         .         0
    10026 11442   4   .19354838132858276 1991   -.28    .5  1.42 .53  3                    .                       .                      .                      .           .             .             .         .         0
    10026 11473   5 -.045045044273138046 1991   3.65  -.34  -.57 .47  4                    .                       .                      .                      .           .             .             .         .         0
    10026 11501   6   .07547169923782349 1991  -4.94   .07  1.21 .42  5                    .                       .                      .                      .           .             .             .         .         0
    10026 11534   7   .05263157933950424 1991   4.24  -.93 -1.25 .49  6                    .                       .                      .                      .           .             .             .         .         0
    10026 11564   8  -.07500000298023224 1991   2.32  1.59  -.78 .46  7                    .                       .                      .                      .           .             .             .         .         0
    10026 11595   9                    0 1991  -1.59  1.63    -1 .46  8                    .                       .                      .                      .           .             .             .         .         0
    10026 11626  10  -.09909909963607788 1991   1.29    .9  -.43 .42  9                    .                       .                      .                      .           .             .             .         .         0
    10026 11655  11  -.03999999910593033 1991  -4.19  -.48 -1.93 .39 10                    .                       .                      .                      .           .             .             .         .         0
    10026 11687  12                .1875 1991  10.84 -2.24 -4.03 .38 11                    .                       .                      .                      .           .             .             .         .         0
    10026 11718  13   -.2017543911933899 1992   -.59  8.47  4.51 .34 12                    .                       .                      .                      .           .             .             .         .         0
    10026 11746  14  -.05494505539536476 1992   1.09   .88  6.37 .28 13                    .                       .                      .                      .           .             .             .         .         0
    10026 11778  15   .04651162773370743 1992  -2.66 -1.03  3.65 .34 14                    .                       .                      .                      .           .             .             .         .         0
    10026 11808  16                    0 1992   1.07 -6.12  4.31 .32 15                    .                       .                      .                      .           .             .             .         .         0
    10026 11837  17                    0 1992     .3   .39  1.28 .28 16                    .                       .                      .                      .           .             .             .         .         0
    10026 11869  18  -.15555556118488312 1992  -2.34 -3.09   3.4 .32 17                    .                       .                      .                      .           .             .             .         .         0
    10026 11900  19   .02631578966975212 1992   3.77  -.44  -.53 .31 18                    .                       .                      .                      .           .             .             .         .         0
    10026 11931  20  .025641025975346565 1992  -2.38  -.12 -1.03 .26 19                    .                       .                      .                      .           .             .             .         .         0
    10026 11961  21  -.08749999850988388 1992   1.19   .56  -.21 .26 20                    .                       .                      .                      .           .             .             .         .         0
    10026 11991  22 -.054794520139694214 1992   1.02  2.05  -2.1 .23 21                    .                       .                      .                      .           .             .             .         .         0
    10026 12022  23    .2028985470533371 1992   4.13   3.7 -1.48 .23 22                    .                       .                      .                      .           .             .             .         .         0
    10026 12053  24   -.1325301229953766 1992   1.53  1.64  2.52 .28 23                    .                       .                      .                      .           .             .             .         .         0
    10026 12082  25   .02777777798473835 1993    .93  2.03  5.87 .23 24                    .                       .                      .                      .           .             .             .         .         0
    10026 12110  26   .06756756454706192 1993    .12 -3.43  6.42 .22 25                    .                       .                      .                      .           .             .             .         .         0
    10026 12143  27   .17721518874168396 1993    2.3   .23  1.22 .25 26                    .                       .                      .                      .           .             .             .         .         0
    10026 12173  28   .19354838132858276 1993  -3.05   -.7  2.61 .24 27                    .                       .                      .                      .           .             .             .         .         0
    10026 12201  29   .06306306272745132 1993   2.89  1.96 -3.41 .22 28                    .                       .                      .                      .           .             .             .         .         0
    10026 12234  30   .12711864709854126 1993    .31  -.31  2.62 .25 29                    .                       .                      .                      .           .             .             .         .         0
    10026 12264  31   .04511278122663498 1993   -.34   .93  3.25 .24 30                    .                       .                      .                      .           .             .             .         .         0
    10026 12296  32   .12230215966701508 1993   3.71   .31  -.45 .25 31                    .                       .                      .                      .           .             .             .         .         0
    10026 12326  33  -.07692307978868485 1993   -.12  3.11  -.44 .26 32                    .                       .                      .                      .           .             .             .         .         0
    10026 12355  34    .0763888880610466 1993   1.41  1.45 -1.54 .22 33                    .                       .                      .                      .           .             .             .         .         0
    10026 12387  35  -.07741935551166534 1993  -1.89 -1.42  -.27 .25 34                    .                       .                      .                      .           .             .             .         .         0
    10026 12418  36    .1538461595773697 1993   1.65  1.22   .57 .23 35                    .                       .                      .                      .           .             .             .         .         0
    10026 12449  37   -.1090909093618393 1994   2.87   .15  2.09 .25 36                    .                       .                      .                      .           .             .             .         .         0
    10026 12477  38  .040816325694322586 1994  -2.55  2.73 -1.45 .21 37                    .                       .                      .                      .           .             .             .         .         0
    10026 12508  39  -.13071896135807037 1994  -4.78  -.98  1.29 .27 38                    .                       .                      .                      .           .             .             .         .         0
    10026 12537  40  -.07518796622753143 1994    .68  -.92  1.68 .27 39                    .                       .                      .                      .           .             .             .         .         0
    10026 12569  41   -.1869918704032898 1994    .58 -2.01    .2 .31 40                    .                       .                      .                      .           .             .             .         .         0
    10026 12599  42  .009999999776482582 1994  -3.03  -.45  1.69 .31 41                    .                       .                      .                      .           .             .             .         .         0
    10026 12628  43                    0 1994   2.82 -1.72   .62 .28 42                    .                       .                      .                      .           .             .             .         .         0
    10026 12661  44  .019801979884505272 1994   4.01  1.34 -2.81 .37 43                    .                       .                      .                      .           .             .             .         .         0
    10026 12691  45 -.009708737954497337 1994  -2.31  2.83 -1.91 .37 44                    .                       .                      .                      .           .             .             .         .         0
    10026 12722  46   -.0882352963089943 1994   1.34 -2.35 -1.74 .38 45                    .                       .                      .                      .           .             .             .         .         0
    10026 12752  47   .05376344174146652 1994  -4.04   .26  -.94 .37 46                    .                       .                      .                      .           .             .             .         .         0
    10026 12782  48 -.051020409911870956 1994    .86   .04   .54 .44 47                    .                       .                      .                      .           .             .             .         .         0
    10026 12814  49  -.07526881992816925 1995    1.8 -2.65   .81 .42 48                    .                       .                      .                      .           .             .             .         . .50427437
    10026 12842  50     .075581394135952 1995   3.63  -.67  1.09  .4 49                    .                       .                      .                      .           .             .             .         . .50427437
    10026 12873  51  -.10270269960165024 1995   2.19  -.69  -1.1 .46 50                    .                       .                      .                      .           .             .             .         . .50427437
    10026 12901  52   .14457830786705017 1995   2.11  -.63  2.27 .44 51                    .                       .                      .                      .           .             .             .         . .50427437
    10026 12934  53  .021052632480859756 1995    2.9 -2.21  1.72 .54 52                    .                       .                      .                      .           .             .             .         . .50427437
    10026 12964  54   .04123711213469505 1995   2.72  2.93 -2.28 .47 53                    .                       .                      .                      .           .             .             .         . .50427437
    10026 12995  55  -.06930693238973618 1995   3.72  2.09 -1.67 .45 54                    .                       .                      .                      .           .             .             .         . .50427437
    10026 13026  56  .042553190141916275 1995    .55  1.59  2.71 .47 55                    .                       .                      .                      .           .             .             .         . .50427437
    10026 13055  57 -.040816325694322586 1995   3.35 -2.11  -.75 .43 56                    .                       .                      .                      .           .             .             .         . .50427437
    10026 13087  58  -.05319149047136307 1995  -1.52 -3.75  -.74 .47 57                    .                       .                      .                      .           .             .             .         . .50427437
    10026 13117  59   .10112359374761581 1995   3.96 -1.17   .95 .42 58                    .                       .                      .                      .           .             .             .         . .50427437
    10026 13146  60  -.10204081982374191 1995   1.03   .58   .87 .49 59  .011446257996319266    .0031083488575380336   .0007837813901823772 -.00017117708573134022  .011789645   .0018028422   .0006818898 .50427437 .50427437
    10026 13179  61   .09090909361839294 1996   2.26 -2.62    .3 .43 60   .01141655651937715     .002967164165872884   .0006055615597711293  -.0019491555659077921   .02580142    -.00777397   .0001816685  .4482091   5.21823
    10026 13208  62 -.010416666977107525 1996   1.33  1.88 -1.42 .39 60  .011900308081964553     .002763905517556863   .0003414133385293526 -.00025384844357286343   .01582741    .005196142  -.0004848069  .4105387   5.21823
    10026 13237  63                    0 1996    .73  1.31  1.01 .39 60  .007687146241300398   -.0012732620443929611  -.0005641615953833017   -.000563244623076835  .005611617  -.0016679732 -.00056980323  .3933738   5.21823
    10026 13269  64  .031578946858644485 1996   2.06  4.91 -3.91 .46 60  .007529811550781114    -.001830991260804364  -.0004555116839428207  -.0011657622466918014   .01551141   -.008990167   .0017810507  .4683023   5.21823
    10026 13300  65    .0714285746216774 1996   2.36  3.05  -1.2 .42 60    .0079407465432455   -.0018103854215813886   -.001229417435213649  -.0040901289992197176   .01874016   -.005521676    .001475301  .4346938   5.21823
    10026 13328  66  -.12380952388048172 1996  -1.14 -3.58  1.56  .4 60  .008528617858535856   -.0014406584047278966  -.0014911112030403912  -.0023809649517397722 -.009722624    .005157557  -.0023261334  .3931088   5.21823
    10026 13361  67  -.11413043737411499 1996  -5.97 -3.84  4.45 .45 60  .010950893763645197 -.000036063405052529525  -.0010928401485301793    -.00905351148931477  -.06537683  .00013848348   -.004863138  .3798985   5.21823
    10026 13391  68 .0061349691823124886 1996   2.77   2.3  -.46 .41 60  .011317748034082701    .0003493341034354797  -.0011856636247659256    -.01015029636184068  .031350162   .0008034684  .00054540526 .44269904   5.21823
    10026 13422  69   .04878048598766327 1996   5.01  -.88 -3.15 .44 60  .011489058119879785    .0005700755382551095  -.0013789715986972436   -.008938277046662259   .05756018 -.00050166645   .0043437607 .50140226   5.21823
    10026 13453  70  .023255813866853714 1996    .86 -4.44  5.12 .42 60  .011658735162414474    .0004988506544728838  -.0011809599963711376   -.009664512139540274  .010026513   -.002214897   -.006046515  .4217651   5.21823
    10026 13482  71                    0 1996   6.25 -3.89  1.16 .41 60  .011786612659324326   .00039690356457086954  -.0010769792844097057   -.007566547962950346   .07366633   -.001543955   -.001249296  .4808731   5.21823
    10026 13514  72   .22727273404598236 1996   -1.7   3.2   .89 .46 60  .011219465357253846      .00106821132613723  -.0011006322324798314    -.00820967580915348  -.01907309    .003418276  -.0009795626  .4433656   5.21823
    10026 13545  73  -.03703703731298447 1997   4.98 -1.84 -1.65 .45 60    .0076026139279346     .004133372557213107 -.00009013771381250087   -.002937093672833596   .03786102   -.007605406  .00014872722  .4804043  5.417622
    10026 13573  74 -.004807692486792803 1997   -.49  -2.9   5.2 .39 60 .0072888819067101875     .014147528188169979    .007218145173153877   -.003178988902958861 -.003571552    -.04102783     .03753435   .382935  5.417622
    10026 13604  75 -.014492753893136978 1997  -5.02  -.38  3.81 .43 60   .00822528484509296     .016210580744074055    .010791101857272107  -.0037914964087542302  -.04129093   -.006160021      .0411141  .4236631  5.417622
    10026 13634  76                    0 1997   4.04 -5.65  -.07 .43 60  .008598203322921504     .016092811849285245    .010372286211103494   -.004782104727757051   .03473674     -.0909244    -.00072606  .3730863  5.417622
    10026 13664  77   .11764705926179886 1997   6.74  4.89 -3.87 .49 60  .008792893989605711     .015567131985001415    .009501344270253377    -.00437628726046675    .0592641     .07612327   -.036770202  .5886172  5.417622
    10026 13695  78   .07894736528396606 1997    4.1  1.33  1.23 .37 60  .009027231813392806      .01590567580172512    .009505501431766018    -.00392141456528047   .03701165     .02115455    .011691767   .439858  5.417622
    10026 13726  79  .024390242993831635 1997   7.33  -2.8   .82 .43 60  .008451853366378093     .015213053258285246    .010019612082444994   -.001391448185985307   .06195208    -.04259655    .008216082  .4575716  5.417622
    10026 13755  80  -.01587301678955555 1997  -4.15  7.31  1.38 .41 60  .008388208804159199     .015244734234995989    .010029202709099341   -.001476808380188186  -.03481107       .111439      .0138403 .50046825  5.417622
    10026 13787  81   .04838709533214569 1997   5.35  2.61   .01 .44 60  .009825254035005768     .013310332592056901    .009817734347560427   -.005714941567701748   .05256511    .034739967  .00009817734 .52740324  5.417622
    10026 13818  82   .04615384712815285 1997   -3.8  -.68  1.95 .42 60  .009401765847729109     .013037602862270936     .00932731768750297    -.00382576671540542  -.03572671    -.00886557     .01818827   .393596  5.417622
    10026 13846  83 -.022058824077248573 1997   2.98 -4.95   .79 .39 60  .008462178030529215      .01298676259084703    .008596374054801691  .00009111926405636767   .02521729    -.06428447    .006791136 .35772395  5.417622
    10026 13879  84 -.015037594363093376 1997   1.32 -2.35  3.45 .48 60   .00767323133133011     .011553202790176857    .008497483325831196  -.0011324868901720388  .010128666   -.027150026     .02931632  .4922949  5.417622
    10026 13909  85  -.12977099418640137 1998    .15 -1.16 -1.45 .43 60  .008432652745646118     .013249059907109792      .0105114580691476  -.0003319728418594674  .001264898    -.01536891   -.015241615  .4006544 4.6049457
    10026 13937  86   .09649122506380081 1998   7.04     0  -.13 .39 60  .009679829145056329      .01530102908887609    .014174554010816803   -.003626232315944637     .068146             0   -.001842692  .4563033 4.6049457
    10026 13969  87   .25200000405311584 1998   4.76  -.93  1.05 .39 60   .00992897214478818      .01537481895289052    .013535235197958824  -.0036411039628239297   .04726191   -.014298582    .014211996  .4371753 4.6049457
    10026 13999  88  -.00319488812237978 1998    .73    .2   .74 .43 60  .011079744984311066     .015113591077757081    .014139403395187693   -.004235085918772419  .008088214    .003022718    .010463159  .4515741 4.6049457
    10026 14028  89 -.009615384973585606 1998  -3.07 -3.74  4.16  .4 60  .012434543834965582     .015058242565961697     .01293565080603436   -.009422668601833764  -.03817405    -.05631783     .05381231  .3593204 4.6049457
    10026 14060  90   .08090614527463913 1998   3.18 -3.16 -2.33 .41 60   .01227249254358975     .014821326011025208      .0141162450830164    -.01002398609141457   .03902653    -.04683539    -.03289085  .3693003 4.6049457
    10026 14091  91  -.07784431427717209 1998  -2.46 -5.12  -.96  .4 60  .011875289263169104     .012738680302744899    .010479468771873066   -.008216211789862399  -.02921321    -.06522204    -.01006029 .29550445 4.6049457
    10026 14122  92   -.1818181872367859 1998 -16.08 -5.31   3.4 .43 60  .011474942846727836     .012055990030511035     .00957861893172194   -.007309859488132307   -.1845171     -.0640173    .032567304  .2140329 4.6049457
    10026 14152  93    .1746031790971756 1998   6.15  -.14 -3.31 .46 60  .010373365855938203     .011557784845239817     .00927005949250417   -.007178185350153804    .0637962    -.00161809   -.030683896  .4914942 4.6049457
    10026 14182  94   .21621622145175934 1998   7.13 -3.29 -2.21 .32 60  .010599836986073372     .011852870833005442    .007237313324441011  -.0023769650189052723   .07557684    -.03899594   -.015994463  .3405864 4.6049457
    10026 14213  95  -.07222222536802292 1998    6.1  1.07 -3.15 .31 60  .011615376347231513      .00976441323594587    .005602760197684415   -.002002426278449248   .07085379    .010447923   -.017648695   .373653 4.6049457
    10026 14244  96     .071856290102005 1998   6.16  -.35 -4.46 .38 60  .011083616097553841     .009593069876276507    .006630169213786634  -.0033149719985044856   .06827507   -.003357574   -.029570555 .41534695 4.6049457
    10026 14273  97   .08379888534545898 1999    3.5   .37 -4.03 .35 60   .01097009973453511     .008733551926613651    .005374829835790114   -.004846160989898674   .03839535   .0032314144   -.021660564  .3699662 4.7597466
    10026 14301  98  -.12886597216129303 1999  -4.08 -5.67   1.4 .35 60  .011523481211702859     .009301770918655345   .0061530297213067625  -.0017018709672941956   -.0470158    -.05274104    .008614241  .2588574 4.7597466
    10026 14334  99 -.047337278723716736 1999   3.45 -3.93 -2.65 .43 60  .012140977552255948     .009330856072121621     .00686896805546518   -.004129815266759631   .04188637   -.036670264   -.018202767 .41701335 4.7597466
    10026 14364 100   .08074533939361572 1999   4.33     4  2.53 .37 60  .011664151151841606      .00969045683031407    .007108625775940371   -.002520592684405517   .05050577     .03876183    .017984822  .4772524 4.7597466
    end
    format %d date


    the ce i got is the expected monthly return through 3-factor model. Now, i want to convert this variable into annual returns as i need the cost of equity on annual basis to merge it with another file. Problem is i donot know how to do it because of the following:
    1. Fama and french factors (mktrf smb hml rf) are montly returns (this is what i understand) so the returns that i got are monthly (i beleive), then if i have to calculate the annual returns i should add these monthy returns, so


    Code:
    bys permno year: egen returns=total(ce)
    Otherwise, if i have to calculate cumulative returns then I did this


    Code:
    bys permno : asrol ce, stat(product) add(1) window(month 12) gen(ce_cum)
    However, the results I get from these two are much higher to be the cost of equity capital and much different from the ce i calculated.

    I do not know if I applied the rangestat correctly, or which method is the right one and if there is a mistake in my calculations. Any help in this regard is much appreciated.


    regards,




  • #2
    Thank you for providing code and sample data.

    I'm afraid this is more a question of what is correct in financial research that it is a Stata question. It looks to me like you're adding things up in one case and multiplying them in another. Note this is my guess from looking at the statement, asrol is user written and I don't use it.

    Another way to do it would be to make sure you XT set your data, and then you can simply write out the multiplication over the 12 months of lags or the addition over those lags with an if statement so it only does it at the end of the fiscal year.

    Comment


    • #3
      Thank alot Phil Bromiley, I got it fixed. The problem was in the dataset. mktrf smb hml rf were all in basis points which was causing huge differences in results. Further, addition command is relevant here. I donot have to make it cumulative (so asrol one is not useful anymore for me).

      Comment

      Working...
      X