From: McGehee, Robert <Robert.McGehee_at_geodecapital.com>

Date: Thu 01 Dec 2005 - 08:44:36 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

http://www.R-project.org/posting-guide.html

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 01 08:51:18 2005

Date: Thu 01 Dec 2005 - 08:44:36 EST

Hello,

If we define IRR implicitly such that NPV(C, IRR) = 0, then we can just
write an IRR function that finds the zeros of the NPV function. Here are
two such functions:

NPV <- function(C, r) {

sum(C / (1 + r) ^ (seq(along = C) - 1))

*}
*

IRR <- function(C) {

uniroot(NPV, c(0, 1), C = C)$root

*}
*

Hope this helps,

Robert

-----Original Message-----

From: paul sorenson [mailto:sourceforge@metrak.com]
Sent: Wednesday, November 30, 2005 3:50 PM
To: r-help

Subject: [R] calculating IRR (accounting) in R

I am trying to replace a spreadsheet model of a project justification with an R script.

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

http://www.R-project.org/posting-guide.html

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 01 08:51:18 2005

*
This archive was generated by hypermail 2.1.8
: Thu 01 Dec 2005 - 09:33:15 EST
*