Announcement

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

  • #16
    Attaullah Shah unfortunately, I can't share the data but this is the code:

    Code:
     generate icc_ct_=.
      mata
      z=J(1,1,.)
      st_view(z,., "icc_ct_ price bv_t0 feps_t1 feps_t2 feps_t3 feps_t4 feps_t5 growth payoutratio")
      function y(x,p,b0,f1,f2,f3,f4,f5,g,dv) {
          tf = f1+f2+f3+f4
          t1 = (f1-x*b0)/(1+x)
          t2 = (f2-x*(b0+f1*(1-dv)))/(1+x)^2
          t3 = (f3-x*(b0+(1-dv)*(f1+f2)))/(1+x)^3
          t4 = (f4-x*(b0+(1-dv)*(f1+f2+f3)))/(1+x)^4
          t5 = (f5-x*(b0+(1-dv)*tf))/(1+x)^5
          tv = ((f5-x*(b0+(1-dv)*tf))*(1+g))/((x-g)*(1+x)^5)
          return(-p+b0+t1+t2+t3+t4+t5+tv)
      }
      for (i=1;i<=rows(z);i++) {
          r=mm_root(icc_ct_=.,&y(),smallestdouble(),z[i,9]-epsilon(1),1e-9,1000,z[i,2],z[i,3],z[i,4],z[i,5],z[i,6],z[i,7],z[i,8],z[i,9],z[i,10])
          z[i,1]=icc_ct_
      }
      end
      
      
      generate icc_ct=.
      mata
      z=J(1,1,.)
      st_view(z,., "icc_ct price bv_t0 feps_t1 feps_t2 feps_t3 feps_t4 feps_t5 growth payoutratio")
      function s(x,p,b0,f1,f2,f3,f4,f5,g,dv) {
          tf = f1+f2+f3+f4
          t1 = (f1-x*b0)/(1+x)
          t2 = (f2-x*(b0+f1*(1-dv)))/(1+x)^2
          t3 = (f3-x*(b0+(1-dv)*(f1+f2)))/(1+x)^3
          t4 = (f4-x*(b0+(1-dv)*(f1+f2+f3)))/(1+x)^4
          t5 = (f5-x*(b0+(1-dv)*tf))/(1+x)^5
          tv = ((f5-x*(b0+(1-dv)*tf))*(1+g))/((x-g)*(1+x)^5)
          return(-p+b0+t1+t2+t3+t4+t5+tv)
      }
      for (i=1;i<=rows(z);i++) {
          r=mm_root(icc_ct=.,&s(),z[i,9]+epsilon(1),1-epsilon(1),1e-9,1000,z[i,2],z[i,3],z[i,4],z[i,5],z[i,6],z[i,7],z[i,8],z[i,9],z[i,10])
          z[i,1]=icc_ct
      }
      end
    And then I merged icc_ct_ and icc_ct. I still have to verify, whether I did it correctly, so I better don't post that part of the code

    Comment


    • #17
      Hua Peng (StataCorp) I just noticed that I was replied. Thank you for your explanation. I made a mistake, thinking tolerance is the initial value. Now I know better about this function.

      Comment


      • #18
        Julia Schmidt I understand that you cannot share actual data, but can you share a dummy data set that has all the variables where the code and be seen working on them.
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        www.FinTechProfessor.com
        If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

        Comment


        • #19
          Attaullah Shah Sorry, I just saw your response. Below you find a small fraction of my data sample. I finally merged the two icc_ct measures by replacing icc_ct with icc_ct_ when icc_ct=1. Hopefully that makes sense
          Attached Files
          Last edited by Julia Schmidt; 10 Oct 2015, 03:44.

          Comment


          • #20
            Paul Demere I have the problem at the moment, that my GSL_ICC is negatively correlated with all other return proxies and realized return.
            So I have some questions to your approach to find my mistake: Are fore1, fore2, ... the earnings forecasts and the indmedroe the 12-year industry median return on equity? Also, is dvrate the payoutratio or the retention rate? Thanks a lot for your help

            Comment


            • #21
              Dear Statalist,
              I am doing research about implied cost of capital based on model of Gebhardt, Lee, Swaminathan (2001). I used the code of Paul Demere and make some modifications based on article of "A review of the literature on methods of computing the implied cost of capital - Echterling 2015". However, it does not work.
              Could you please help me?
              Here are the code:

              **Generate ROEt from 4 to 11
              gen bv2=bve+(feps1+feps2)*dpo_n //book value @t2
              gen froe3 = feps3_n/bv2
              label variable froe3 "gen froe3 = feps3_n/bv2"

              gen froe4 = (roe_w_m3_n - froe3)/9+froe3
              gen froe5 = (roe_w_m3_n - froe4)/9+froe4
              gen froe6 = (roe_w_m3_n - froe5)/9+froe5
              gen froe7 = (roe_w_m3_n - froe6)/9+froe6
              gen froe8 = (roe_w_m3_n - froe7)/9+froe7
              gen froe9 = (roe_w_m3_n - froe8)/9+froe8
              gen froe10 = (roe_w_m3_n - froe9)/9+froe9
              gen froe11 = (roe_w_m3_n - froe10)/9+froe10

              **
              // feps = forecast earning per share
              // froe = forecast ROE
              // bv = book value
              // feps = froe*bv_(t-1)

              cap drop glsicc
              g glsicc=.
              mata
              mata clear
              z=(1,1,.)
              st_view(z,.,"glsicc pco bve feps1 feps2 feps3_n roe_w_m3_n #delim;
              froe4 froe5 froe6 froe7 froe8 froe9 froe10 froe11 dpo_n")
              function w(x,p,b0,f1,f2,f3,ii,f4,f5,f6,f7,f8,f9,f10,f11,dv) {
              tf = f1+f2+f3+f4
              fi = f5-ii
              t1 = (f1-x*b0)/(1+x)
              t2 = (f2-x*(b0+f1*(1-dv)))/(1+x)^2

              t3 = (f3-x*(b0+(1-dv)*(f1+f2)))/(1+x)^3

              t4 = ((f4-x)*(b0+(1-dv)*(f1+f2+f3)))/(1+x)^4
              t5 = ((f5-x)*(b0+(1-dv)*tf))/(1+x)^5
              t6 = ((f6-x)*(b0+(1-dv)*(tf+f5)))/(1+x)^6
              t7 = ((f7-x)*(b0+(1-dv)*(tf+f5+f6)))/(1+x)^7
              t8 = ((f8-x)*(b0+(1-dv)*(tf+f5+f6+f7)))/(1+x)^8
              t9 = ((f9-x)*(b0+(1-dv)*(tf+f5+f6+f7+f8)))/(1+x)^9
              t10 = ((f10-x)*(b0+(1-dv)*(tf+f5+f6+f7+f8+f9)))/(1+x)^10
              t11 = ((f11-x)*(b0+(1-dv)*(tf+f5+f6+f7+f8+f9+f10)))/(1+x)^11
              tv = ((ii-x)*(b0+(1-dv)*(tf+f5+f6+f7+f8+f9+f10+f11)))/(x*(1+x)^12)

              return(-p+b0+t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+tv)
              }
              for (i=1;i<=rows(z);i++) {
              r=mm_root(glsicc=.,&w(),smallestdouble(),1-epsilon(1),1e-9,1000, #delim;
              z[i,2],z[i,3],z[i,4],z[i,5],z[i,6],z[i,7],z[i,9],z[i,10],z[i,11],z[i,12])
              z[i,1]= glsicc
              }
              end
              drop if missing(t)

              Comment


              • #22
                Hello Julia Schmidt and david tran ,
                I'm sorry for the late reply Julia, but it turns out I was not receiving emails from StataList (hopefully my settings are fixed going forward).

                You appear to have hit upon the exact issue I ran into with the Claus and Thomas (2001) implied cost of equity capital measure, in that there is a discontinuity in the price function around the growth rate. I modified my code similarly to yours, and recommend anyone interested in coding the Claus and Thomas (2001) measure refer to Julia's earlier post.

                As to your most recent inquiry, fore1 through fore5 are the year 1 through year 5, respectively, earnings forecasts from the RI model in Li and Mohanram (2014). Indmedroe is the 12-year industry median return on equity (I computed it based on 3-digit NAICS codes, but other industry definitions would be reasonable). Dvrate is the retention rate, or (1 - d/e), where d/e is total dividends divided by total earnings. Additionally, to correct for extreme dividend events, coding mistakes, and outliers, I replaced d/e with 0 when it was negative and 1 when it was greater than 1.

                David, the reason your code is not working lies in the line: "function w(x,p,b0,f1,f2,f3,ii,f4,f5,f6,f7,f8,f9,f10,f11,dv) ". mm_root only accepts 10 inputs at most from a function command (due to the coding of mm_root). I recommend creating froe4 through froe 11 within the function itself, so only 8 inputs will be needed.

                Comment


                • #23
                  Many thanks Paul Demere for your suggestions.
                  Julia Schmidt : I tried your lastest code using CT(2001) model with my data, however, the results obtained seem to be illogical (~21%) whereas I used the code of Paul Demere, it works and the result is reasonnable (~10%). Have you the same problem?

                  Comment


                  • #24
                    @ Julia Schmidt Could you please share the code of the Claus and Thomas ICC calculation? Would appreciate it a lot! Best, Mertin
                    Last edited by Mertin Cimen; 17 May 2016, 14:34. Reason: Apologies: I obviously missed the second page of this threat (still new to statalist.org and forums in general)

                    Comment


                    • #25
                      Julia Schmidt and Paul Demere:

                      I am doing a similar work using a combination of different ICC measures (as applied in "Hann, Ogneva, Ozbas (2013) - Corporate Diversification and the Cost of Capital" or "Hail, Leuz (2009) - Cost of capital effects and changes in growth expectations around U.S. cross-listings").
                      Since I have very few experience using Stata, your posts on the Claus, Thomas (2001) measure and the Gebhardt, Lee, Swaminathan (2001) measure really helped me to understand the calculations.

                      Maybe you used a comparable approach and could post your do files for the Easton (2004) and the Ohlson, Nauroth-Juettner (2005) measure as well.

                      This would essentially support my understanding and every help would be appreciated. Thank you very much!

                      Comment


                      • #26
                        Julia Schmidt Thank you for the sample data and code. However, several error messages incurred when I run the code using the sample data. The first error message happens after "return(-p+b0+t1+t2+t3+t4+t5+tv)". The error says "'return' found where almost anything else expected". As far as I understand, it means there is no solution for the function? However, I was expecting multiple solutions for the function, as mentioned in Claus and Thomas (2001). Can anyone help? Thank you so much in advance!

                        Comment


                        • #27
                          Paul Demere Hi Paul, thank you for the posts! I am an accounting PhD student. I have tried Julia's code for cost of equity following Claus and Thomas (2001) and sample data but I find several errors with the code. Could you please look at the code and give suggestions? I see you are a professor in accounting. Thanks for all the discussions!

                          Comment


                          • #28
                            Originally posted by Hua Peng (StataCorp) View Post
                            In your function, the last term is

                            Code:
                            tv = ((f5-x*(b0+(1-dv)*tf))*(1+g)/((x-g)*(1+x)^5)
                            which means the function is not defined when x = g, i.e., at the value of the growth variable. In Paul's version, the function is not defined at x=0. Hence you might need try the bounds from smallestdouble() to z[i,9]-epsilon(1); and z[i,9]+epsilon(1) to 1 if the value of growth variable is between 0 and 1.
                            Hua Peng (StataCorp) Hi Hua, thank you so much for the posts! I tried Julia's code, but it is not working. It seems like there is issue with the bounds. Do you mean the code should be changed to "
                            r=mm_root(icc_ct=.,&y(), z[i,9]-epsilon(1),z[i,9]+epsilon(1),1000,z[i,2],z[i,3],z[i,4],z[i,5],z[i,6],z[i,7],z[i,8],z[i,9],z[i,10]) z[i,1]=icc_ct } end"? Thanks again!

                            Comment


                            • #29
                              Hello Amanda Brown,
                              I believe the issue is with the bounds you have provided to the mm_root function. Right now, the search interval you've given the function is [z[i,9]-epsilon(1), z[i,9]+epsilon(1)], which means that the function can only search for a solution that is equal to the growth rate (which is also the very point where the function is undefined).

                              To correct this issue, try instead the bounds [z[i,9]+epsilon(1),1-epsilon(1)]. This will allow the function to search for a solution where the cost of equity capital is greater than the risk-free growth rate (which it should be) but less than 1 (because a 100% cost of capital is more than a little extreme). This will make the code (where I've used v instead of z for naming):

                              Code:
                              rc=mm_root(cticc=.,&y(),v[i,9]+epsilon(1),1-epsilon(1),1e-9,1000,v[i,2],v[i,3],v[i,4],v[i,5],v[i,6],v[i,7],v[i,8],v[i,9],v[i,10])
                              Good luck!

                              Comment


                              • #30
                                hi everyone,

                                I am doing a similar project as Julia Schmidt, where I am estimating the implied cost of equity using the model by Claus and Thomas (2001), but rather using Li and Mohanram's (2014) regression model than analyst forecasts to estimate future earnings.

                                I have got the code to find the implied cost of equity up and running, and I was able to solve the mm_root issue thanks to Paul Demere.
                                However, as many regressions are needed in order to forecast the earnings, could someone help me with a complementary code which is able to do all those regressions?

                                Thank you in advance.

                                Comment

                                Working...
                                X