Unfortunately, this is not a robust implementation, and is derailed by
Error in uniroot(f, c(-1, 1)) :
f() values at end points not of opposite sign
--
View this message in context:
http://r.789695.n4.nabble.com/Code-to-calculate-internal-rate-of-return-tp864645p2231910.html
Sent from the R
You could look at how the same problem is dealt with in package "financial".
Paul Bivand
2008/8/1 Moshe Olshansky <[EMAIL PROTECTED]>
>
> You can use uniroot (see ?uniroot).
>
> As an example, suppose you have a $100 bond which pays 3% every half year (6%
> coupon) and lasts for 4 years. Suppose
You can use uniroot (see ?uniroot).
As an example, suppose you have a $100 bond which pays 3% every half year (6%
coupon) and lasts for 4 years. Suppose that it now sells for $95. In such a
case your time intervals are 0,0.5,1,...,4 and the payoffs are:
-95,3,3,...,3,103.
To find internal rate
3 matches
Mail list logo