**The Average Investor's Blog » R**, and kindly contributed to R-bloggers)

2011 was a volatile year, no doubt about that, but was it exceptionally so from a historic point of view? To quantify the volatility, I used the Dow Jones Industrial average, which goes back to 1928 on Yahoo Finance:

library(quantmod) getSymbols("^DJI", from="1900-01-01") dji = Cl(DJI["/2011"]) djiVol = aggregate( dji, as.numeric(format(index(dji), "%Y")), function(ss) coredata(tail(TTR:::volatility( ss, n=NROW(ss), calc="close"), 1))) ecdf(as.vector(djiVol))(as.numeric(tail(djiVol,1))) # The result is 0.8214286, the 82nd quantile

A volatile year no doubt, but once again confirming the fact that, in markets behaviour at least, history does repeat itself. The following plot clearly shows that the volatility experienced during the great depression dwarves the recent levels:

Next, out of pure curiosity, I also computed how much money were to be made with these levels of volatility:

library(quantmod) getSymbols("^DJI", from="1900-01-01") # Compute the absolute returns absRets = abs(ROC(Cl(DJI["/2011"]))) absRets = reclass(ifelse(is.na(absRets),0,absRets),absRets) # Summarize annually yy = as.numeric(format(index(absRets), "%Y")) zz = aggregate(absRets, yy, function(ss) tail(cumprod(1+ss),1)) print(as.vector(tail(zz,1))) # The result is 10.64

That’s right, an owner of a crystal ball would have been able to multiply his money 10-fold in 2011 alone! For further comparison, in 1932, the owner of the same ball would have been able to multiply his money … 590 times!

**leave a comment**for the author, please follow the link and comment on his blog:

**The Average Investor's Blog » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...