# Volatility Violins

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Unlike many humans, markets love change. In fact, they look forward to it with great anticipation. Regular people like stability, for the most part. Unless you’re a career gypsy, you like to stay in one place for some time. Making a home. Settling in, as it were. Unlike markets, where volatility is the raison d’etre.**Milk Trader**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve plotted the values for VIX, which is the CBOE’s volatility index calculated by some magic formula that considers 30-day expectation of price movement, in the chart below. Next to it is a plot of 30-day returns for the SPX, or a graph that plots all the percentage changes for each 30-day window. Quite frankly, I’m not sure what conclusions to draw from this, except that expectations in markets usually fall short.

The R code:

library(vioplot) library(quantmod) VIX <- getSymbols("^VIX", auto.assign=FALSE)[,4] SPX <- getSymbols("^GSPC", auto.assign=FALSE)[,4] VIX <- VIX/100 SPX <- Delt(SPX, k=30) SPX <- na.locf(SPX, na.rm=TRUE) SPX <- abs(SPX) vioplot(VIX, SPX, names=c("VIX", "SPX"), col="red3") title("Violins of Volatility")

To

**leave a comment**for the author, please follow the link and comment on their blog:**Milk Trader**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.