{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Comparative geometric mean returns\n",
    "\n",
    "We focus mathematically on geometric mean returns since they \n",
    "optimally express mean-variance under logarithmic utility.\n",
    "However, for visualization, we use boxplots\n",
    "to see the persistence of returns.\n",
    "\n",
    "Accuracy has been improved by using our research on\n",
    "Gaussian mixtures presented in https://git.io/gmix --\n",
    "specifically, our function gemrat() computes the geometric mean\n",
    "rate by taking into account the fourth central moment, kurtosis.\n",
    "This is crucial for *leptokurtotic* (\"fat-tailed\") assets.\n",
    "\n",
    "We examine some long-term economic and financial time series,\n",
    "then use Holt-Winters to forecast one-year ahead\n",
    "as a generic way to illustrate future expected returns.\n",
    "Daily data for bonds, stocks, and gold is also analyzed.\n",
    "\n",
    "[We shall cover portfolio optimization in another notebook.]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "*Dependencies:*\n",
    "\n",
    "- Repository: https://github.com/rsvp/fecon235\n",
    "     \n",
    "*CHANGE LOG*\n",
    "\n",
    "    2017-06-21  Replace groupgeoret() by groupgemrat().\n",
    "    2016-01-05  MAJOR REWRITE: use pattern from monthly and daily series\n",
    "                   for new functions groupget, grouppc, groupgeoret.\n",
    "                   Forecast print out replaced by preservable groupholtf.\n",
    "                   Dictionary comprehension clarifies code.\n",
    "    2016-01-03  Fix issue #2 with v4 and p6 upgrades.\n",
    "    2015-05-26  Code revision using template v14.12.21.\n",
    "    2014-10-11  Code review. Template 2014-09-28.\n",
    "    2014-09-01  First version."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from fecon235.fecon235 import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " ::  Python 2.7.13\n",
      " ::  IPython 5.1.0\n",
      " ::  jupyter_core 4.2.1\n",
      " ::  notebook 4.1.0\n",
      " ::  matplotlib 1.5.1\n",
      " ::  numpy 1.11.0\n",
      " ::  scipy 0.17.0\n",
      " ::  sympy 1.0\n",
      " ::  pandas 0.19.2\n",
      " ::  pandas_datareader 0.2.1\n",
      " ::  Repository: fecon235 v5.17.0603 devPrtfBoltzmann\n",
      " ::  Timestamp: 2017-06-22T07:29:17Z\n",
      " ::  $pwd: /media/yaya/virt15h/virt/dbx/Dropbox/ipy/fecon235/nb\n"
     ]
    }
   ],
   "source": [
    "#  PREAMBLE-p6.15.1223d :: Settings and system details\n",
    "from __future__ import absolute_import, print_function, division\n",
    "system.specs()\n",
    "pwd = system.getpwd()   # present working directory as variable.\n",
    "print(\" ::  $pwd:\", pwd)\n",
    "#  If a module is modified, automatically reload it:\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "#       Use 0 to disable this feature.\n",
    "\n",
    "#  Notebook DISPLAY options:\n",
    "#      Represent pandas DataFrames as text; not HTML representation:\n",
    "import pandas as pd\n",
    "pd.set_option( 'display.notebook_repr_html', False )\n",
    "from IPython.display import HTML # useful for snippets\n",
    "#  e.g. HTML('<iframe src=http://en.mobile.wikipedia.org/?useformat=mobile width=700 height=350></iframe>')\n",
    "from IPython.display import Image \n",
    "#  e.g. Image(filename='holt-winters-equations.png', embed=True) # url= also works\n",
    "from IPython.display import YouTubeVideo\n",
    "#  e.g. YouTubeVideo('1j_HxD4iLn8', start='43', width=600, height=400)\n",
    "from IPython.core import page\n",
    "get_ipython().set_hook('show_in_pager', page.as_hook(page.display_page), 0)\n",
    "#  Or equivalently in config file: \"InteractiveShell.display_page = True\", \n",
    "#  which will display results in secondary notebook pager frame in a cell.\n",
    "\n",
    "#  Generate PLOTS inside notebook, \"inline\" generates static png:\n",
    "%matplotlib inline   \n",
    "#          \"notebook\" argument allows interactive zoom and resize."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Download data and construct a dataframe\n",
    "\n",
    "We retrieve the following data of monthly frequency: **(aggregated) inflation, \n",
    "bonds (zero coupon equivalent of 10-y Treasury), equities (S&P 500), and \n",
    "gold (London PM fix)** -- all denominated in US dollars -- **then lastly, the \n",
    "real trade-weighted USD index (Federal Reserve) and US home prices (per Case-Shiller).** \n",
    "The details for each series is given in their respective notebooks. \n",
    "If the available data has daily frequency, we use the pandas method called \n",
    "\"resampling\" to induce monthly data (enter \"monthly??\" in an \n",
    "input cell for more details).\n",
    "\n",
    "ATTENTION: *The inclusion of home prices, unfortunately, will create a 3-month lag, \n",
    "due to their release cycle. Since this is a comparative study, \n",
    "other data will appear out-of-date, but this \n",
    "section is intended for long-term trends.* \n",
    "Second half of this notebook will examine more responsive daily data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " ::  Case-Shiller prepend successfully goes back to 1987.\n",
      " ::  S&P 500 prepend successfully goes back to 1957.\n"
     ]
    }
   ],
   "source": [
    "#  Specify monthly series of interest as a dictionary:\n",
    "msdic = {'Infl' : m4infl, 'Zero10' : m4zero10, 'SPX' : m4spx, \n",
    "         'XAU' : m4xau, 'USD' : m4usdrtb, 'Homes' : m4homepx }\n",
    "\n",
    "#  Download data into a dataframe:\n",
    "msdf = groupget( msdic )\n",
    "#     \"groupget??\" at input cell gives function details."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "After downloading the level series, we compute the YoY percentage change \n",
    "for each series. *This will be the a trailing 12-month statistic, \n",
    "thus it is overlapping.*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "#  Construct the mega YoY dataframe:\n",
    "mega = grouppc( msdf, freq=12 )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Define start time and get stats"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "#  Define start time as t0\n",
    "t0 = '1988'\n",
    "\n",
    "#  We can easily rerun the rest of this notebook \n",
    "#  by specifying another start time, then: Cell > Run All Below"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            Homes        Infl         SPX         USD         XAU      Zero10\n",
      "count  351.000000  351.000000  351.000000  351.000000  351.000000  351.000000\n",
      "mean     3.975145    2.360919    8.508886    0.158315    4.673031    2.191734\n",
      "std      7.809477    1.005195   15.994362    5.224617   15.253308    7.260916\n",
      "min    -18.906156   -0.186792  -42.349361  -10.650136  -27.752361  -18.521264\n",
      "25%     -0.858003    1.659338    2.012961   -3.493227   -6.812520   -2.964638\n",
      "50%      4.854246    2.324056   10.320474    0.064795    1.898076    2.855624\n",
      "75%     10.490481    2.762071   19.324933    3.220781   13.886439    7.601522\n",
      "max     17.077118    5.243615   52.051354   14.447233   60.357143   20.492399\n",
      "\n",
      " ::  Index on min:\n",
      "Homes    2009-01-01\n",
      "Infl     2009-07-01\n",
      "SPX      2009-03-01\n",
      "USD      2008-03-01\n",
      "XAU      2013-12-01\n",
      "Zero10   1994-10-01\n",
      "dtype: datetime64[ns]\n",
      "\n",
      " ::  Index on max:\n",
      "Homes    2004-07-01\n",
      "Infl     1990-10-01\n",
      "SPX      2010-03-01\n",
      "USD      2009-03-01\n",
      "XAU      2006-05-01\n",
      "Zero10   1996-01-01\n",
      "dtype: datetime64[ns]\n",
      "\n",
      " ::  Head:\n",
      "                Homes      Infl       SPX       USD        XAU     Zero10\n",
      "T                                                                        \n",
      "1988-01-01  12.139461  3.983828 -6.207571 -9.836868  17.042392 -12.661625\n",
      "1988-02-01  11.661442  3.875127 -8.186030 -8.633477   9.982617  -8.068941\n",
      "1988-03-01  11.345646  3.923270 -8.156954 -9.393214   8.841782  -9.248410\n",
      " ::  Tail:\n",
      "               Homes      Infl        SPX       USD       XAU    Zero10\n",
      "T                                                                      \n",
      "2017-01-01  5.643853  2.136046  19.125282  1.875180  8.695553 -3.182853\n",
      "2017-02-01  5.783702  2.237186  22.289801  1.862917  2.059917 -5.769468\n",
      "2017-03-01  5.837821  1.955634  16.813173  3.186732 -0.832830 -5.095762\n",
      "\n",
      " ::  Correlation matrix:\n",
      "           Homes      Infl       SPX       USD       XAU    Zero10\n",
      "Homes   1.000000 -0.000960  0.242935  0.051296 -0.242950 -0.293831\n",
      "Infl   -0.000960  1.000000  0.008384 -0.374395 -0.045903 -0.063022\n",
      "SPX     0.242935  0.008384  1.000000 -0.070457 -0.199832 -0.139682\n",
      "USD     0.051296 -0.374395 -0.070457  1.000000 -0.520433  0.192060\n",
      "XAU    -0.242950 -0.045903 -0.199832 -0.520433  1.000000  0.005306\n",
      "Zero10 -0.293831 -0.063022 -0.139682  0.192060  0.005306  1.000000\n"
     ]
    }
   ],
   "source": [
    "#  Slice the data:\n",
    "stats( mega[t0:] )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- There is not much correlation among our assets, \n",
    "  except a mild negative between gold XAU and USD. \n",
    "  (2015-05-26 at -0.51)\n",
    "\n",
    "- The difference between the maximum and minimum percentage change\n",
    "  for each item is remarkable. The index for maximum and minimum\n",
    "  quickly gives us the historical epoch.\n",
    "  \n",
    "- The indexes of the minimums for Homes and SPX show the worst\n",
    "  from the Great Recession was over by 2009-Q1."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Boxplot of overlapping annual changes\n",
    "\n",
    "The boxplot gives us an idea of the range of annual returns, \n",
    "and their ***persistence due to overlap***.\n",
    "Thus trends can be discerned.\n",
    "For example, if the blue box is located above zero,\n",
    "then the bulk of returns is positive, and we can\n",
    "expect the median, arithmetic, and geometric rates to be positive.\n",
    "Returns outside the box, especially the notches,\n",
    "perhaps could indicate unusual market conditions\n",
    "or just plain data entry errors.\n",
    "\n",
    "It is also a visual aid for the geometric mean returns \n",
    "which is most significant as an investment metric.\n",
    "What appears as outliers may be due to leptokurtosis.\n",
    "\n",
    "As usual, the ***red line*** indicates the *median*, but \n",
    "the **red dot** represents the *latest point*."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEKCAYAAAAGvn7fAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXmcXFWZv59viAuydVABIWMCEZAl0qIsKiOdYXH7yTIu\nIwZJjzM6v5EBWRRwiZ2eqCyiZsaRmcGFBEEQUbYZFVC6IriBYjMYFpGkAQNEIQQTcBTIO3+cU82l\nqapeqm7d7X0+n9td5y7nvO89dd977vece0pmhuM4jlMepmVtgOM4jtNZPLA7juOUDA/sjuM4JcMD\nu+M4TsnwwO44jlMyPLA7juOUDA/sjuM4JcMDu5NrJG0iaaOkl2Zti+MUBQ/sHUJSTdJaSc9JuZwB\nSedP4biDJa2RtHVi3XMl3Sbp/eMce5Gkc8esO0jS7yW9eLK2NCljpqSRJpvbfotO0vWSjmmx/eWS\nrpT0O0kPSfpvSS8bs8+HJT0g6RFJ50qanth2vKSfS/pTg3N1jKT1kv4Ql8fizWpuC3sOlXSHpA2S\nvi/pLxLbTpK0UtKjku6T9BlJTa9lBc6W9HCss0+P2f4pSbdKekLSR5vlM8HzsLWkK6LdKyW9c5y8\nWvnZ0u4Gec2O1+FjklZI6huz/WhJI7EOLpW05Xi+FhUP7B1A0izgAGAjcFjG5jTEzL4PXAn8a2L1\nQuB+Mzu38VGjHAccJulAAEnPB/4DON7Mft8hE98CfKfJNnWojFZsBXwL2AXYFrgFuGzUAOktwInA\ngcCOwMuBTySO/y0wCJw3NmMzO9/MtjCzLc1sS+B44E4zu7WRIZK2Ab4JnAq8MNry9cQulwN7m9lW\nwCuAfYAPtPDtA8Abgd2BvYC/lvTexPY7gZOB77bIo27beOfhP4H1wIuAfuBLkna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ORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xa9b8746c>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " ::  Finished: boxplot-Assets_YoYm.png\n"
     ]
    }
   ],
   "source": [
    "#  Overlapping YoY percentage change:\n",
    "boxplot(mega[t0:], 'Assets YoYm')\n",
    "#  where the red dot represents the latest point."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "*Red dot outside the mid-range box alerts us to unusual conditions.* \n",
    "Attention should also be paid to the extreme value \"slash\" marks \n",
    "(where outliers are also revealed).\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Geometric mean returns on non-overlapping periods\n",
    "\n",
    "David E. Shaw, famous for his proprietary hedge fund, remarked that \n",
    "one of the most important equations in finance is the penalization \n",
    "of arithmetic mean by one-half of variance:\n",
    "\n",
    "$ g = \\mu - (\\sigma^2 / 2) $\n",
    "\n",
    "which turns out to be a second-order approximation of geometric mean return.\n",
    "It is good enough to maximize, instead of considering \n",
    "intricate mean-variance trade-offs.\n",
    "We find it useful also as a metric for economic variables.\n",
    "\n",
    "Many assets have leptokurtotic returns (\"fat-tails\") and so a better\n",
    "approximation for the geometric mean rate is needed\n",
    "which takes into account the fourth central moment called *kurtosis*.\n",
    "Details are given on Gaussian mixtures in our research\n",
    "at https://git.io/gmix \n",
    "\n",
    "The source code shows us that gemrat() first gives us \n",
    "the **geometric** mean return, followed by \n",
    "the **arithmetic mean return, volatility, and Pearson kurtosis**, \n",
    "then yearly frequency and sample size -- in list format."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[0;31mSignature:\u001b[0m \u001b[0mgemreturn_Jean\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmu_return\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msigma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mk_Pearson\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
       "\u001b[0;31mSource:\u001b[0m   \n",
       "\u001b[0;32mdef\u001b[0m \u001b[0mgemreturn_Jean\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mmu_return\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msigma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mk_Pearson\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m3\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;34m'''Approximation for geometric mean RETURN via Jean (1983) infinite series.\u001b[0m\n",
       "\u001b[0;34m       Important definition: \"financial return\" := 1 + \"rate\"\u001b[0m\n",
       "\u001b[0;34m       where rate is expressed in decimal form.\u001b[0m\n",
       "\u001b[0;34m    '''\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;31m#  Jean (1983) derived the exact infinite series for geometric mean return\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;31m#  around a reference point (the arithmetic mean return worked out best).\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;31m#  Here we code an approximation by the first five terms of that series:\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0mterms\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlog\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmu_return\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m \u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;31m#  By stipulation, we shall ignore the odd moments...\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;31m#  terms[1] = 0   # Zero by symmetry:  absolute first  central moment.\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;31m#  terms[3] = 0   # Zero by symmetry:  absolute third  central moment.\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0mvariance\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msigma\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;36m2\u001b[0m                 \u001b[0;31m#  absolute second central moment.\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0mk_raw\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mk_Pearson\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0msigma\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m)\u001b[0m      \u001b[0;31m#  absolute fourth central moment.\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;31m#       kurtosis details in kurtfun().\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0mterms\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mvariance\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m2.0\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mmu_return\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0mterms\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mk_raw\u001b[0m    \u001b[0;34m/\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m4.0\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mmu_return\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;31m#          ^increasing sigma and kurtosis will lower gemreturn <=!\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0mlog_greturn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mterms\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n",
       "\u001b[0;34m\u001b[0m    \u001b[0;32mreturn\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexp\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mlog_greturn\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
       "\u001b[0;31mFile:\u001b[0m      ~/Dropbox/ipy/fecon235/lib/ys_gauss_mix.py\n",
       "\u001b[0;31mType:\u001b[0m      function\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#  How are we computing geometric mean returns?\n",
    "#  Just add \"?\" or \"??\" to variables, procedures, etc.\n",
    "#  to find out the details, e.g.\n",
    "\n",
    "#  gemrat() is the user friendly version of gemrate()\n",
    "#  which in turn relies on the following:\n",
    "\n",
    "gemreturn_Jean??"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[3.51, 3.54, 2.47, 4.06, 12, 350, 'Homes'],\n",
       " [2.29, 2.29, 0.49, 8.8, 12, 350, 'Infl'],\n",
       " [6.97, 7.72, 12.33, 10.53, 12, 350, 'SPX'],\n",
       " [0.22, 0.3, 4.14, 4.11, 12, 350, 'USD'],\n",
       " [2.41, 3.25, 12.93, 5.55, 12, 350, 'XAU'],\n",
       " [1.6, 1.84, 7.04, 5.68, 12, 350, 'Zero10']]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#  Geometric mean rates, non-overlapping, annualized:\n",
    "groupgemrat( msdf[t0:], yearly=12 )\n",
    "    \n",
    "#  Note that we applied groupgemrat to msdf, not mega.\n",
    "#  Generally gemrat requires price levels.\n",
    "#  Note that groupgemrat is just gemrat() for group dataframes."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The first element in each list gives us the geometric mean rate.\n",
    "They should be compared with the respective median rates previously computed.\n",
    "\n",
    "The fourth element in each list gives us the kurtosis statistic\n",
    "where 3.0 is theoretically expected if a distribution is Gaussian.\n",
    "\n",
    "Even home prices have slightly fat tails.\n",
    "The equities market shows the highest level of leptokurtosis.\n",
    "\n",
    "Kurtosis is generally observed to increase when the\n",
    "frequency of data is increased."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Note: the geometric mean rates do not include interest and dividend payouts for bonds and equities. \n",
    "\n",
    "Some observations in chronological order:\n",
    "\n",
    " - 2014-10-12, georet since 1988\n",
    "    - Inflation in the long-run about 3% annually.\n",
    "    - Bond price alone increases 2% annually (excludes interest income).\n",
    "    - Gold at 1.73% does not keep up with inflation.\n",
    "    - USD at break-even over the long-run.\n",
    "    - Home prices have georet of 3.6%.\n",
    "\n",
    "\n",
    "- 2015-05-27, georet since 1988\n",
    "    - Inflation in the long-run drops 70 bp to about 2.3% annually.\n",
    "    - Bond price continues its increase at 2% annually.\n",
    "    - Gold at 3.4% reacting more to stronger USD (cf. correlation).\n",
    "    - Home prices also have georet of 3.4% (but low 2.6% volatility).\n",
    "\n",
    "\n",
    "- 2016-01-03, georet since 1988\n",
    "    - Long-run inflation is 2.3% annually (Current Fed target: 2.0%).\n",
    "    - Bond price increases at 2% annually (but Fed has just hiked rates!).\n",
    "    - Equities at robust 7.6% annually (but ZIRP is finished).\n",
    "    - Gold moving along at 2.9% (reflecting horrible 2015 year).\n",
    "    - Nominal home prices at steady 3.4% per annum.\n",
    "\n",
    "\n",
    "- 2017-06-18, gemrat since 1988\n",
    "    - Long-run inflation is 2.3% annually (Current Fed target: 2.0%).\n",
    "    - Bond price increases at 1.6% annually (Fed Funds range: 100-125 bp).\n",
    "    - Equities at robust 6.97% annually.\n",
    "    - Gold stagnating at 1.6%.\n",
    "    - Nominal home prices at steady 3.5% per annum.     "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Forecasts using Holt-Winters method\n",
    "\n",
    "We forecast one-year ahead using the monthly data\n",
    "and Holt-Winters with default parameters\n",
    "(which could be optimized for each individual time-series).\n",
    "\n",
    "Note that the most current inflation level is rebased to 1, \n",
    "thus 1.02 would signify 2% increase."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "            Homes      Infl          SPX         USD          XAU     Zero10\n",
       "0   237048.401009  0.998722  2368.060000  100.605000  1232.400000  80.109472\n",
       "1   236335.064020  1.002023  2350.768764  101.934254  1242.502863  80.713012\n",
       "2   237617.243053  1.003772  2380.922547  102.284994  1239.653418  80.124459\n",
       "3   238899.422086  1.005521  2411.076329  102.635734  1236.803973  79.535906\n",
       "4   240181.601120  1.007270  2441.230111  102.986473  1233.954528  78.947353\n",
       "5   241463.780153  1.009020  2471.383894  103.337213  1231.105083  78.358800\n",
       "6   242745.959186  1.010769  2501.537676  103.687953  1228.255638  77.770247\n",
       "7   244028.138219  1.012518  2531.691459  104.038693  1225.406193  77.181694\n",
       "8   245310.317252  1.014267  2561.845241  104.389432  1222.556749  76.593141\n",
       "9   246592.496286  1.016016  2591.999023  104.740172  1219.707304  76.004588\n",
       "10  247874.675319  1.017765  2622.152806  105.090912  1216.857859  75.416035\n",
       "11  249156.854352  1.019514  2652.306588  105.441651  1214.008414  74.827482\n",
       "12  250439.033385  1.021264  2682.460371  105.792391  1211.158969  74.238929"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#  These 12-periods ahead forecasts use default alpha and beta values\n",
    "#  found empirically to be optimal for a fixed Kalman filter.\n",
    "\n",
    "groupholtf( msdf, h=12 )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Forecast log for monthly data\n",
    "\n",
    "Changing Holt-Winters *alpha* from 0.20 to 0.10 varies the forecast only slightly. The important parameter is *beta* to capture trend effects. Currently we shall rely on default Holt-Winters settings for robustness.\n",
    "\n",
    "\n",
    "- 2014-09-01, Twelve-month Forecasts given data through 2014-07-01:\n",
    "    - Inflation at 1.44%.\n",
    "    - 10-y Bonds price -6.7%, thus rate +75 bp given zero10dur. \n",
    "    - SPX +16.6% to 2280.\n",
    "    - Gold tanks from 1286 to 1067. \n",
    "    - USD +1.4% broadly.\n",
    "\n",
    "\n",
    "- 2014-10-11, Twelve-month Forecasts given ten-year data, robust HW:\n",
    "    - Inflation at 1.9%\n",
    "    - Zero10 indicates slight downward pressure on interest rates.\n",
    "    - SPX to 2239, but market seems skeptical.\n",
    "    - Gold tanks to 1184 (region which we have seen just recently).\n",
    "    - USD definitely has an upward bias against all FX, even NZD and AUD.\n",
    "    - Home prices looking to increase from \\$203K to \\$220K \n",
    "\n",
    "\n",
    "- 2015-05-28, Twelve-month Forecasts given data through 2015-03-01, robust HW:\n",
    "    - Inflation at 0.5% (which seems dramatic).\n",
    "    - Zero10 price increases by 8.92%, thus 10-year rate decreases by 100 bp.\n",
    "    - SPX to 2322, but no metric says it's fair valued.\n",
    "    - Gold to 1130, which would break support.\n",
    "    - USD very strong, up 12% globally (QE-EU started, and possible Grexit).\n",
    "    - Home prices looking to increase from \\$214K to \\$223K\n",
    "\n",
    "\n",
    "- 2016-01-03, Twelve-month Forecasts given data through 2015-10-01, robust HW:\n",
    "    - Inflation at 1.1% (still below Fed target, see https://git.io/fed)\n",
    "    - Bonds and equities, forecasting Zero10 and SPX, will be flat.\n",
    "    - Gold to continue down trend, expected to fall to \\$941 in a year.\n",
    "    - USD 10% higher in light of divergence between Fed hike(s) and ECB QE.\n",
    "    - Home prices expected to be flat (but watch mortgage spreads).\n",
    "\n",
    "\n",
    "- 2017-06-18, Twelve-month Forecasts given data through 2017-03-01, robust HW:\n",
    "    - Inflation at 2.1% (to slightly exceed Fed target of 2.0%)\n",
    "    - Bonds: Zero10 price to decline -7.3%, so higher bond rates.\n",
    "    - SPX to climb higher by +13.3%.\n",
    "    - Gold expected to fall to \\$1211 in a year.\n",
    "    - USD 5.2% higher in light of higher expected interest rates.\n",
    "    - Home prices expected higher by 5.7% (some regions are over-bid)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# DAILY DATA, including major FX\n",
    "\n",
    "We examine bonds (zero coupon equivalent of 10-y Treasury), \n",
    "equities (SPX), gold (XAU), EURUSD, and USDJPY \n",
    "at higher frequency (daily) for the most recent developments. \n",
    "\n",
    "We skip: *inflation and the real trade-weighted USD index \n",
    "which have a slow monthly release schedule. \n",
    "As for US home price data, there is a three month lag.* "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "#  Specify daily series of interest as a dictionary\n",
    "#  where key is name, and value is its data code:\n",
    "dsdic = { 'Zero10' : d4zero10, 'SPX' : d4spx, 'XAU' : d4xau, \n",
    "          'EURUSD' : d4eurusd, 'USDJPY' : d4usdjpy }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " ::  S&P 500 prepend successfully goes back to 1957.\n"
     ]
    }
   ],
   "source": [
    "#  Download data into a dataframe:\n",
    "dsdf = groupget( dsdic )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "#  Construct the dega YoY percent dataframe:\n",
    "dega = grouppc( dsdf, freq=256 )\n",
    "#                         ^for daily data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#  Set the start date for daily series:\n",
    "u0 = '2010-01-01'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEKCAYAAAAGvn7fAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xu8HHV9//HXOyCKICSpylUT5CYC9YCAl1JzELEILaIt\nyO1nTvGn/WlRo+IFLIYUrxR/phVpq6gHFUFKFbFVudRsrBcEhCCCFy5JwCBRCREIFoF8+sd89+xw\ncs6ey+7Z+e7u+/l4bHLmsjOf/ezsd2c+851ZRQRmZtY7ZlUdgJmZtZcbdjOzHuOG3cysx7hhNzPr\nMW7Yzcx6jBt2M7Me44bdzKzHuGG3GSPpUEkrp/ncXSVtbHdMZv3ADXubSapJWifpSTO8nsWSPj+N\n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SuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xa7e2074c>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " ::  Finished: boxplot-Assets_YoYd.png\n"
     ]
    }
   ],
   "source": [
    "#  Plot overlapping percentage changes:\n",
    "boxplot( dega[u0:], 'Assets YoYd' )\n",
    "\n",
    "#  Note that the \"last\" timestamp will be more\n",
    "#  recent than for the monthly series."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Although monthly data is more suitable for making long-term forecasts, \n",
    "daily data is more sensitive to immediate market perturbations. \n",
    "\n",
    "2016-01-03  Good example of the foregoing remark is the \n",
    "reaction in the overall market due to the first Fed rate hike \n",
    "in almost a decade on 2015-12-16. ZIRP, zero interest rate program, \n",
    "has been terminated, along with US quantitative easing, \n",
    "thus asset prices must adjust to financing constraints. \n",
    "Note how equities and gold are now below their mid-range boxes.\n",
    "\n",
    "2017-06-18  Only Zero10 is below its mid-range box,\n",
    "due to recent Fed rate hikes.\n",
    "The upper outliers for the SPX is quite remarkable."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            EURUSD          SPX       USDJPY          XAU       Zero10\n",
      "count  1946.000000  1946.000000  1946.000000  1946.000000  1946.000000\n",
      "mean     -2.821745    12.635400     2.690537     4.866887     1.581339\n",
      "std       8.339085    10.355696    12.015074    17.209174     6.139394\n",
      "min     -23.984762   -12.887678   -19.052589   -29.210332   -13.248728\n",
      "25%      -8.763417     5.018106    -7.332421    -8.333041    -2.880033\n",
      "50%      -1.567266    12.417470     0.733089     2.222734     2.244734\n",
      "75%       2.985455    18.454224    13.279215    21.337671     5.178653\n",
      "max      21.056554    65.300874    30.357599    52.361809    18.075299\n",
      "\n",
      " ::  Index on min:\n",
      "EURUSD   2015-03-11\n",
      "SPX      2016-02-11\n",
      "USDJPY   2016-08-02\n",
      "XAU      2013-12-26\n",
      "Zero10   2010-01-07\n",
      "dtype: datetime64[ns]\n",
      "\n",
      " ::  Index on max:\n",
      "EURUSD   2011-06-06\n",
      "SPX      2010-03-02\n",
      "USDJPY   2013-05-28\n",
      "XAU      2011-09-06\n",
      "Zero10   2012-02-01\n",
      "dtype: datetime64[ns]\n",
      "\n",
      " ::  Head:\n",
      "              EURUSD        SPX    USDJPY        XAU     Zero10\n",
      "T                                                              \n",
      "2010-01-01  4.506344  22.574830  2.117389  27.081507 -11.463243\n",
      "2010-01-04  6.846980  27.252204  2.548476  32.369431 -11.776234\n",
      "2010-01-05  7.904398  30.595454  2.878992  35.822249 -11.858700\n",
      " ::  Tail:\n",
      "              EURUSD        SPX    USDJPY       XAU    Zero10\n",
      "T                                                            \n",
      "2017-06-14  0.133191  16.708315  4.399388  0.227880 -3.830308\n",
      "2017-06-15 -1.187312  16.639574  5.833971 -0.814326 -4.086157\n",
      "2017-06-16 -1.573903  15.134007  4.664778 -0.534802 -3.659073\n",
      "\n",
      " ::  Correlation matrix:\n",
      "          EURUSD       SPX    USDJPY       XAU    Zero10\n",
      "EURUSD  1.000000  0.348922 -0.206051  0.173383 -0.465412\n",
      "SPX     0.348922  1.000000  0.220328 -0.051298 -0.615448\n",
      "USDJPY -0.206051  0.220328  1.000000 -0.801828 -0.373293\n",
      "XAU     0.173383 -0.051298 -0.801828  1.000000  0.419836\n",
      "Zero10 -0.465412 -0.615448 -0.373293  0.419836  1.000000\n"
     ]
    }
   ],
   "source": [
    "stats(dega[u0:])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 2015-05-29, Suprisingly, very little correlation between EURUSD and USDJPY: -6%. Gold appears more correlated with USDJPY at -87% than EURUSD at +6%\n",
    "\n",
    "- 2016-01-05, Given the latest Fed hike, the correlation to watch is between equities and bonds (-0.69 SPX and Zero10).\n",
    "\n",
    "- 2017-06-18, Gold less correlated with USDJPY at -80%. Those expecting a sharp stock market decline are long bonds as a hedge, correlation at -61%."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "            EURUSD      SPX  USDJPY      XAU     Zero10\n",
       "T                                                      \n",
       "2017-06-08  1.1217  2433.79  110.10  1273.10  82.266927\n",
       "2017-06-09  1.1190  2431.77  110.61  1266.55  82.121206\n",
       "2017-06-12  1.1204  2429.39  109.72  1266.40  82.121206\n",
       "2017-06-13  1.1194  2440.35  110.12  1262.00  82.121206\n",
       "2017-06-14  1.1277  2437.92  109.16  1275.50  82.559190\n",
       "2017-06-15  1.1152  2432.46  110.66  1254.55  82.486022\n",
       "2017-06-16  1.1194  2433.15  110.84  1255.40  82.486022"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#  What are the latest daily prices?\n",
    "tail( dsdf )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[-3.72, -3.25, 9.41, 4.52, 256, 1945, 'EURUSD'],\n",
       " [9.18, 10.27, 15.02, 7.76, 256, 1945, 'SPX'],\n",
       " [1.81, 2.3, 9.88, 6.65, 256, 1945, 'USDJPY'],\n",
       " [0.32, 1.89, 16.93, 9.17, 256, 1945, 'XAU'],\n",
       " [1.71, 1.96, 7.2, 4.1, 256, 1945, 'Zero10']]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#  Geometric mean rates, non-overlapping, annualized:\n",
    "groupgemrat( dsdf[u0:], yearly=256 )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Closing remarks on daily data\n",
    "\n",
    "- 2014-10-11, Really near-term picture is too bright for SPX while XAU looks dark. Sell stocks, and start to accumulate gold.\n",
    "\n",
    "\n",
    "- 2015-05-28, XAU georet changed from 2.6% to 1.6%. Zero10 monthly forecast is basically unchanged. Real rate is what matters for gold. USD stronger by 4.8% against both the EUR and JPY.\n",
    "\n",
    "\n",
    "- 2016-01-03, XAU georet changed from 1.6% to -0.41%, commodities including oil going through a bear market. Bonds have not sold off despite 2015-12-16 Fed rate hike, probably due to world appetite for USD which is stronger by about 4.3% against EUR and JPY. SPX looks vulnerable given the past maxims about rate hikes, but the Fed is actually still very accomodative.\n",
    "\n",
    "\n",
    "- 2017-06-18, XAU gemrat appears stagnant at 0.44%. SPX still looks vulnerable given recent rate hikes, but the Fed is still accomodative despite very low unemployment. Bonds are set to accept money flow when the stock market tanks."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
