Internal Rate of Return
Overview
Given that a series of cash flows is discounted at different rates
depending on the date of the cash flow, it is natural to ask if
there exists a single rate that when used to discount all cash
flows, equals the present value as calculated with the appropriate
rates. This rate, if it existed, would represent an "average" of sorts
of the rates of each cash flow, and would give one way to indicate
the relative value of different instruments.
In general this rate exists, but can only be calculated using
numeric methods. It is called the internal rate of return, or
in the context of fixed income, yield to maturity.
Internal Rate of Return - Yield to Maturity
Given a series of cash flows, equally spaced in time. (that is, each separated by the same time period)
{% x_0,x_1,...x_n %}
The internal rate of return is defined to be the single rate, r, that solves
{% 0 = x_0 + \frac{x_1}{1+r} + \frac{x_2}{(1+r)^2} + ... + \frac{x_n}{(1+r)^n} %}
Note: at least one of these cash flows needs to be negative. The negative cash flow typically represents the cost of purchasing the bond
or instrument up front. However, when modeling a project or other series of cash flows, it could very well be that there are multiple
cash flows, representing the expenses, and positive cash flows representing the returns.
The IRR can be calculated using the
Yield Library
let yd = await import('/lib/finance/yield/v1.0.0/yield.mjs');
let cashFlows = [{ time:0,value:100 }, { time:0.1,value:10 },{ time:0.5,value:5 },{ time:0.9,value:10 },{ time:1,value: -120 },];
let rate = yd.irr(cashFlows);
Try it!
Annualizing Yields
When the income payments on a fixed income instrument occurs at a different period than yearly
(say monthly or quarterly), it is often convenient to annualize the yield, in order put comparisons of yields
on an apples to apples basis.
When m is the number or payment periods per year, the effective annual yield is
{% yield = (1 + rate)^m - 1 %}
A simple approximation the above is
{% yield \approx rate \times m %}
Continuous Compounding
The irr can be computed on a continuous basis. The internal rate of return on a coninuous basis is the single rate r that
solves
{% 0 = x_0 + x_1e^{-rt_1} + ... + x_ne^{-rt_n} %}
where {% t_i %} is the time of the {% i^{th} %} cash flow.