Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: Solving equations iteratively

 From "David Scheuer" To statalist@hsphsun2.harvard.edu Subject st: Solving equations iteratively Date Wed, 05 May 2010 12:50:13 +0200

```Hello everybody

I am stuck in a problem. In order to rebuild cost of capital models, which determine cost of capital implied as the internal rate of return from a valuation model, I need to solve equations iteratively.

For instance, this is the first (of 30) row in my dataset and I want to find r_CT in every row by solving the following equation.

p_0 = 27.09  bv_0 = 18.02  eps_1 = 2.72  eps_2 = 2.94  eps_3 = 3.32 eps_4 = 3.96  eps_5 = 3.24  bv_1 = 19.38 bv_2 = 20.85  bv_3 = 22.51  bv_4 = 24.49 g_CT = .0125  r_CT = .

p_0=bv_0+(eps_1-r_CT*bv_0)/(1+r_CT)+(eps_2-r_CT*bv_1)/(1+r_CT)^2+(eps_3-r_CT*bv_2)/(1+r_CT)^3+(eps_4-r_CT*bv_3)/(1+r_CT)^4+((eps_5-r_CT*bv_4)*(1+g_CT))/((r_CT-g_CT)*(1+r_CT)^4
,
where only r_CT is an unknown variable. I know that it should be between 0 and 1 because it is an interest rate.

I guess I have to write a program in mata but I am not quite familiar with the syntax yet.

Thanks a lot for any suggestion. I would appreciate it very much.

Have a nice day
David
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```