.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated_examples\economic\plot_ex3_disc_factor_convergence.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_examples_economic_plot_ex3_disc_factor_convergence.py: Discount factor convergence =================================== The convergence of the stochastic discount factors generated by the Hull-White model. The charts below examine the convergence of the discount factors for various combinations of :math:`\sigma` and :math:`a`, first by changing :math:`\sigma` and secondly by changing :math:`a`. As Balaraman's study shows, the convergence gets worse as :math:`\sigma/a` gets larger than 1, and gets better as :math:`\sigma/a` gets smaller than 1. .. seealso:: * :mod:`~economic.BasicHullWhite.HullWhite` in :mod:`~economic.BasicHullWhite` * :doc:`/libraries/economic/hull-white-simulation` notebook in the :mod:`~economic` library .. GENERATED FROM PYTHON SOURCE LINES 16-36 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /generated_examples/economic/images/sphx_glr_plot_ex3_disc_factor_convergence_001.png :alt: $a=$0.1, $\sigma=$0.05, $\sigma/a=$0.50, $\sigma=$0.075, $\sigma/a=$0.75, $\sigma=$0.1, $\sigma/a=$1.00, $\sigma=$0.125, $\sigma/a=$1.25 :srcset: /generated_examples/economic/images/sphx_glr_plot_ex3_disc_factor_convergence_001.png :class: sphx-glr-multi-img * .. image-sg:: /generated_examples/economic/images/sphx_glr_plot_ex3_disc_factor_convergence_002.png :alt: $\sigma=$0.125, $a=$0.05, $\sigma/a=$2.00, $a=$0.1, $\sigma/a=$1.00, $a=$0.15, $\sigma/a=$0.67, $a=$0.2, $\sigma/a=$0.50 :srcset: /generated_examples/economic/images/sphx_glr_plot_ex3_disc_factor_convergence_002.png :class: sphx-glr-multi-img .. code-block:: default import modelx as mx import matplotlib.pyplot as plt HW = mx.read_model("BasicHullWhite").HullWhite fig, axs = plt.subplots(2, 2, sharex=True, sharey=True) fig.suptitle(r"$a=$" + str(HW.a)) for sigma, (h, v) in zip([0.05, 0.075, 0.1, 0.125], [(0, 0), (0, 1), (1, 0), (1, 1)]): HW.sigma = sigma axs[h, v].set_title(r"$\sigma=$" + str(sigma) + r", $\sigma/a=$" + "%.2f" % (sigma/HW.a)) axs[h, v].plot(range(HW.step_size+1), [HW.mkt_zcb(i) for i in range(HW.step_size+1)], "b-") axs[h, v].plot(range(HW.step_size+1), HW.mean_disc_factor(), "r--") fig, axs = plt.subplots(2, 2, sharex=True, sharey=True) fig.suptitle(r"$\sigma=$" + str(HW.sigma)) HW.sigma = 0.1 for a, (h, v) in zip([0.05, 0.1, 0.15, 0.2], [(0, 0), (0, 1), (1, 0), (1, 1)]): HW.a = a axs[h, v].set_title(r"$a=$" + str(a) + r", $\sigma/a=$" + "%.2f" % (HW.sigma/HW.a)) axs[h, v].plot(range(HW.step_size+1), [HW.mkt_zcb(i) for i in range(HW.step_size+1)], "b-") axs[h, v].plot(range(HW.step_size+1), HW.mean_disc_factor(), "r--") .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.936 seconds) .. _sphx_glr_download_generated_examples_economic_plot_ex3_disc_factor_convergence.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ex3_disc_factor_convergence.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ex3_disc_factor_convergence.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_