Input cash flows per time period.
By convention, net "deposits"
are negative and net "withdrawals" are positive. Thus, for
example, at least the first element of values
, which represents
the initial investment, will typically be negative.
Starting guess for solving the Internal Rate of Return
Required tolerance for the solution
Maximum iterations in finding the solution
Internal Rate of Return for periodic input values
v0.0.17
The IRR is perhaps best understood through an example (illustrated
using irr
in the Examples section below).
Suppose one invests 100
units and then makes the following withdrawals at regular (fixed)
intervals: 39, 59, 55, 20. Assuming the ending value is 0, one's 100
unit investment yields 173 units; however, due to the combination of
compounding and the periodic withdrawals, the "average" rate of return
is neither simply 0.73/4 nor (1.73)^0.25-1.
Rather, it is the solution (for r
) of the equation:
-100 + 39/(1+r) + 59/((1+r)^2) + 55/((1+r)^3) + 20/((1+r)^4) = 0
In general, for values
= [0, 1, ... M]
,
irr
is the solution of the equation:
\\sum_{t=0}^M{\\frac{v_t}{(1+irr)^{t}}} = 0
import { irr } from 'financial'
irr([-100, 39, 59, 55, 20]) // 0.28095
irr([-100, 0, 0, 74]) // -0.0955
irr([-100, 100, 0, -7]) // -0.0833
irr([-100, 100, 0, 7]) // 0.06206
irr([-5, 10.5, 1, -8, 1]) // 0.0886
Generated using TypeDoc
Return the Internal Rate of Return (IRR).
This is the "average" periodically compounded rate of return that gives a net present value of 0.0; for a more complete explanation, see Notes below.