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

**DataPunks.com » R**, 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.

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

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

**DataPunks.com » R**.

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.