.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/time_value/irr/plot_03_baldwin_mirr.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_time_value_irr_plot_03_baldwin_mirr.py: Baldwin's modified IRR ====================== Robert Baldwin's "How to Assess Investment Proposals" (*Harvard Business Review*, 1959) proposed a fix for the IRR's two defects -- multiple roots and the implicit assumption that interim cash flows are reinvested at the IRR itself. Compound the inflows to the horizon at a realistic reinvestment rate, discount the outflows at the finance rate, and report the one rate that links them: :math:`\mathrm{MIRR} = (FV^+ / |PV^-|)^{1/n} - 1`. It always exists and is unique. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from financialkit.time_value import irr, irr_all, mirr .. GENERATED FROM PYTHON SOURCE LINES 22-26 A high-IRR project ------------------ Its IRR assumes the early inflows earn the IRR again; at a 10% reinvestment rate the realistic return is much lower. .. GENERATED FROM PYTHON SOURCE LINES 26-31 .. code-block:: Python cf = [-1000.0, 800.0, 500.0, 200.0] print(f"IRR = {irr(cf):.2%}") print(f"MIRR = {mirr(cf, 0.10, 0.10):.2%} (finance and reinvest at 10%)") .. rst-class:: sphx-glr-script-out .. code-block:: none IRR = 30.20% MIRR = 19.77% (finance and reinvest at 10%) .. GENERATED FROM PYTHON SOURCE LINES 32-34 The pump problem gets one answer -------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 34-38 .. code-block:: Python pump = [-1600.0, 10_000.0, -10_000.0] print(f"pump IRRs: {irr_all(pump)}; MIRR at 10%: {mirr(pump, 0.10, 0.10):.2%}") .. rst-class:: sphx-glr-script-out .. code-block:: none pump IRRs: [0.25 4. ]; MIRR at 10%: 5.60% .. GENERATED FROM PYTHON SOURCE LINES 39-41 MIRR moves between the reinvestment rate and the IRR ---------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 41-53 .. code-block:: Python reinvest = np.linspace(0.0, 0.6, 121) fig, ax = plt.subplots(figsize=(7, 4.5)) ax.plot(100 * reinvest, [100 * mirr(cf, 0.10, r) for r in reinvest], label="MIRR") ax.axhline(100 * irr(cf), color="tab:red", ls="--", label="IRR") ax.plot(100 * reinvest, 100 * reinvest, ":", color="gray", label="reinvestment rate") ax.set_xlabel("reinvestment rate (%)") ax.set_ylabel("rate of return (%)") ax.set_title("Baldwin's MIRR equals the IRR only when reinvesting at the IRR") ax.legend() plt.show() .. image-sg:: /api/gallery/time_value/irr/images/sphx_glr_plot_03_baldwin_mirr_001.png :alt: Baldwin's MIRR equals the IRR only when reinvesting at the IRR :srcset: /api/gallery/time_value/irr/images/sphx_glr_plot_03_baldwin_mirr_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.031 seconds) .. _sphx_glr_download_api_gallery_time_value_irr_plot_03_baldwin_mirr.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/time_value/irr/plot_03_baldwin_mirr.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_03_baldwin_mirr.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_03_baldwin_mirr.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_03_baldwin_mirr.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_