More on higher moments: rolling skewness of S&P 500 daily returns

October 15, 2011
By

(This article was first published on DataPunks.com » R, and kindly contributed to R-bloggers)

In this post, Portfolio Probe explores a way to decide whether market kurtosis and skewness are predictable.

Market skewness, in naive financial modeling, is some kind of measure of (as-)symmetrical distribution of (daily) returns around the average market return. A higher skewness would tend to indicate a denser distribution of higher returns, compared to lower or negative returns.

In the cited example, skewness was estimated based on even partition of years since 2008. While is this is a neat idea, it seems like a good idea to study the evolution of a rolling skewness (skewness of returns of the preceding n days).

Below is a quick piece of R code to describe the distribution / fluctuation of a 30-day rolling skewness of the S&P 500 daily returns since 1980.

Surprisingly, the skewness is rather volatile, with sudden high negative values. The distribution of rolling skewness is negatively skewed as well.

library(PerformanceAnalytics)
library(quantmod)
rm(list=ls())
getSymbols(c("^GSPC"), from="1980-01-01")
part <- function(i) GSPC[i:(i+30)]
part2 <- function(i) skewness(Return.calculate(Cl(part(i))))
skews <- unlist(lapply(1:(length(GSPC)/6-30), part2))
head(skews)
plot(ts(skews), col='blue')
hist(skews, breaks=50, col='cyan')

Photograph used with permission from mylittleshoebox.ca

To leave a comment for the author, please follow the link and comment on his blog: DataPunks.com » 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...



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.