{ "metadata": { "name": "", "signature": "sha256:99159f50a56b9d50b0e82032368b63351365330ee92a1dab740c272b8f0e6af5" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Geometric mean returns on FRED series" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We examine economic and financial time series where Holt-Winters is used to forecast one-year ahead. Daily data for bonds, equity, and gold is then analyzed.\n", "\n", "The focus is on geometric mean returns because they optimally express mean-variance under logarithmic utility." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*Dependencies:*\n", "\n", " - Linux, bash\n", " - Python: matplotlib, pandas\n", " - Modules: yi_1tool, yi_plot, yi_timeseries, yi_fred\n", " \n", "*CHANGE LOG*\n", "\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", "collapsed": false, "input": [ "# NOTEBOOK settings and system details: [00-tpl v14.12.21]\n", "\n", "# Assume that the backend is LINUX (our particular distro is Ubuntu, running bash shell):\n", "print '\\n :: TIMESTAMP of last notebook execution:'\n", "!date\n", "print '\\n :: IPython version:'\n", "!ipython --version\n", "\n", "# Automatically reload modified modules:\n", "%load_ext autoreload\n", "%autoreload 2\n", "# 0 disables autoreload.\n", "# Generate plots inside notebook:\n", "%matplotlib inline\n", "\n", "# DISPLAY options\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.display import HTML # useful for snippets\n", "# e.g. HTML('')\n", "\n", "import pandas as pd\n", "print '\\n :: pandas version:'\n", "print pd.__version__\n", "# pandas DataFrames are represented as text by default; enable HTML representation:\n", "# [Deprecated: pd.core.format.set_printoptions( notebook_repr_html=True ) ]\n", "pd.set_option( 'display.notebook_repr_html', False )\n", "\n", "# MATH display, use %%latex, rather than the following:\n", "# from IPython.display import Math\n", "# from IPython.display import Latex\n", "\n", "print '\\n :: Working directory (set as $workd):'\n", "workd, = !pwd\n", "print workd + '\\n'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", " :: TIMESTAMP of last notebook execution:\n", "Thu Jun 25 20:35:28 PDT 2015\r\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", " :: IPython version:\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "2.3.0\r\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", " :: pandas version:\n", "0.15.0\n", "\n", " :: Working directory (set as $workd):\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "/home/yaya/Dropbox/share/git/nous/fecon235/nb\n", "\n" ] } ], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "from yi_1tools import *\n", "from yi_plot import *\n", "from yi_timeseries import *\n", "from yi_fred import *" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Download data and construct a dataframe" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We shall retrieve the following data of monthly frequency: **(aggregated) inflation, bonds (zero coupon equivalent of 10-y Treasury), equities (S&P 500), and gold (London PM fix) -- all denominated in US dollars -- then lastly, the real trade-weighted USD index (Federal Reserve) and US home prices (per Case-Shiller).** The details for each series is given in their respective notebooks.\n", "\n", "*Home prices will create a 3-month lag, due to their release cycle.*" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Specify monthly series of interest as ms list:\n", "ms = [ m4infl, m4zero10, m4spx, m4xau, m4usdrtb, m4homepx ]\n", "names = ['Infl', 'Zero10', 'SPX', 'XAU', 'USD', 'Homes']\n", "\n", "# Download into a dictionary:\n", "msd = {}\n", "for i in ms:\n", " msd[i] = getfred(i)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " :: S&P 500 prepend successfully goes back to 1957.\n", " :: Case-Shiller prepend successfully goes back to 1987." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n" ] } ], "prompt_number": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ "After downloading the level series, we compute the YoY percentage change for each series. *This will be the a trailing 12-month statistic, thus it's overlapping.*" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Compute the YoY percentage change:\n", "msdc = {}\n", "for i in ms:\n", " msdc[i] = pcent( msd[i], 12 )" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "# Construct the mega YoY dataframe:\n", "mega = paste( [ msdc[i] for i in ms ] )\n", "# Give names to the columns for mega:\n", "mega.columns = names" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Define start time and get stats" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Start time given by t0\n", "t0 = '1988'" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 6 }, { "cell_type": "code", "collapsed": false, "input": [ "stats( mega[t0:] )" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Infl Zero10 SPX XAU USD Homes\n", "count 327.000000 327.000000 327.000000 327.000000 327.000000 327.000000\n", "mean 2.424121 2.229173 8.753083 4.949457 -0.286063 3.882495\n", "std 1.005295 7.463804 16.416248 15.524655 4.982369 8.088091\n", "min -0.180575 -18.521264 -42.349361 -27.752361 -10.577564 -18.906156\n", "25% 1.690927 -3.217100 2.288186 -6.463883 -3.809645 -1.218646\n", "50% 2.366964 2.912582 10.726925 1.898076 -0.357301 4.293769\n", "75% 2.887417 7.752083 19.981864 14.325670 2.682498 10.684985\n", "max 5.242059 20.492399 52.051354 60.357143 14.508997 17.077118\n", "\n", " :: Index on min:\n", "Infl 2009-07-01\n", "Zero10 1994-10-01\n", "SPX 2009-03-01\n", "XAU 2013-12-01\n", "USD 2008-03-01\n", "Homes 2009-01-01\n", "dtype: datetime64[ns]\n", "\n", " :: Index on max:\n", "Infl 1990-10-01\n", "Zero10 1996-01-01\n", "SPX 2010-03-01\n", "XAU 2006-05-01\n", "USD 2009-03-01\n", "Homes 2004-07-01\n", "dtype: datetime64[ns]\n", "\n", " :: Head:\n", " Infl Zero10 SPX XAU USD Homes\n", "T \n", "1988-01-01 3.984315 -12.661625 -6.207571 17.042392 -9.836868 12.139461\n", "1988-02-01 3.876021 -8.068941 -8.186030 9.982617 -8.633477 11.661442\n", "1988-03-01 3.924380 -9.248410 -8.156954 8.841782 -9.393214 11.345646\n", "1988-04-01 3.992870 -5.477528 -8.960111 2.878355 -8.283502 10.974485\n", "1988-05-01 4.017727 -4.487925 -11.871026 -1.578661 -7.507266 10.543908\n", "1988-06-01 4.129092 -4.738070 -10.689462 0.022137 -7.401580 10.559567\n", "1988-07-01 4.276206 -5.671538 -12.487441 -3.115990 -6.469468 10.756853\n", "\n", " :: Tail:\n", " Infl Zero10 SPX XAU USD Homes\n", "T \n", "2014-09-01 1.573155 2.870055 18.259104 -8.035048 1.924209 4.982426\n", "2014-10-01 1.590927 2.873362 13.047620 -6.736243 4.278896 4.557101\n", "2014-11-01 1.397419 3.603244 14.134137 -8.234146 4.984866 4.353347\n", "2014-12-01 1.098285 6.108084 14.380677 -2.298029 6.786695 4.482448\n", "2015-01-01 0.731306 9.213133 10.175566 1.235684 7.608924 4.485425\n", "2015-02-01 0.806330 6.585098 14.399577 -7.207207 8.760392 4.996752\n", "2015-03-01 0.849246 6.019017 11.453936 -11.421092 10.734463 4.990347" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " :: Correlation matrix:\n", " Infl Zero10 SPX XAU USD Homes\n", "Infl 1.000000 -0.059018 -0.016182 -0.072354 -0.308788 0.005064\n", "Zero10 -0.059018 1.000000 -0.137220 -0.000802 0.214137 -0.295339\n", "SPX -0.016182 -0.137220 1.000000 -0.212138 -0.049899 0.248055\n", "XAU -0.072354 -0.000802 -0.212138 1.000000 -0.513692 -0.244964\n", "USD -0.308788 0.214137 -0.049899 -0.513692 1.000000 0.039124\n", "Homes 0.005064 -0.295339 0.248055 -0.244964 0.039124 1.000000" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n" ] } ], "prompt_number": 7 }, { "cell_type": "markdown", "metadata": {}, "source": [ "There is not much correlation among our assets, except a mild negative between gold XAU and USD. Next, the boxplot gives us an idea of the range of returns, and their persistence. It's a visual aid to the geometric mean returns which is most significant as investment metric." ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Overlapping YoY percentage change, recently:\n", "boxplot(mega[t0:], 'Assets YoYm')\n", "# where the red dot represents the latest point." ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEKCAYAAAACS67iAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcXFWZ//HPV4JE2TpxIYBgY4BBENKoMDgqNFuC4gDi\njIALaZfR+emwqKMsAZOIYoAZRTLuC4k6ILixRWLikAoiCi50RMKiQDQICWLYwqYkz++Pcyp9U6nq\npapu3aWe9+tVr667n6du1alTzz33tMwM55xzxfecrAvgnHOuPbxCd865kvAK3TnnSsIrdOecKwmv\n0J1zriS8QnfOuZLwCt0550rCK3SXS5LmSTon63I4VyReobeBpIqkNZKem/JxZkn6VhPbHS5ptaQX\nJOZtIel2Se9r1zbNkPRjSYfVWWTx0cq+ByT9dIR1/kvSXZIei7G9s2Z5n6RfS3pC0q8kTUkse0Us\n/18kra+z74qkpyQ9Hh+3j1CWiZJ+KGmtpBWSTkgs2zMef42kRyT9TNLrRtjfoZLuiGW/TtLOiWUH\nS1oS93XvcPsZ6XWIyz8k6QFJj0r6+nCfheHiHKncDfZ3nqSH4mNOzbLeGOcT8fweOlKsReYVeosk\n9QL7Aw8CR2VamAbMbDFwNfC5xOyzgD+b2Vfatc1YSdoSeBWwtNEq7Tj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cZ1NPk5Iy9xFuED6WUlbpFzMpsTrFV8ETokXSC8A/puQM59pZrvEx47ADgq9X34FvFbS\ndnEfrybcuLcymygaM7O1wAMKo68SK+xphC+uIxMX7Hcn3JfycO0+JB0E/Bvw1c6UekxuJPySgtCh\n4vph1k0y4BeE8zgZQkNE0m7x89wTGyEfJqRL2yLXrdYmDNcqbbQsDz9j/53QYvtSTYeVTxN+7v08\nzn8ceAc1PR7M7Iexp8iyOP+j1VyspJ8SUjVbSVoJvNvMFgOnAd+R9ElC/vLrqUY4vK2AuZJ6CB/6\n3xPyqd+j5vxI2oswoucUADMblPRjQjyf6GShR+nfgBVm9n9x+gvAuwiVxMtr1v0hcJyZXSDpFOBH\n8drJ4+T7oumJwOcV7g4HmGVm90o6F/iMpCcJ5/XtZmYKw34cJ+l1wPMJrfljzezOTEpfv66ozjsJ\nuFjSR4EHCeeu3nab1CPxzvkB4NJEg2MG4XxeKWk8ocHyoZYjiPzGIuecK4luSrk451ypeYXunHMl\n4RW6c86VhFfozjlXEl6hO+dcSXiF7pxzJeEVunPOlYRX6M45VxL/HwzEUKz0QdEJAAAAAElFTkSu\nQmCC\n", "text": [ "" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " :: Finished: boxplot-Assets_YoYm.png\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Geometric mean returns on non-overlapping periods" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Geometric mean returns, non-overlapping, annualized:\n", "for i in range(len(ms)):\n", " print names[i], georet(msd[ms[i]][t0:], 12)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Infl " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[2.33, 2.33, 0.5, 12]\n", "Zero10 " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[2.0, 2.25, 7.19, 12]\n", "SPX " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[7.82, 8.57, 12.23, 12]\n", "XAU " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[3.28, 4.14, 13.09, 12]\n", "USD " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[0.03, 0.12, 4.12, 12]\n", "Homes " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[3.43, 3.46, 2.55, 12]\n" ] } ], "prompt_number": 9 }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Note: the geometric returns do not include interest and dividend payouts for bonds and equities. Some observations in chronological order:\n", "\n", "- 2014-09-01, georet since 2010\n", " - Inflation at 1.7% which is below Fed target of 2%.\n", " - Total return on bonds, approx 2.52 + 2.33 = 4.85%\n", " - Total return on equity, approx. 11.9 + 2 = 13.9% -- very heated.\n", " - Gold indecisive about breaking 1260 LTS.\n", " - USD though at -0.69%, will strengthen given Draghi wanting weak EUR.\n", " \n", " \n", " - 2014-10-11, georet since 2004\n", " - Inflation over ten years is running 2% annually.\n", " - Gold dominates over ten years.\n", " - Gold recently holds at 1180 triple local bottom.\n", "\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", "- 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)." ] }, { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Forecasts using Holt-Winters method" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We forecast one-year ahead using the monthly data. Note that current infl is rebased to 1, thus 1.02 would signify 2% increase." ] }, { "cell_type": "code", "collapsed": false, "input": [ "# 12-periods ahead forecasts use default alpha and beta values (robust update):\n", "for i in range(len(ms)):\n", " print names[i] \n", " print holtfred(msd[ ms[i]], h=12 )\n", " # ^we use all available data to forecast\n", " print '------------------------------------'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Infl\n", " Forecast\n", "0 1.000000\n", "1 0.998873\n", "2 0.999353\n", "3 0.999834\n", "4 1.000314\n", "5 1.000794\n", "6 1.001274\n", "7 1.001755\n", "8 1.002235\n", "9 1.002715\n", "10 1.003195\n", "11 1.003675\n", "12 1.004156" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "------------------------------------\n", "Zero10\n", " Forecast\n", "0 80.929358\n", "1 83.871671\n", "2 84.151155\n", "3 84.430640\n", "4 84.710124\n", "5 84.989608\n", "6 85.269093\n", "7 85.548577\n", "8 85.828062\n", "9 86.107546\n", "10 86.387030\n", "11 86.666515\n", "12 86.945999" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "------------------------------------\n", "SPX\n", " Forecast\n", "0 2105.200000\n", "1 2146.564284\n", "2 2161.256033\n", "3 2175.947782\n", "4 2190.639532\n", "5 2205.331281\n", "6 2220.023030\n", "7 2234.714780\n", "8 2249.406529\n", "9 2264.098278\n", "10 2278.790028\n", "11 2293.481777\n", "12 2308.173527" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "------------------------------------\n", "XAU\n", " Forecast\n", "0 1178.500000\n", "1 1178.805087\n", "2 1172.707278\n", "3 1166.609470\n", "4 1160.511661\n", "5 1154.413853\n", "6 1148.316045\n", "7 1142.218236\n", "8 1136.120428\n", "9 1130.022619\n", "10 1123.924811\n", "11 1117.827002\n", "12 1111.729194" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "------------------------------------\n", "USD\n", " Forecast\n", "0 93.018000\n", "1 95.042219\n", "2 95.923105\n", "3 96.803990\n", "4 97.684876\n", "5 98.565762\n", "6 99.446648\n", "7 100.327534\n", "8 101.208420\n", "9 102.089306\n", "10 102.970192\n", "11 103.851077\n", "12 104.731963" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "------------------------------------\n", "Homes\n", " Forecast\n", "0 214289.270829\n", "1 212418.051023\n", "2 213348.196411\n", "3 214278.341799\n", "4 215208.487187\n", "5 216138.632575\n", "6 217068.777963\n", "7 217998.923351\n", "8 218929.068739\n", "9 219859.214127\n", "10 220789.359515\n", "11 221719.504904\n", "12 222649.650292" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "------------------------------------\n" ] } ], "prompt_number": 10 }, { "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" ] }, { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "DAILY DATA" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We examine bonds (zero coupon equivalent of 10-y Treasury), equities (SPX), gold (XAU), EURUSD, and USDJPY at higher frequency (daily) for the most recent developments. \n", "\n", "[Inflation, real trade-weighted USD, and US home price data have a slow release schedule (monthly).] " ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Specify daily series of interest:\n", "ds = [ d4zero10, d4spx, d4xau, d4eurusd, d4usdjpy ]\n", "names = [ 'Zero10', 'SPX', 'XAU', 'EURUSD', 'USDJPY' ]\n", "\n", "# Download into a dictionary:\n", "dsd = {}\n", "for i in ds:\n", " dsd[i] = getfred(i)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " :: S&P 500 prepend successfully goes back to 1957.\n" ] } ], "prompt_number": 11 }, { "cell_type": "code", "collapsed": false, "input": [ "# Compute the YoY percentage change (overlaping):\n", "dsdc = {}\n", "for i in ds:\n", " dsdc[i] = pcent( dsd[i], 256 )" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 12 }, { "cell_type": "code", "collapsed": false, "input": [ "# Construct the YoY dataframe:\n", "dega = paste( [ dsdc[i] for i in ds ] )\n", "# Give names to the columns for mega:\n", "dega.columns = names" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 13 }, { "cell_type": "code", "collapsed": false, "input": [ "# Start from the recent:\n", "u0 = '2010-01-01'" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 14 }, { "cell_type": "code", "collapsed": false, "input": [ "# Overlapping YoY percentage change, recently:\n", "boxplot( dega[u0:], 'Assets YoYd' )" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEKCAYAAAACS67iAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xu8XFV5//HPFwIJgnASKwQRORqKCCpBKT8vKTncklRA\nqbaiWOForfXlj0t+tspNm1DFcqkKBLXVWhMr1ypaIAJJJRPAIogSpERugSCggBAChEjk8vz+WGvO\n3hlm5pycuew1s5/36zWvM/syez/znD1r1jx7zR6ZGc4553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n", "text": [ "" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " :: Finished: boxplot-Assets_YoYd.png\n" ] } ], "prompt_number": 15 }, { "cell_type": "code", "collapsed": false, "input": [ "# Geometric mean returns, non-overlapping, annualized:\n", "for i in range(len(ds)):\n", " print names[i], georet( dsd[ds[i]][u0:] )" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Zero10 " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[2.33, 2.61, 7.52, 256]\n", "SPX " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[11.36, 12.57, 15.53, 256]\n", "XAU " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[1.36, 2.89, 17.49, 256]\n", "EURUSD " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[-4.21, -3.77, 9.43, 256]\n", "USDJPY " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "[4.96, 5.4, 9.33, 256]\n" ] } ], "prompt_number": 16 }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Forecast log for 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." ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Show esp. correlations:\n", "stats( dega[u0:] )" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Zero10 SPX XAU EURUSD USDJPY\n", "count 1426.000000 1426.000000 1426.000000 1426.000000 1426.000000\n", "mean 1.902672 15.245862 5.972715 -2.194030 4.307208\n", "std 6.762567 9.818755 18.978442 8.842339 12.024459\n", "min -13.248728 -5.657641 -29.210332 -23.984762 -14.310589\n", "25% -3.402214 9.723296 -8.516970 -8.651129 -6.838512\n", "50% 2.684079 14.060072 2.285300 -0.706405 1.967362\n", "75% 6.184020 20.287348 24.319358 4.492467 15.174316\n", "max 18.075299 65.300874 52.361809 21.056554 30.357599\n", "\n", " :: Index on min:\n", "Zero10 2010-01-07\n", "SPX 2011-10-03\n", "XAU 2013-12-26\n", "EURUSD 2015-03-11\n", "USDJPY 2011-03-17\n", "dtype: datetime64[ns]\n", "\n", " :: Index on max:\n", "Zero10 2012-02-01\n", "SPX 2010-03-02\n", "XAU 2011-09-06\n", "EURUSD 2011-06-06\n", "USDJPY 2013-05-28\n", "dtype: datetime64[ns]\n", "\n", " :: Head:\n", " Zero10 SPX XAU EURUSD USDJPY\n", "T \n", "2010-01-01 -11.463243 22.574830 27.081507 4.506344 2.117389\n", "2010-01-04 -11.776234 27.252204 32.369431 6.846980 2.548476\n", "2010-01-05 -11.858700 30.595454 35.822249 7.904398 2.878992\n", "2010-01-06 -12.554147 30.437376 36.721113 9.137748 3.212493\n", "2010-01-07 -13.248728 35.492867 37.583688 8.653408 4.513889\n", "2010-01-08 -13.173018 35.702942 39.104938 9.645639 3.471370\n", "2010-01-11 -12.321456 34.919776 38.290855 9.755361 1.783143\n", "\n", " :: Tail:\n", " Zero10 SPX XAU EURUSD USDJPY\n", "T \n", "2015-06-11 1.966382 7.760938 -7.186454 -17.181396 21.006265\n", "2015-06-12 2.237337 6.870700 -8.522815 -17.195301 21.003535\n", "2015-06-15 2.418714 6.192973 -9.988571 -17.076402 20.794987\n", "2015-06-16 2.782262 6.811338 -10.334983 -17.325094 21.089303\n", "2015-06-17 2.419197 7.715977 -10.656049 -17.250515 21.658670\n", "2015-06-18 1.966775 8.252489 -8.726030 -16.380701 20.756757\n", "2015-06-19 2.419923 7.805459 -8.259958 -16.715650 20.696439" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " :: Correlation matrix:\n", " Zero10 SPX XAU EURUSD USDJPY\n", "Zero10 1.000000 -0.750870 0.418415 -0.575325 -0.417933\n", "SPX -0.750870 1.000000 -0.152196 0.404478 0.159153\n", "XAU 0.418415 -0.152196 1.000000 0.074339 -0.866292\n", "EURUSD -0.575325 0.404478 0.074339 1.000000 -0.093702\n", "USDJPY -0.417933 0.159153 -0.866292 -0.093702 1.000000" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n" ] } ], "prompt_number": 17 }, { "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%" ] } ], "metadata": {} } ] }