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: RE: Solving equations iteratively

 From "Nick Cox" To Subject st: RE: Solving equations iteratively Date Wed, 5 May 2010 17:15:18 +0100

```At first sight this looks similar to your posting on 20 April. There
were excellent suggestions in reply from Stas Kolenikov, Al Feiveson and
Austin Nichols. It is not clear why this is re-posted as if it were a
fresh question. Any way, careful study of the answers in the archives
will show that Mata is not only the only strategy.

Nick
n.j.cox@durham.ac.uk

David Scheuer

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.

*
*   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/
```