[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] calculating IRR (accounting) in R
From:       Gabor Grothendieck <ggrothendieck () gmail ! com>
Date:       2005-11-30 22:02:56
Message-ID: 971536df0511301402y767140a1leba7a52776948b8f () mail ! gmail ! com
[Download RAW message or body]

On 11/30/05, Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
> You can use uniroot:
>
> npv <- function(i, cf, tt = seq(along = cf)) sum(cf / (1-i)^tt)

Sorry that should 1+i

> npv0 <- npv(0.1, 1:10)
> npv0
> f <- function(i, cf, npv0) npv0 - npv(i, cf)
> uniroot(f, c(0.01, .99), cf = 1:10, npv0 = npv0)
>
>
> On 11/30/05, paul sorenson <sourceforge@metrak.com> wrote:
> > I am trying to replace a spreadsheet model of a project justification
> > with an R script.
> >
> > I can't seem to track down R functions to calculate Internal Rate of
> > Return and NPV?  Am I missing something?  NPV doesn't seem so difficult
> > to calculate (at least for a regular series) but I am struggling to
> > identify how to solve for IRR in R.
> >
> > It would be sufficient if it worked for a regular series but really
> > useful if there was something that worked with irregular time series.
> >
> > cheers
> >
> > ______________________________________________
> > 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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic