<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/markets-performance-after-election-day-239/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.quintuitive.com/2017/10/21/markets-performance-election-day-239/"> R – Quintuitive</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>When I wrote <a rel="nofollow" href="http://www.quintuitive.com/2017/10/16/markets-performance-election/" target="_blank">the original post</a>, I wasn’t planning on writing a follow-up. Certainly not the week after. But what a difference a week can make in a dynamic system like the US stock market.</p>
<p><span></span></p>
<p>While re-running the computations testing <a rel="nofollow" href="https://www.rstudio.com/" target="_blank">the latest version of RStudio</a>, I noticed something surprising – President Trump’s rally has advanced to 2nd place!</p>
<p><a rel="nofollow" href="https://i0.wp.com/www.quintuitive.com/wp-content/uploads/2017/10/rallies-1.png" target="_blank"><img sizes="(max-width: 720px) 100vw, 720px" src="https://i0.wp.com/www.quintuitive.com/wp-content/uploads/2017/10/rallies-1-720x532.png?w=450" alt="" class="wp-image-3204" data-recalc-dims="1"></a></p>
<p>A mere week ago, that seemed unthinkable. Something abnormal must have happened. Two things happened. First, the current stock market advanced another <strong>2%</strong>. Nothing to brag about just another positive vote of confidence in the economy’s direction.</p>
<p>The more impactful reason behind this sudden switch became clear when I took a look at the President H.W. Bush’s rally. Even from the above chart, it’s clear the rally lost significant amount of steam within a day, or two max. Is this a problem with data? A bit of forensics:</p>
<pre>
election.date = &quot;1988-11-08&quot;

require(quantmod)
dj = getSymbols(&quot;^DJI&quot;, from=&quot;1900-01-01&quot;, auto.assign=F)
id = findInterval(as.Date(election.date), index(dj))
tail(ROC(Cl(dj[id:(id+239)]), type=&quot;discrete&quot;, na.pad=F))
</pre>
<p>And the truth reveals itself:</p>
<div align="center">
<table>
<thead>
<tr>
<th>Date</th>
<th>Return</th>
</tr>
</thead>
<tbody>
<tr>
<td>1989-10-12</td>
<td>-0.49%</td>
</tr>
<tr>
<td>1989-10-13</td>
<td>-6.91%</td>
</tr>
<tr>
<td>1989-10-16</td>
<td>3.43%</td>
</tr>
<tr>
<td>1989-10-17</td>
<td>-0.70%</td>
</tr>
<tr>
<td>1989-10-18</td>
<td>0.19%</td>
</tr>
<tr>
<td>1989-10-19</td>
<td>1.50%</td>
</tr>
</tbody>
</table>
</div>
<p>Low and behold, no problem with the data, just a 7% drop on October 13th 1989. A quick search reveals that this was indeed <a rel="nofollow" href="https://en.wikipedia.org/wiki/Friday_the_13th_mini-crash" target="_blank">Friday the 13th mini-crash</a>! Friday, the 13th … mini-crash … What a coincidence!</p>
<p>I will keep it brief and wrap up this post here. There were a few improvements and changes I did to the R code used to perform these analysis – <a rel="nofollow" href="https://gist.github.com/ivannp/f989a2d25f4efbbbb9d547767fdd15c0" target="_blank">the Gist contains</a> all of them.</p>
<p>It’s all optimism in the air, judging by the market behavior at least.</p>
<p>The post <a rel="nofollow" href="http://www.quintuitive.com/2017/10/21/markets-performance-election-day-239/" target="_blank">Markets Performance after Election: Day 239</a> appeared first on <a rel="nofollow" href="http://www.quintuitive.com/" target="_blank">Quintuitive</a>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://www.quintuitive.com/2017/10/21/markets-performance-election-day-239/"> R – Quintuitive</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/3QybFPdBhag" height="1"></a></div>