Markets Performance after Election: Day 239

October 21, 2017

(This article was first published on R – Quintuitive, and kindly contributed to R-bloggers)

When I wrote the original post, 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.

While re-running the computations testing the latest version of RStudio, I noticed something surprising – President Trump’s rally has advanced to 2nd place!

A mere week ago, that seemed unthinkable. Something abnormal must have happened. Two things happened. First, the current stock market advanced another 2%. Nothing to brag about just another positive vote of confidence in the economy’s direction.

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: = "1988-11-08"

dj = getSymbols("^DJI", from="1900-01-01", auto.assign=F)
id = findInterval(as.Date(, index(dj))
tail(ROC(Cl(dj[id:(id+239)]), type="discrete", na.pad=F))

And the truth reveals itself:

Date Return
1989-10-12 -0.49%
1989-10-13 -6.91%
1989-10-16 3.43%
1989-10-17 -0.70%
1989-10-18 0.19%
1989-10-19 1.50%

Low and behold, no problem with the data, just a 7% drop on October 13th 1989. A quick search reveals that this was indeed Friday the 13th mini-crash! Friday, the 13th … mini-crash … What a coincidence!

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 – the Gist contains all of them.

It’s all optimism in the air, judging by the market behavior at least.

The post Markets Performance after Election: Day 239 appeared first on Quintuitive.

To leave a comment for the author, please follow the link and comment on their blog: R – Quintuitive. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)