.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/time_value/present_value/plot_02_fisher_real_rate.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_present_value_plot_02_fisher_real_rate.py: Fisher's real and nominal rates of interest =========================================== In *Appreciation and Interest* (1896) Irving Fisher argued that lenders who foresee inflation demand compensation for it, so that a nominal rate :math:`i` and a real rate :math:`r` satisfy :math:`1 + i = (1 + r)(1 + \pi)`. The familiar shortcut :math:`r \approx i - \pi` is accurate only when inflation is low; this script compares the two across inflation rates, up to hyperinflation. .. GENERATED FROM PYTHON SOURCE LINES 14-19 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from financialkit.time_value import fisher_nominal_rate, fisher_real_rate .. GENERATED FROM PYTHON SOURCE LINES 20-22 A loan at 12% with 8% inflation ------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 22-27 .. code-block:: Python print(f"exact real rate: {fisher_real_rate(0.12, 0.08):.4%}") print(f"approximate (i-pi): {fisher_real_rate(0.12, 0.08, exact=False):.4%}") print(f"nominal rate needed for a 3% real return at 8% inflation: {fisher_nominal_rate(0.03, 0.08):.4%}") .. rst-class:: sphx-glr-script-out .. code-block:: none exact real rate: 3.7037% approximate (i-pi): 4.0000% nominal rate needed for a 3% real return at 8% inflation: 11.2400% .. GENERATED FROM PYTHON SOURCE LINES 28-31 The approximation breaks down as inflation rises ------------------------------------------------ Hold the real rate at 3% and ask what nominal rate a lender needs. .. GENERATED FROM PYTHON SOURCE LINES 31-49 .. code-block:: Python infl = np.linspace(0.0, 1.0, 201) exact = fisher_nominal_rate(0.03, infl) approx = 0.03 + infl fig, axes = plt.subplots(1, 2, figsize=(11, 4)) axes[0].plot(100 * infl, 100 * exact, label="exact: (1+r)(1+pi) - 1") axes[0].plot(100 * infl, 100 * approx, "--", label="approximate: r + pi") axes[0].set_xlabel("inflation (%)") axes[0].set_ylabel("required nominal rate (%)") axes[0].legend() axes[1].plot(100 * infl, 100 * (exact - approx)) axes[1].set_xlabel("inflation (%)") axes[1].set_ylabel("gap = r * pi (percentage points)") axes[1].set_title("Error of the first-order Fisher equation") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/time_value/present_value/images/sphx_glr_plot_02_fisher_real_rate_001.png :alt: Error of the first-order Fisher equation :srcset: /api/gallery/time_value/present_value/images/sphx_glr_plot_02_fisher_real_rate_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.058 seconds) .. _sphx_glr_download_api_gallery_time_value_present_value_plot_02_fisher_real_rate.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/present_value/plot_02_fisher_real_rate.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_fisher_real_rate.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_fisher_real_rate.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_fisher_real_rate.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_