From ed47b4aa5e44815316a1639aa579abeef7c3c66e Mon Sep 17 00:00:00 2001 From: Caleb Hamilton Date: Sun, 5 May 2019 15:43:31 -0500 Subject: [PATCH 1/4] added ctype explanation and created data file --- time_series_analysis/cp_pelt.ipynb | 81 ++++++++++++++---------------- time_series_analysis/ts_data.txt | 1 + 2 files changed, 38 insertions(+), 44 deletions(-) create mode 100644 time_series_analysis/ts_data.txt diff --git a/time_series_analysis/cp_pelt.ipynb b/time_series_analysis/cp_pelt.ipynb index 2462d17..6bc6e39 100644 --- a/time_series_analysis/cp_pelt.ipynb +++ b/time_series_analysis/cp_pelt.ipynb @@ -13,45 +13,29 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": {}, + "execution_count": 7, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ - "y = [\n", - "1.41, 1.47, 1.49, 1.49, 1.54, 1.56, 1.54, 1.52, 1.54, 1.56, 1.59, 1.61,\n", - "1.61, 1.67, 1.64, 1.69, 1.72, 1.61, 1.61, 1.64, 1.64, 1.69, 1.69, 1.67,\n", - "1.59, 1.59, 1.59, 1.61, 1.61, 1.69, 1.69, 1.64, 1.64, 1.64, 1.64, 1.61,\n", - "1.61, 1.67, 1.67, 1.64, 1.64, 1.56, 1.56, 1.61, 1.59, 1.61, 1.59, 1.59,\n", - "1.56, 1.54, 1.47, 1.45, 1.45, 1.41, 1.45, 1.45, 1.47, 1.43, 1.47, 1.45,\n", - "1.43, 1.47, 1.52, 1.52, 1.49, 1.52, 1.52, 1.54, 1.49, 1.45, 1.45, 1.47,\n", - "1.43, 1.45, 1.47, 1.47, 1.49, 1.49, 1.49, 1.47, 1.47, 1.49, 1.47, 1.49,\n", - "1.47, 1.49, 1.47, 1.45, 1.47, 1.47, 1.45, 1.47, 1.49, 1.49, 1.52, 1.49,\n", - "1.49, 1.52, 1.49, 1.49, 1.47, 1.49, 1.49, 1.49, 1.49, 1.45, 1.45, 1.43,\n", - "1.35, 1.33, 1.32, 1.27, 1.28, 1.28, 1.27, 1.28, 1.23, 1.27, 1.27, 1.19,\n", - "1.05, 1.12, 1.12, 1.10, 1.14, 1.16, 1.18, 1.18, 1.15, 1.10, 1.11, 1.11,\n", - "1.12, 1.15, 1.11, 1.14, 1.16, 1.20, 1.22, 1.22, 1.22, 1.15, 1.16, 1.19,\n", - "1.16, 1.18, 1.19, 1.14, 1.12, 1.15, 1.11, 1.15, 1.14, 1.18, 1.18, 1.18,\n", - "1.20, 1.20, 1.20, 1.20, 1.23, 1.25, 1.25, 1.28, 1.27, 1.27, 1.25, 1.23,\n", - "1.23, 1.16, 1.16, 1.19, 1.19, 1.18, 1.18, 1.15, 1.19, 1.20, 1.19, 1.22,\n", - "1.20, 1.22, 1.22, 1.22, 1.22, 1.23, 1.27, 1.27, 1.27, 1.30, 1.28, 1.27,\n", - "1.28, 1.33, 1.39, 1.39, 1.37, 1.41, 1.43, 1.43, 1.37, 1.37, 1.41, 1.43,\n", - "1.37, 1.33, 1.30, 1.25, 1.28, 1.30, 1.20, 1.19, 1.19, 1.15, 1.11, 1.19,\n", - "1.18, 1.18, 1.18, 1.18, 1.19, 1.15, 1.15, 1.12, 1.10, 1.14, 1.15, 1.14,\n", - "1.14, 1.15, 1.12, 1.15, 1.14, 1.15, 1.14, 1.14, 1.12, 1.14, 1.15, 1.13\n", - "]" + "with open('ts_data.txt','r') as file:\n", + " y = eval(file.readline())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "We wish to look for changes in the mean, which is selected using the following `ctype` value in the NAG routine" + "We wish to look for changes in the mean, assuming the data comes from Normal distributions, which is selected by setting the `ctype` parameter of the `cp_pelt` routine to `1`. Other values for `ctype` can be used for different distributions and properties of the data, but the plot in this notebook assumes `ctype = 1`." ] }, { "cell_type": "code", - "execution_count": 2, - "metadata": {}, + "execution_count": 8, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "ctype = 1" @@ -66,8 +50,10 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, + "execution_count": 9, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "param = [0.2]" @@ -82,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -101,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -138,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -223,7 +209,7 @@ " };\n", "\n", " this.imageObj.onunload = function() {\n", - " fig.ws.close();\n", + " this.ws.close();\n", " }\n", "\n", " this.ws.onmessage = this._make_on_message_function(this);\n", @@ -698,9 +684,9 @@ "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n", " this.message.textContent = tooltip;\n", "};\n", - "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n", + "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n", "\n", - "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n", + "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n", "\n", "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n", " // Create a \"websocket\"-like object which calls the given IPython comm\n", @@ -718,7 +704,7 @@ " // Register the callback with on_msg.\n", " comm.on_msg(function(msg) {\n", " //console.log('receiving', msg['content']['data'], msg);\n", - " // Pass the mpl event to the overridden (by mpl) onmessage function.\n", + " // Pass the mpl event to the overriden (by mpl) onmessage function.\n", " ws.onmessage(msg['content']['data'])\n", " });\n", " return ws;\n", @@ -870,12 +856,9 @@ " // Check for shift+enter\n", " if (event.shiftKey && event.which == 13) {\n", " this.canvas_div.blur();\n", - " event.shiftKey = false;\n", - " // Send a \"J\" for go to next cell\n", - " event.which = 74;\n", - " event.keyCode = 74;\n", - " manager.command_mode();\n", - " manager.handle_keydown(event);\n", + " // select the cell after this one\n", + " var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n", + " IPython.notebook.select(index + 1);\n", " }\n", "}\n", "\n", @@ -924,7 +907,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -961,9 +944,19 @@ "plt.legend(handles=[vl, hl], loc='upper right')\n", "plt.show()" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", @@ -979,7 +972,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.0" + "version": "3.6.2" } }, "nbformat": 4, diff --git a/time_series_analysis/ts_data.txt b/time_series_analysis/ts_data.txt new file mode 100644 index 0000000..0f74771 --- /dev/null +++ b/time_series_analysis/ts_data.txt @@ -0,0 +1 @@ +[1.41, 1.47, 1.49, 1.49, 1.54, 1.56, 1.54, 1.52, 1.54, 1.56, 1.59, 1.61, 1.61, 1.67, 1.64, 1.69, 1.72, 1.61, 1.61, 1.64, 1.64, 1.69, 1.69, 1.67, 1.59, 1.59, 1.59, 1.61, 1.61, 1.69, 1.69, 1.64, 1.64, 1.64, 1.64, 1.61, 1.61, 1.67, 1.67, 1.64, 1.64, 1.56, 1.56, 1.61, 1.59, 1.61, 1.59, 1.59, 1.56, 1.54, 1.47, 1.45, 1.45, 1.41, 1.45, 1.45, 1.47, 1.43, 1.47, 1.45, 1.43, 1.47, 1.52, 1.52, 1.49, 1.52, 1.52, 1.54, 1.49, 1.45, 1.45, 1.47, 1.43, 1.45, 1.47, 1.47, 1.49, 1.49, 1.49, 1.47, 1.47, 1.49, 1.47, 1.49, 1.47, 1.49, 1.47, 1.45, 1.47, 1.47, 1.45, 1.47, 1.49, 1.49, 1.52, 1.49, 1.49, 1.52, 1.49, 1.49, 1.47, 1.49, 1.49, 1.49, 1.49, 1.45, 1.45, 1.43, 1.35, 1.33, 1.32, 1.27, 1.28, 1.28, 1.27, 1.28, 1.23, 1.27, 1.27, 1.19, 1.05, 1.12, 1.12, 1.1, 1.14, 1.16, 1.18, 1.18, 1.15, 1.1, 1.11, 1.11, 1.12, 1.15, 1.11, 1.14, 1.16, 1.2, 1.22, 1.22, 1.22, 1.15, 1.16, 1.19, 1.16, 1.18, 1.19, 1.14, 1.12, 1.15, 1.11, 1.15, 1.14, 1.18, 1.18, 1.18, 1.2, 1.2, 1.2, 1.2, 1.23, 1.25, 1.25, 1.28, 1.27, 1.27, 1.25, 1.23, 1.23, 1.16, 1.16, 1.19, 1.19, 1.18, 1.18, 1.15, 1.19, 1.2, 1.19, 1.22, 1.2, 1.22, 1.22, 1.22, 1.22, 1.23, 1.27, 1.27, 1.27, 1.3, 1.28, 1.27, 1.28, 1.33, 1.39, 1.39, 1.37, 1.41, 1.43, 1.43, 1.37, 1.37, 1.41, 1.43, 1.37, 1.33, 1.3, 1.25, 1.28, 1.3, 1.2, 1.19, 1.19, 1.15, 1.11, 1.19, 1.18, 1.18, 1.18, 1.18, 1.19, 1.15, 1.15, 1.12, 1.1, 1.14, 1.15, 1.14, 1.14, 1.15, 1.12, 1.15, 1.14, 1.15, 1.14, 1.14, 1.12, 1.14, 1.15, 1.13] \ No newline at end of file From 6c9a467c421768c18bff73b378bf4c68ae607ea9 Mon Sep 17 00:00:00 2001 From: Caleb Hamilton Date: Fri, 30 Aug 2019 15:25:34 -0500 Subject: [PATCH 2/4] switched back to hardcoded y and fixed bad tick labels in plot --- time_series_analysis/cp_pelt.ipynb | 80 +++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/time_series_analysis/cp_pelt.ipynb b/time_series_analysis/cp_pelt.ipynb index 6bc6e39..bec5c51 100644 --- a/time_series_analysis/cp_pelt.ipynb +++ b/time_series_analysis/cp_pelt.ipynb @@ -13,14 +13,34 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "metadata": { "collapsed": true }, "outputs": [], "source": [ - "with open('ts_data.txt','r') as file:\n", - " y = eval(file.readline())" + "y = [\n", + "1.41, 1.47, 1.49, 1.49, 1.54, 1.56, 1.54, 1.52, 1.54, 1.56, 1.59, 1.61,\n", + "1.61, 1.67, 1.64, 1.69, 1.72, 1.61, 1.61, 1.64, 1.64, 1.69, 1.69, 1.67,\n", + "1.59, 1.59, 1.59, 1.61, 1.61, 1.69, 1.69, 1.64, 1.64, 1.64, 1.64, 1.61,\n", + "1.61, 1.67, 1.67, 1.64, 1.64, 1.56, 1.56, 1.61, 1.59, 1.61, 1.59, 1.59,\n", + "1.56, 1.54, 1.47, 1.45, 1.45, 1.41, 1.45, 1.45, 1.47, 1.43, 1.47, 1.45,\n", + "1.43, 1.47, 1.52, 1.52, 1.49, 1.52, 1.52, 1.54, 1.49, 1.45, 1.45, 1.47,\n", + "1.43, 1.45, 1.47, 1.47, 1.49, 1.49, 1.49, 1.47, 1.47, 1.49, 1.47, 1.49,\n", + "1.47, 1.49, 1.47, 1.45, 1.47, 1.47, 1.45, 1.47, 1.49, 1.49, 1.52, 1.49,\n", + "1.49, 1.52, 1.49, 1.49, 1.47, 1.49, 1.49, 1.49, 1.49, 1.45, 1.45, 1.43,\n", + "1.35, 1.33, 1.32, 1.27, 1.28, 1.28, 1.27, 1.28, 1.23, 1.27, 1.27, 1.19,\n", + "1.05, 1.12, 1.12, 1.10, 1.14, 1.16, 1.18, 1.18, 1.15, 1.10, 1.11, 1.11,\n", + "1.12, 1.15, 1.11, 1.14, 1.16, 1.20, 1.22, 1.22, 1.22, 1.15, 1.16, 1.19,\n", + "1.16, 1.18, 1.19, 1.14, 1.12, 1.15, 1.11, 1.15, 1.14, 1.18, 1.18, 1.18,\n", + "1.20, 1.20, 1.20, 1.20, 1.23, 1.25, 1.25, 1.28, 1.27, 1.27, 1.25, 1.23,\n", + "1.23, 1.16, 1.16, 1.19, 1.19, 1.18, 1.18, 1.15, 1.19, 1.20, 1.19, 1.22,\n", + "1.20, 1.22, 1.22, 1.22, 1.22, 1.23, 1.27, 1.27, 1.27, 1.30, 1.28, 1.27,\n", + "1.28, 1.33, 1.39, 1.39, 1.37, 1.41, 1.43, 1.43, 1.37, 1.37, 1.41, 1.43,\n", + "1.37, 1.33, 1.30, 1.25, 1.28, 1.30, 1.20, 1.19, 1.19, 1.15, 1.11, 1.19,\n", + "1.18, 1.18, 1.18, 1.18, 1.19, 1.15, 1.15, 1.12, 1.10, 1.14, 1.15, 1.14,\n", + "1.14, 1.15, 1.12, 1.15, 1.14, 1.15, 1.14, 1.14, 1.12, 1.14, 1.15, 1.13\n", + "]" ] }, { @@ -32,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "metadata": { "collapsed": true }, @@ -50,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 18, "metadata": { "collapsed": true }, @@ -68,8 +88,10 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": {}, + "execution_count": 19, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from naginterfaces.library import tsa\n", @@ -87,7 +109,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -111,7 +133,7 @@ "print('='*50)\n", "for tau_i, tau_val in enumerate(soln.tau):\n", " print('{:4d} {:6d} {:12.2f} {:12.2f}'.format(\n", - " tau_i+1, tau_val, soln.sparam[2*tau_i], soln.sparam[2*tau_i+1],\n", + " tau_i+1, tau_val, soln.sparam[0][tau_i], soln.sparam[1][tau_i],\n", " ))" ] }, @@ -124,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -686,7 +708,7 @@ "};\n", "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n", "\n", - "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n", + "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n", "\n", "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n", " // Create a \"websocket\"-like object which calls the given IPython comm\n", @@ -907,7 +929,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -927,13 +949,14 @@ "for tau_i, tau_val in enumerate(soln.tau):\n", " vl = plt.axvline(tau_val, label='Change pt.')\n", " hl = plt.hlines(\n", - " soln.sparam[2*tau_i],\n", + " soln.sparam[0][tau_i],\n", " xmin=last_cp, xmax=tau_val, color='g', label='Mean',\n", " )\n", " last_cp = tau_val\n", "plt.xlim((1, len(y)))\n", - "t11 = ['1999 Initiation of Euro', '2008 Financial Crisis', '2016 UK EU Referendum']\n", - "t12 = (0, soln.tau[1]-4, soln.tau[3]-4)\n", + "t11 = ['1999', '2008', '2016']\n", + "t12 = [0, 9*12, 17*12]\n", + "#t12 = (0, soln.tau[1]-4, soln.tau[3]-4)\n", "plt.xticks(t12, t11, size='small')\n", "plt.xlabel('Time - January 1999 to December 2018')\n", "plt.ylabel('Euros per Pound')\n", @@ -942,7 +965,28 @@ " '(FX data from www.macrotrends.net)\\n'\n", " 'Showing change points determined in the mean')\n", "plt.legend(handles=[vl, hl], loc='upper right')\n", - "plt.show()" + "plt.show()\n", + "#Initiation of Euro, Financial Crisis, UK EU Referendum" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "range(0, 19)" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "range(19)" ] }, { @@ -958,7 +1002,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python [default]", "language": "python", "name": "python3" }, @@ -972,7 +1016,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.2" + "version": "3.5.3" } }, "nbformat": 4, From 3af8e416e871465aca77976b290c3e6ef549aa4d Mon Sep 17 00:00:00 2001 From: Caleb Hamilton Date: Fri, 30 Aug 2019 15:29:03 -0500 Subject: [PATCH 3/4] cleaned up extra cells --- time_series_analysis/cp_pelt.ipynb | 32 ++++++------------------------ 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/time_series_analysis/cp_pelt.ipynb b/time_series_analysis/cp_pelt.ipynb index bec5c51..9cee394 100644 --- a/time_series_analysis/cp_pelt.ipynb +++ b/time_series_analysis/cp_pelt.ipynb @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -70,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 3, "metadata": { "collapsed": true }, @@ -88,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 4, "metadata": { "collapsed": true }, @@ -109,7 +109,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -146,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -969,26 +969,6 @@ "#Initiation of Euro, Financial Crisis, UK EU Referendum" ] }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "range(0, 19)" - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "range(19)" - ] - }, { "cell_type": "code", "execution_count": null, From ed16e5eaffd5e895e6484c4dc5a6ffadfb9ccc30 Mon Sep 17 00:00:00 2001 From: Caleb Hamilton Date: Fri, 30 Aug 2019 15:55:52 -0500 Subject: [PATCH 4/4] more cleanup and final hardcode of historic event labels --- time_series_analysis/cp_pelt.ipynb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/time_series_analysis/cp_pelt.ipynb b/time_series_analysis/cp_pelt.ipynb index 9cee394..9bbbb87 100644 --- a/time_series_analysis/cp_pelt.ipynb +++ b/time_series_analysis/cp_pelt.ipynb @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 25, "metadata": { "collapsed": true }, @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 26, "metadata": { "collapsed": true }, @@ -70,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 46, "metadata": { "collapsed": true }, @@ -88,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 47, "metadata": { "collapsed": true }, @@ -109,7 +109,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 48, "metadata": {}, "outputs": [ { @@ -146,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 49, "metadata": {}, "outputs": [ { @@ -929,7 +929,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -954,9 +954,8 @@ " )\n", " last_cp = tau_val\n", "plt.xlim((1, len(y)))\n", - "t11 = ['1999', '2008', '2016']\n", + "t11 = ['1999 Initiation of Euro', '2008 Financial Crisis', '2016 UK EU Referendum']\n", "t12 = [0, 9*12, 17*12]\n", - "#t12 = (0, soln.tau[1]-4, soln.tau[3]-4)\n", "plt.xticks(t12, t11, size='small')\n", "plt.xlabel('Time - January 1999 to December 2018')\n", "plt.ylabel('Euros per Pound')\n", @@ -965,8 +964,7 @@ " '(FX data from www.macrotrends.net)\\n'\n", " 'Showing change points determined in the mean')\n", "plt.legend(handles=[vl, hl], loc='upper right')\n", - "plt.show()\n", - "#Initiation of Euro, Financial Crisis, UK EU Referendum" + "plt.show()" ] }, {