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

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

Eric,

In your code I see:

part part2 skews head(skews)

I am interested in your code to produce the graphs.

Will you give the code for that.

Thanks,

Andre

Hi Andre,

Actually, that copy-paste didn’t work out properly. I fixed and pasted the proper code which will allow you to reproduce what I did. Let me know if there’s anything!