.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/asset_pricing/valuation/plot_04_shiller_excess_volatility.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_asset_pricing_valuation_plot_04_shiller_excess_volatility.py: Shiller's excess volatility =========================== If a price is the rational forecast of discounted future dividends, :math:`p_t = E_t[p^*_t]`, then the ex-post rational price :math:`p^*_t` computed from the dividends actually paid equals the price plus an unforecastable error. An optimal forecast varies less than the thing it forecasts, so :math:`\sigma(p) \le \sigma(p^*)`. Robert Shiller (1981) found US stock prices five to thirteen times too volatile for this bound. Here dividends follow an AR(1) around a constant. The rational price respects the bound; a market that treats every dividend shock as permanent violates it. .. GENERATED FROM PYTHON SOURCE LINES 19-37 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from financialkit.asset_pricing import ar1_dividend_price, variance_bound from financialkit.asset_pricing.visualizers import plot_excess_volatility rng = np.random.default_rng(1981) r, rho, Dbar, n = 0.05, 0.9, 1.0, 400 D = np.empty(n) D[0] = Dbar for t in range(1, n): D[t] = Dbar + rho * (D[t - 1] - Dbar) + 0.05 * rng.standard_normal() rational = variance_bound(ar1_dividend_price(D, r, rho, Dbar), D, r, terminal_price=Dbar / r) overreacting = variance_bound(D / r, D, r, terminal_price=Dbar / r) print(f"rational price: sd ratio {rational.ratio:.2f} (bound violated: {rational.violated})") print(f"overreacting: sd ratio {overreacting.ratio:.2f} (bound violated: {overreacting.violated})") .. rst-class:: sphx-glr-script-out .. code-block:: none rational price: sd ratio 0.70 (bound violated: False) overreacting: sd ratio 2.33 (bound violated: True) .. GENERATED FROM PYTHON SOURCE LINES 38-46 .. code-block:: Python fig, axes = plt.subplots(2, 1, figsize=(8, 6), sharex=True) plot_excess_volatility(rational, ax=axes[0], label="rational price") plot_excess_volatility(overreacting, ax=axes[1], label="price = D / r") axes[0].set_title("the rational forecast is smoother than p*") axes[1].set_title("treating shocks as permanent violates the bound") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/asset_pricing/valuation/images/sphx_glr_plot_04_shiller_excess_volatility_001.png :alt: the rational forecast is smoother than p*, treating shocks as permanent violates the bound :srcset: /api/gallery/asset_pricing/valuation/images/sphx_glr_plot_04_shiller_excess_volatility_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.065 seconds) .. _sphx_glr_download_api_gallery_asset_pricing_valuation_plot_04_shiller_excess_volatility.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/asset_pricing/valuation/plot_04_shiller_excess_volatility.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_04_shiller_excess_volatility.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_04_shiller_excess_volatility.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_04_shiller_excess_volatility.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_