I couldn't resist the temptation.
Here is the example using the R package nleqslv.
library(nleqslv)
npv <- function (irr, cashFlow, times) sum(cashFlow / (1 + irr)^times)
CF <- c(-1000,500,500,500,500,500)
dates <-
c("1/1/2001","2/1/2002","3/1/2003","4/1/2004","5/1/2005","6/1/2006")
cfDate <-
---
From: Ravi Varadhan [mailto:rvarad...@jhmi.edu]
Sent: Wednesday, August 25, 2010 7:24 PM
To: Adrian Ng
Cc: r-help@r-project.org
Subject: RE: [R] Secant Method Convergence (Method to replicate Excel XIRR/IRR)
The secant method converges just fine. Your problem might have occurred due
to improper
D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Ravi Varadhan
Date: Wednesday, August 25, 2010 10:51 pm
Subject: Re: [R] Secant Method Convergence
is helps,
Ravi.
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message --
uot;1/1/2001","2/1/2002","3/1/2003","4/1/2004","5/1/2005","6/1/2006")
ANXIRR(CF, dates, guess=0.1)
> ANXIRR(CF, dates, guess=0.1)
$irr
[1] 0.4106115
$npv
[1] 2.984279e-13
Ravi.
-Original Message-
From: Adrian Ng [mailto:a...@hamil
: Adrian Ng; r-help@r-project.org
Subject: RE: [R] Secant Method Convergence (Method to replicate Excel
XIRR/IRR)
Another approach is to use `uniroot' to find the zero of the NPV function:
npv <- function (cashFlow, irr) {
n <- length(cashFlow)
sum(cashFlow / (1 + i
Convergence (Method to replicate Excel XIRR/IRR)
Hi,
I am new to R, and as a first exercise, I decided to try to implement an
XIRR function using the secant method. I did a quick search and saw another
posting that used the Bisection method but wanted to see if it was possible
using the secant metho
To: r-help@r-project.org
Subject: [R] Secant Method Convergence (Method to replicate Excel XIRR/IRR)
Hi,
I am new to R, and as a first exercise, I decided to try to implement an
XIRR function using the secant method. I did a quick search and saw another
posting that used the Bisection method but wanted to
Hi,
I am new to R, and as a first exercise, I decided to try to implement an XIRR
function using the secant method. I did a quick search and saw another posting
that used the Bisection method but wanted to see if it was possible using the
secant method.
I would input a Cash Flow and Date vect
9 matches
Mail list logo