.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated_examples\savings\plot_ex1_av_paths.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_savings_plot_ex1_av_paths.py: Account value paths =================================== Account value paths generated by the Monte Carlo simulation. The first 100 and 1000 paths out of 10000 are plotted. The investment return on account value is modeled to follow the following geometric Brownian motion .. math:: \frac{\Delta{S}}{S}=r\Delta{t}+\sigma\epsilon\sqrt{\Delta{t}} where :math:`\Delta{S}` is the change in the account value :math:`S`, in a small interval of time, :math:`\Delta{t}`, :math:`r` is the constant risk free rate, :math:`\sigma` is the volatility of the account value and :math:`\epsilon` is a random number drawn from the standard normal distribution. .. seealso:: * :doc:`/libraries/savings/savings_example1` notebook in the :mod:`~savings` library .. GENERATED FROM PYTHON SOURCE LINES 25-41 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /generated_examples/savings/images/sphx_glr_plot_ex1_av_paths_001.png :alt: 100 scenarios :srcset: /generated_examples/savings/images/sphx_glr_plot_ex1_av_paths_001.png :class: sphx-glr-multi-img * .. image-sg:: /generated_examples/savings/images/sphx_glr_plot_ex1_av_paths_002.png :alt: 1000 scenarios :srcset: /generated_examples/savings/images/sphx_glr_plot_ex1_av_paths_002.png :class: sphx-glr-multi-img .. code-block:: default import modelx as mx import pandas as pd model = mx.read_model("CashValue_ME_EX1") proj = model.Projection av = proj.av_pp_at avs = list(av(t, 'BEF_FEE') for t in range(proj.max_proj_len())) df = pd.DataFrame(avs)[1] for scen_size in [100, 1000]: df[range(1, scen_size + 1)].plot.line( legend=False, grid=True, title="%s scenarios" % scen_size) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.087 seconds) .. _sphx_glr_download_generated_examples_savings_plot_ex1_av_paths.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_ex1_av_paths.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ex1_av_paths.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_