Seasonality Tool case study



What company in DOW 30 is likely to do well in January?

THIS IS NOT INVESTMENT ADVICE. The information is provided for informational purposes only.

Stock Market Seasonality is easy to understand, but hard to justify if you subscribe to Efficient-market hypothesis. For a good summary of seasonality, have a look at Capitalizing On Seasonal Effects article at Investopedia. Another interesting discussion was started by Douglas R Terry in his post Efficient Market Hypothesis and Seasonality that goes into detail analysis how these two ideas can co-exist.

To demonstrate the Seasonality Tool, I want to show how it can be used to evaluate an investment idea. I want find which company in DOW 30 is likely to do well in January and evaluate it using Seasonality Tool.

Following code loads historical prices from Yahoo Fiance for all companies in the DOW 30 index and computes their average performance in January. I will use the Systematic Investor Toolbox to load and analyze the data:
###############################################################################
# Load Systematic Investor Toolbox (SIT)
###############################################################################
con = gzcon(url('http://www.systematicportfolio.com/sit.gz', 'rb'))
source(con)
close(con)

#***************************************************************** # Load historical data #****************************************************************** load.packages('quantmod')
tickers = dow.jones.components()

data <- new.env()
getSymbols(tickers, src = 'yahoo', from = '1970-01-01', env = data, auto.assign = T)
for(i in ls(data)) data[[i]] = adjustOHLC(data[[i]], use.Adjusted=T)
bt.prep(data, align='keep.all', dates='1970::2011')

#***************************************************************** # Compute monthly returns #****************************************************************** prices = data$prices n = ncol(prices) # find month ends month.ends = endpoints(prices, 'months')

prices = prices[month.ends,]
ret = prices / mlag(prices) - 1

# keep only January ret = ret[date.month(index(ret)) == 1, ]

# keep last 20 years ret = last(ret,20)

#***************************************************************** # Compute stats #****************************************************************** stats = matrix(rep(NA,2*n), nc=n) colnames(stats) = colnames(prices) rownames(stats) = spl('N,Positive')

for(i in 1:n) {
stats['N',i] = sum(!is.na(ret[,i]))
stats['Positive',i] = sum(ret[,i]>0, na.rm=T)
}
sort(stats['Positive',])
###############################################################################



The Walt Disney Co. (DIS) was positive 17 times in January in the last 20 years. Let's investigate the Walt Disney Co. (DIS) record using the Seasonality Tool.


The Seasonality Analysis Report confirms Walt Disney Co. (DIS) outstanding track record in January. Next let's see the details for January.


The Detail Seasonality Analysis Report shows that the Walt Disney Co. (DIS) had an amazing returns in January till 2008. Following by a 3 consecutive negative Januaries which most likely indicates a change in trend (regime) for this company.

So do I expect the Walt Disney Co. (DIS) be positive in the upcoming January? I'm not so sure anymore.

To view the complete source code for this example, please have a look at the bt.seasonality.test() function in bt.test.r at github.