Announcement

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

  • Cost of equity: st-view do not generate results

    Hi everyone,

    I'm running code using Mata, however, I don't understand why Mata do not generate the results for all of my observations.

    In fact, as you can see in the data I provide below, the gls variable has only one observation whereas it should have 5 in total. I tried to do manually by Excel for year==2008, and I have the result (gls)

    many thanks for your help!


    Here is my code and a sub-sample:

    Code:
        cap drop gls
        gen gls=.
        
        mata
        mata clear
        z=(1,1,.)
        
        st_view(z,.,"gls price_ibes_w bveps_comp_w feps1_pos_w feps2_pos_w ltg_pos roe_ind_mov dpo_comp") 
        function w(x,p,b0,f1_,f2_,g,ii,dv) {
            disc = (1+x)^(-10/12) //discount factor from month+10 to present
            k = 1 - dv
            
            f1=f1_ *disc
            f2=f2_ *disc
            f3=f2*(1+g)  
            tf3 = f1+f2+f3
            
            b1=b0+f1*k
            b2=b0+(f1+f2)*k
            b3=b0+tf3*k
            
            fr3 = f3/b2
            con = (fr3-ii)/9
                    
            fr4=fr3-con
            
            fr5=fr4-con
            fr6=fr4-2*con
            fr7=fr4-3*con
            fr8=fr4-4*con
            fr9=fr4-5*con
            fr10=fr4-6*con
            fr11=fr4-7*con
            fr12=fr4-8*con
                
            f4=fr4*b3
            tf4=tf3+f4
            b4=b0+tf4*k
            
            f5=fr5*b4
            tf5=tf4+f5
            b5=b0+tf5*k
            
            f6=fr6*b5
            tf6=tf5+f6
            b6=b0+tf6*k
            
            f7=fr7*b6
            tf7=tf6+f7
            b7=b0+tf7*k
            
            f8=fr8*b7
            tf8=tf7+f8
            b8=b0+tf8*k
            
            f9=fr9*b8
            tf9=tf8+f9
            b9=b0+tf9*k
                
            f10=fr10*b9
            tf10=tf9+f10
            b10=b0+tf10*k
            
            f11=fr11*b10
            tf11=tf10+f11
            b11=b0+tf11*k
            
            f12=fr12*b11
                
            t1 = (f1-x*b0)/(1+x)
            t2 = (f2-x*b1)/(1+x)^2
            t3 = (f3-x*b2)/(1+x)^3
            t4 = (f4-x*b3)/(1+x)^4
            t5 = (f5-x*b4)/(1+x)^5
            t6 = (f6-x*b5)/(1+x)^6
            t7 = (f7-x*b6)/(1+x)^7
            t8 = (f8-x*b7)/(1+x)^8
            t9 = (f9-x*b8)/(1+x)^9
            t10 = (f10-x*b9)/(1+x)^10
            t11= (f11-x*b10)/(1+x)^11
            t12= (f12-x*b11)/(1+x)^12
            tv= t12/x
                
            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(gls=.,&w(),smallestdouble(),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,1]= gls
            }
            
        end
        
        drop if missing(t)
        sum gls
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double year float(roe_ind_mov dpo_comp ltg_pos id feps1_pos_w feps2_pos_w) double price_ibes_w float(bveps_comp_w gls)
    2006 .13732198  .01957673   . 3 .47 .53 15.84  7.386957         .
    2007 .13418032   .0301397 .12 3 .31 .36   9.7  7.713243         .
    2008 .12149094 .015837386 .12 3 .33 .36   9.8 11.033774         .
    2009 .10040423 .018786145 .12 3   . .18   7.8 10.937116         .
    2010  .0818014 .018717727 .12 3 .34 .39 10.73 10.956161 .06888516
    end

  • #2
    Is it possible your function returns a missing for some value? AFAIK that's the only reason mm_root returns a missing if rc = 0.

    Code:
     mm_root() stores the found solution in x and issues return code rc. Possible return codes are: 0: everything went well
     x will be set to missing if f evaluates to missing at some point in the algorithm.

    Comment


    • #3
      Thanks Jesse Wursten for your answer,
      I read the help file of -mm_root()-, and see this diagnostics of the authors.
      So that I tried to do manually with Excel, but I still have solution with Excel.

      Comment


      • #4
        Hi David.
        st_view Mata command is supposed to send your dataset (or a subset of the dataset) to a Mata matrix, but unlike st_data, the Mata matrix is a view, so it does not use more memory space. Also, if you modify the Mata matrix view, then your dataset will also change since the matrix is a view of the dataset.
        I think it is not necessary to assign initial values to the Mata matrix before st_view, since the Mata matrix will have the shape (#rows and #columns) of the view from your Stata dataset. But you need to define the Mata matrix.
        I assume that you have a Stata dataset with 5 rows with the variables: price_ibes_w bveps_comp_w feps1_pos_w feps2_pos_w ltg_pos roe_ind_mov dpo_com.
        Try this at the beginning of your code:
        cap drop gls gen gls=. mata mata clear real matrix z st_view(z,.,"gls price_ibes_w bveps_comp_w feps1_pos_w feps2_pos_w ltg_pos roe_ind_mov dpo_comp") I am not sure if this will work since I do not know what is the content of your dataset. But it is a try.
        Regards... Alberto

        Comment


        • #5
          Hi Alberto,
          Thanks for your help,
          I tried your code, but it returns error r(3499): <istmt>: 3499 z not found
          To make sure, I re-post your code as below:

          Code:
          cap drop gls
          gen gls=.
          mata
          mata clear
          real matrix z
          st_view(z,.,"gls price_ibes_w bveps_comp_w feps1_pos_w feps2_pos_w ltg_pos roe_ind_mov dpo_comp") 
          
          ...

          Comment


          • #6
            I have defined Mata matrix in Mata functions. Here you have a Mata code inside Stata code. Try this:
            Code:

            cap drop gls
            gen gls=.
            mata
            mata clear
            st_view(z=0,.,"gls price_ibes_w bveps_comp_w feps1_pos_w feps2_pos_w ltg_pos roe_ind_mov dpo_comp")
            end

            * Return to Stata to see the content of the Mata matrix z:
            mata: z

            Comment


            • #7
              I tried your code, and have the exactly same results with my old code.

              P/S: Alberto, when you want to post a code, you can use the "#" icon in the bar above.

              Comment


              • #8
                I tried in my Stata and have no error.
                Check the setup of Mata. Type:
                Code:
                mata: mata query
                If the option matastrict is on, set it to off with the command:
                Code:
                mata set matastrict on
                Thanks for the tip !!

                Comment


                • #9
                  I verified mata's setup, and the matastrict is off.

                  However, I just realize that my Stata do not change the memory. That is, I tried to create new variable bveps_bhc_w to replace bveps_comp_w , and re-run code, and I get the same gls (that I denoted gls_comp and gls_bhc)

                  I think that is the reason why when I run your code, it still yield the same result as my old code.

                  I tried to restart Stata and re-install moremata, but the problem still exists.

                  Below is the sub-sample of my data, could you please run the code and tell me the -summary- of gls? (To see whether it is different from my result)

                  Code:
                  * Example generated by -dataex-. To install: ssc install dataex
                  clear
                  input double year float(roe_ind_mov dpo_comp ltg_pos id feps1_pos_w feps2_pos_w) double price_ibes_w float(bveps_comp_w bveps_bhc_w gls_bhc gls_comp)
                  1995   .1639044   .0290312         .  5   .68   .73    7.7 12.107356   .4348106         .         .
                  1998  .14827234   .0391032       .12  5   .51   .71   8.36  9.396525   .7008475         .         .
                  1999  .14602873  .04032909       .12  5    .8   .85   8.86  9.904039   .7012394         .         .
                  2000  .14370517  .04009682       .12  5   .93  1.01   7.19  8.713434   .8756617         .         .
                  2002  .14263959  .01524753       .08  5   .93  1.15  10.74 10.415842   .8874815         .         .
                  2003  .14509423  .04399725         .  5    .9   .93  13.74 11.000307   .8966946         .         .
                  2004  .14193586  .04466918         .  5  1.06  1.16  16.01 11.612122   .8986996         .         .
                  2005  .14129433  .04529556         .  5  1.14  1.29   17.7  12.61358   .8927869         .         .
                  2006  .13732198  .04569511         .  5  1.57   1.7  26.94 11.481084  1.0656362         .         .
                  2007  .13418032  .04077614       .09  5  1.59  1.78  18.06 13.212005  1.0665805         .         .
                  2008  .12149094  .03963942       .15  5    .9  1.15  11.64 14.124742  1.0662556         .         .
                  2009  .10040423 .027084395        .1  5     .   .11   6.84 14.062135  1.0646709         .         .
                  2010   .0818014 .009449014       .09  5     .   .51   9.57 10.515765   .6418201         .         .
                  2011 .074367836          0       .08  5   .31    .7   9.52  9.442467  1.0512075 .05522986 .05522986
                  2012   .0803541          0       .08  5   .55  1.02   12.5  10.23296  1.0532348 .06495317 .06495317
                  2013  .08887064          0       .08  5  1.02  1.59  17.93 10.561134  1.0521582         .         .
                  2014  .09617597          0 .13065326  5  1.63  1.99  23.51  11.50287   .9896402         .         .
                  2015  .09686614 .010971838 .12184872  5  1.38  2.38  27.65 13.671024   .8746389         .         .
                  1989          .  .04323725       .07  6   .35   .37   4.04 3.1911325 .035558704         .         .
                  1990  .15476103  .04399483       .06  6   .31   .33   2.73  6.039939   .4441169 .11581967 .11581967
                  1991   .1529801   .0458518       .06  6   .37   .42   2.73  5.861657   .4475701 .13044465 .13044465
                  1992  .14113805  .04154642       .08  6   .53   .58   4.93  7.087404  .50905085   .112107   .112107
                  1993  .14283152  .04079815       .08  6   .67   .73   9.96  6.543002    .528871         .         .
                  1994   .1573668  .05588651       .08  6   .72   .78   9.09  5.931684   .7272987         .         .
                  1995   .1639044  .05879331       .08  6   .72   .78  10.97  4.919993   .9091197         .         .
                  1996  .16002566  .05933319       .08  6   .86    .9   10.5   5.36275  1.1024054         .         .
                  1987          .  .04226936         .  7   .06    .8  15.75         .          .         .         .
                  1988          .  .04421152       .05  7   1.2  1.78   15.5         .          .         .         .
                  1989          .  .04323725       .05  7  1.18  1.74  17.25         .          .         .         .
                  1990  .15476103  .04399483         .  7   1.1  1.42  13.25         .          .         .         .
                  1991   .1529801   .0458518         .  7   1.7  1.95  22.75         .          .         .         .
                  2006  .13732198          0        .2  8   .94   1.2  17.34 10.104136          .         .         .
                  2008  .12149094          0         .  8     .     .   3.85  8.954964          .         .         .
                  2004  .14193586          0       .15  9   .47   .53   8.84  8.559448  .54661506         .         .
                  2005  .14129433 .007654442       .15  9   .67   .74  11.43 10.596732  .51301277         .         .
                  2006  .13732198 .016920174       .15  9   .71   .86  11.42  11.13723   .6600693         .         .
                  2007  .13418032 .025096243         .  9   .72   .83   12.5  7.857877  1.0067519         .         .
                  2008  .12149094  .02495187         .  9   .44   .57   8.27  8.308828   .9911585         .         .
                  2006  .13732198 .020534456         . 10   .43   .45     18  6.877646          .         .         .
                  2007  .13418032    .022484         . 10   .21   .22  14.12  6.768242          .         .         .
                  2008  .12149094  .02944124         . 10   .06     .    7.8   6.70094          .         .         .
                  2009  .10040423  .02544069         . 10     .     .    1.9  6.351464          .         .         .
                  2010   .0818014 .001574079         . 10     .     .   1.35  4.266601          .         .         .
                  2014  .09617597          0         . 10   .11   .25   3.88 4.2565284 .009994197         .         .
                  2015  .09686614          0         . 10   .57   .49   5.95  4.697753 .009994197         .         .
                  1986          .          .        .1 11  1.01  1.62  12.88         .          .         .         .
                  1987          .  .04226936       .12 11   .89  1.22   15.5         .   5.095608         .         .
                  1988          .  .04421152       .12 11     .   .76  10.63         .   5.216269         .         .
                  1989          .  .04323725       .15 11   .49   .79  12.13         .   5.243492         .         .
                  1990  .15476103  .04399483       .05 11   .84  1.09   8.88         .   5.265332         .         .
                  1991   .1529801   .0458518       .08 11  1.53  1.86  25.38         .   5.234665         .         .
                  1992  .14113805  .04154642        .1 11  2.74   3.2  32.13         .   5.113645         .         .
                  1996  .16002566  .03300782        .1 12  1.38   1.6   16.9         .          .         .         .
                  1997    .149597 .036003694       .11 12  1.73  1.94  31.13         .          .         .         .
                  1999  .14602873  .03680464       .13 13   1.9  2.13   28.5         .   5.852178         .         .
                  1986          .          .     .1861 14  6.97  9.54 106.51         .          .         .         .
                  1987          .  .04226936     .1651 14  9.38 11.63 130.42         .          .         .         .
                  1988          .  .04421152     .1595 14 10.73  11.9 112.93         .          .         .         .
                  1989          .  .04323725     .1558 14 12.88 14.07 172.98         .          .         .         .
                  1990  .15476103  .04399483     .1468 14 13.92 15.58 131.16         .          .         .         .
                  1991   .1529801   .0458518     .1486 14 14.97 16.77 171.19         .          .         .         .
                  1992  .14113805  .04154642     .1418 14 15.64 17.65  229.4         .          .         .         .
                  1993  .14283152  .04079815 .13939999 14 18.31 20.87 292.35         .          .         .         .
                  1994   .1573668 .031192403       .14 14 20.93 23.77 289.19         .          .         .         .
                  1995   .1639044 .032656513     .1384 14 24.37 27.45  355.6         .          .         .         .
                  1996  .16002566  .03300782     .1357 14 28.08 31.61  355.6         .          .         .         .
                  1997    .149597 .036003694     .1342 14 32.51 36.45  355.6         .          .         .         .
                  1998  .14827234  .03596664     .1359 14    33 36.45  355.6         .          .         .         .
                  1999  .14602873  .03680464     .1372 14    33 36.45  355.6         .          .         .         .
                  2000  .14370517  .03791192      .141 14    33 36.45  355.6         .          .         .         .
                  2001  .14417276  .04179756     .1525 14    33 36.45  355.6         .          .         .         .
                  2002  .14263959  .03785884     .1433 14    33 36.45  355.6         .          .         .         .
                  2003  .14509423  .03835852     .1447 14    33 36.45  355.6         .          .         .         .
                  2004  .14193586  .03870999     .1489 14    33 36.45  355.6         .          .         .         .
                  2005  .14129433  .03943819     .1318 14    33 36.45  355.6         .          .         .         .
                  2006  .13732198  .03802417     .1329 14    33 36.45  355.6         .          .         .         .
                  2007  .13418032 .036492813     .1257 14    33 36.45  355.6         .          .         .         .
                  2008  .12149094   .0351025      .135 14     . 36.45   48.6         .          .         .         .
                  2009  .10040423 .035037015       .15 14     .  5.83  44.41         .          .         .         .
                  2010   .0818014  .02189353         0 14   7.1  7.14  42.71         .          .         .         .
                  2011 .074367836 .018069053        .1 14  3.04  2.92  22.55         .          .         .         .
                  2012   .0803541 .017919252     .2013 14  4.39  3.51  36.86         .          .         .         .
                  2013  .08887064  .02181462     .1132 14  4.32  4.33  51.26         .          .         .         .
                  2014  .09617597 .021814346     .1007 14  4.65  4.99  49.69         .   3.340145         .         .
                  2015  .09686614  .02479884     .1051 14  4.91  5.48  58.03         .          .         .         .
                  1995   .1639044          0         . 15  1.25   1.4   12.5  8.658077  1.0017371         .         .
                  1996  .16002566          0      .095 15  1.49  1.63   16.5  8.966129   .9995388         .         .
                  1997    .149597  .02642126        .1 15  1.58   1.8  25.13  10.14904   .9824829         .         .
                  1998  .14827234  .03287962       .05 15   1.8     2  24.13 11.324352   .9384698         .         .
                  1999  .14602873  .04294886        .1 15  1.97  2.18  23.44 11.938845   .9835948         .         .
                  2000  .14370517  .05756031      .085 15  2.16  2.33  18.94 12.493674  1.0128565         .         .
                  2001  .14417276  .05717574       .09 15  2.35  2.55   31.2 14.701294   .9450076         .         .
                  2002  .14263959  .05292805     .1038 15  2.76     3   46.4 16.836964  1.0049337         .         .
                  2003  .14509423  .05271821     .1038 15  3.15  3.43  50.64 18.947317   .9697939         .         .
                  2004  .14193586  .05142475     .1113 15  3.34  3.73  59.24  21.76322   .7625015         .         .
                  2005  .14129433   .0382122     .1067 15  3.78   4.2  62.14  31.15142   .9981797         .         .
                  2006  .13732198  .04028475        .1 15  4.19  4.63  69.56 33.396343    .834259         .         .
                  2007  .13418032  .03294897       .09 15  4.03  4.38  78.19  41.51459  1.0089799         .         .
                  1999  .14602873  .01556905         . 16   .42   .45     15  8.529881          .         .         .
                  1992  .14113805  .04154642         . 17  1.08  1.25  10.52         .          .         .         .
                  1993  .14283152  .04079815        .1 17  1.45  1.59  18.12         .          .         .         .
                  end

                  Comment


                  • #10
                    I run your code and I got the following summarize of gls:
                    sum gls

                    Variable | Obs Mean Std. Dev. Min Max
                    -------------+--------------------------------------------------------
                    gls | 1 .0708295 . .0708295 .0708295

                    I think we got the same result...

                    Comment


                    • #11
                      Oh, I see. So even with your code, the problem still exists.

                      Comment


                      • #12
                        You can try to go through the mm_root command manually and see where it produces an error? help moremata_source##mm_root

                        Comment


                        • #13
                          Hello David Tranv,

                          Some quick ideas:
                          • I do not understand why you multiply your forecasts 1 and 2 by disc = (1+x)^(-10/12)...I would recommend simply using annual forecasts and not making this adjustment, as I suspect it is doing strange things to the optimization function and could very well be the source of your problems. Try simply taking f1 and f2 without multiplying by "disc", and see if that doesn't fix your problem.
                          • Also, perhaps try replacing the lines of code between the st_view and return functions and replacing it with the equivalent code I use in Post #6 from http://www.statalist.org/forums/foru...equity-capital. I haven't gone through all of your math, but if there is a typo using alternate code should reveal it.
                          • If you also do not get enough implied cost of capital observations due to data sparseness in analyst forecasts, consider using firm information to make the forecasts yourself, rather than relying on equity analyst forecasts. This often results in considerably less data attrition and firm-information-based forecasts can produce better implied cost of capital estimates. See Hou, van Dijk, and Zhang (2012, Journal of Accounting and Economics 53: 504-526) and Li and Mohanram (2014, Review of Accounting Studies 19:1152-1185), and particularly the Residual Income model from Li and Mohanram.

                          Comment


                          • #14
                            For observations 1 and 4 in your initial example some of the inputs are missing, hence also the output is missing. No surprise.

                            For observations 2 and 3 all inputs are ok, but still the output is missing. Why? If you plot the function you see that it goes off to infinity once x goes to zero. For observations 2 and 3, if you set y to smallestdouble() the function will evaluate to a number that is larger than what can be represented on your finite precision computer; hence: missing. For observation 5, the inputs are such that at x=smallestdouble() the function evaluates to a number that is also very large (7.0075e+307), but can still be represented on you computer (the largest possible number, I believe, is 8.9884656743*10^307). Hence: a solution is found in this case.

                            If you want to find a solution for obs 2 and 3 you need to use a larger value for the lower bound. Also, it is always a good idea to monitor the return code of mm_root() to make sure that the returned solution is not a boundary solution. For example, if you set the lower boundary too high, the return code will be equal to 2. You would then have to lower the boundary until a valid solution is found.

                            ben

                            Code:
                            clear all
                            mata
                            function w(x,p,b0,f1_,f2_,g,ii,dv) {
                                disc = (1+x)^(-10/12) //discount factor from month+10 to present
                                k = 1 - dv
                                
                                f1=f1_ *disc
                                f2=f2_ *disc
                                f3=f2*(1+g)  
                                tf3 = f1+f2+f3
                                
                                b1=b0+f1*k
                                b2=b0+(f1+f2)*k
                                b3=b0+tf3*k
                                
                                fr3 = f3/b2
                                con = (fr3-ii)/9
                                        
                                fr4=fr3-con
                                
                                fr5=fr4-con
                                fr6=fr4-2*con
                                fr7=fr4-3*con
                                fr8=fr4-4*con
                                fr9=fr4-5*con
                                fr10=fr4-6*con
                                fr11=fr4-7*con
                                fr12=fr4-8*con
                                    
                                f4=fr4*b3
                                tf4=tf3+f4
                                b4=b0+tf4*k
                                
                                f5=fr5*b4
                                tf5=tf4+f5
                                b5=b0+tf5*k
                                
                                f6=fr6*b5
                                tf6=tf5+f6
                                b6=b0+tf6*k
                                
                                f7=fr7*b6
                                tf7=tf6+f7
                                b7=b0+tf7*k
                                
                                f8=fr8*b7
                                tf8=tf7+f8
                                b8=b0+tf8*k
                                
                                f9=fr9*b8
                                tf9=tf8+f9
                                b9=b0+tf9*k
                                    
                                f10=fr10*b9
                                tf10=tf9+f10
                                b10=b0+tf10*k
                                
                                f11=fr11*b10
                                tf11=tf10+f11
                                b11=b0+tf11*k
                                
                                f12=fr12*b11
                                    
                                t1 = (f1-x*b0)/(1+x)
                                t2 = (f2-x*b1)/(1+x)^2
                                t3 = (f3-x*b2)/(1+x)^3
                                t4 = (f4-x*b3)/(1+x)^4
                                t5 = (f5-x*b4)/(1+x)^5
                                t6 = (f6-x*b5)/(1+x)^6
                                t7 = (f7-x*b6)/(1+x)^7
                                t8 = (f8-x*b7)/(1+x)^8
                                t9 = (f9-x*b8)/(1+x)^9
                                t10 = (f10-x*b9)/(1+x)^10
                                t11= (f11-x*b10)/(1+x)^11
                                t12= (f12-x*b11)/(1+x)^12
                                tv= t12/x
                                    
                                return(-p+b0+t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+tv)
                            }
                            end
                            
                            input year roe_ind_mov dpo_comp ltg_pos id feps1_pos_w feps2_pos_w price_ibes_w bveps_comp_w
                            2006 .13732198  .01957673   . 3 .47 .53 15.84  7.386957
                            2007 .13418032   .0301397 .12 3 .31 .36   9.7  7.713243
                            2008 .12149094 .015837386 .12 3 .33 .36   9.8 11.033774
                            2009 .10040423 .018786145 .12 3   . .18   7.8 10.937116
                            2010  .0818014 .018717727 .12 3 .34 .39 10.73 10.956161
                            end
                            gen gls=.
                            mata
                            st_view(z=.,.,"gls price_ibes_w bveps_comp_w feps1_pos_w feps2_pos_w ltg_pos roe_ind_mov dpo_comp")
                            for (i=1;i<=rows(z);i++) {
                                r=mm_root(gls=.,&w(),smallestdouble(),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,1]= gls
                                }
                            end
                            list
                            
                            mata
                            i = 2
                            x = rangen(smallestdouble(),1-epsilon(1),99)
                            y = J(rows(x),1,.)
                            for (j=1; j<=rows(x); j++) {
                                y[j] = w(x[j],z[i,2],z[i,3],z[i,4],z[i,5],z[i,6],z[i,7],z[i,8])
                            }
                            x,y
                            mm_plot((y,x))
                            end

                            Comment


                            • #15
                              Hi Paul Demere and Ben Jann,

                              Many thanks for your returns.

                              Paul Demere

                              1.I compute the discount rate (disc) as suggested in Hail & Leuz 2006 jar (footnote 7,p.491) (http://onlinelibrary.wiley.com/doi/1...209.x/abstract) since the IBES estimates are taken at t+10 months. But with my previous data (from which I can get result ICC), it did not change so much the results without discount rate.

                              2.Actually, I inspire your code, and try to detail in my own code. The difference is in my code, forecast earnings is computed by using linear interpolation after t+3 as in Gebhart et al. 2001 jar whereas in yours, after t+5.

                              I just have two questions with your code:

                              - In my understanding, in your code, froe_i is forecast earning and indmedroe is average ROE of industry. Thus, to compose fi, I think you should use fi=f5/b4 - ii rather than fi= f5-ii

                              - Furthermore, you include t12 into the equation to compute ICC, however, what I understand from Gebhart 2001 jar (see p.142, eq.6), the authors do not include t12, just only tv. Additionally, the exponential of (1+x) is 11 instead of 12.

                              Ben Jann

                              I tried to use your code but the plot do not have any value, even for my full sample, there is 500 obs for the root (solution).

                              Code:
                               
                               mata i = 2 x = rangen(smallestdouble(),1-epsilon(1),99) y = J(rows(x),1,.) for (j=1; j<=rows(x); j++) {     y[j] = w(x[j],z[i,2],z[i,3],z[i,4],z[i,5],z[i,6],z[i,7],z[i,8]) } x,y mm_plot((y,x)) end ​​​​​​​
                              Best

                              David

                              Comment

                              Working...
                              X