[R] xirr...

Alberto Santini albertosantini at gmail.com
Tue May 13 10:21:50 CEST 2008


Hello.

A few weeks ago, I need to calculate the Internal Rate of Return for
irregular intervals.

There is the package 'financial', with the function 'cashflow', calculating
irr for regular intervals.
So I developed xirr, managing irregular intervals, that's accepting a vector
of dates as xirr Excel function.

You can find the code at
  http://albertosantini.blogspot.com/2008/01/xirr.html

#~ Title: XIRR Excel function simulation
#~ 
#~ Reference 1: How to manage irregular intervals -
http://www.geocities.com/accessreddy/excel/xirr.htm
#~ Reference 2: How to calculate IRR manually -
http://www.s-anand.net/Calculating_IRR_manually.html
#~ 
#~ Step 1: enter zeroes (0) against dates that do not have any cash outflow
or inflows.
#~ Step 1bis: calculate IRR for these cash flow values using normal IRR
function.
#~ Step 1tris: or using an iteractive approach as bisection method to find
the NPV zeroes.
#~ Step 2: multiply this value of IRR by 365 to get annual IRR (since, these
are daily cash flows).
#~ Step 3: refine using the formula =( 1+ R / 365) ^ 365 - 1), where R is
the the value obtained in Step2.
#~

Regards,
Alberto Santini
-- 
View this message in context: http://www.nabble.com/xirr...-tp17203475p17203475.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list