Hello Stata Users,

I have encountered an issue where the mm_root command (part of the moremata package) fails to return anything when I use upper and lower bounds of 0 and 1, even though (a) these are the bounds that are theoretically required and (b) using Excel solver for a few observations shows that the solution for the implied cost of equity capital falls within these bounds. Further, when expanding the upper and lower bounds out (I have tried between -10 and 10, as well as -30,000 to 30,000 and a variety of bounds in-between) I will get implied cost of equity capital estimates returned, but every single observation is either at the lower or the upper bound. Varying the tolerance from 0 to 1 and increasing the number of iterations to 10,000 does not help. Is there something I am missing, or is there another better way to code this problem?

For reference, I am trying to compute the cost of equity capital in accordance with Gebhardt, Lee, and Swaminathan (2001), as modifed by Li and Mohanram (2014) (see below for complete citations). The specific code I am using is:

References:

Gebhardt, W., C. Lee, and B. Swaminathan. 2001. "Toward an Implied Cost of Capital". Journal of Accounting Research 39(1): 135-176.

Li, K. and P. Mohanram. 2014. "Evaluating Cross-Sectional Forecasting Models for Implied Cost of Capital" Review of Accounting Studies 19:1152-1185.

I have encountered an issue where the mm_root command (part of the moremata package) fails to return anything when I use upper and lower bounds of 0 and 1, even though (a) these are the bounds that are theoretically required and (b) using Excel solver for a few observations shows that the solution for the implied cost of equity capital falls within these bounds. Further, when expanding the upper and lower bounds out (I have tried between -10 and 10, as well as -30,000 to 30,000 and a variety of bounds in-between) I will get implied cost of equity capital estimates returned, but every single observation is either at the lower or the upper bound. Varying the tolerance from 0 to 1 and increasing the number of iterations to 10,000 does not help. Is there something I am missing, or is there another better way to code this problem?

For reference, I am trying to compute the cost of equity capital in accordance with Gebhardt, Lee, and Swaminathan (2001), as modifed by Li and Mohanram (2014) (see below for complete citations). The specific code I am using is:

Code:

mata z=J(1,1,.) st_view(z,., "glsicc p3prcc bve fore1 fore2 fore3 fore4 fore5 indmedroe dvrate") function w(x,p,b0,f1,f2,f3,f4,f5,ii,dv) { tf = f1+f2+f3+f4 fi = f5-ii return(-p+b0+(f1-x*b0)/(1+x)+(f2-x*(b0+f1*dv))/(1+x)^2+(f3-x*(b0+dv*(f1+f2)))/(1+x)^3+(f4-x*(b0+dv*(f1+f2+f3)))/(1+x)^4+(f5-x*(b0+dv*tf))/(1+x)^5+((f5-fi/7)-x*(b0+dv*(tf+f5)))/(1+x)^6+((f5-fi*2/7)-x*(b0+dv*(tf+2*f5-fi/7)))/(1+x)^7+((f5-fi*3/7)-x*(b0+dv*(tf+3*f5-fi*3/7)))/(1+x)^8+((f5-fi*4/7)-x*(b0+dv*(tf+4*f5-fi*6/7)))/(1+x)^9+((f5-fi*5/7)-x*(b0+dv*(tf+5*f5-fi*10/7)))/(1+x)^10+((f5-fi*6/7)-x*(b0+dv*(tf+6*f5-fi*15/7)))/(1+x)^11+(ii-x*(b0+dv*(tf+7*f5-fi*3)))/((1+x)^12)+(ii-x*(b0+dv*(tf+7*f5-fi*3)))/(x*(1+x)^12)) } for (i=1;i<=rows(z);i++) { r=mm_root(glsicc=.,&w(),0,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]=glsicc } end

References:

Gebhardt, W., C. Lee, and B. Swaminathan. 2001. "Toward an Implied Cost of Capital". Journal of Accounting Research 39(1): 135-176.

Li, K. and P. Mohanram. 2014. "Evaluating Cross-Sectional Forecasting Models for Implied Cost of Capital" Review of Accounting Studies 19:1152-1185.

## Comment