Publications by Zach Mayer
Functional and Parallel time series cross-validation
Rob Hyndman has a great post on his blog with example on how to cross-validate a time series model. The basic concept is simple: You start with a minimum number of observations (k), and fit a model (e.g. an arima model) to those observations. You then forecast out to a certain horizon (h), and compare your forecasts to the actual values for...
3775 sym 10 img
Time series cross-validation 2
In my previous post, I shared a function for parallel time-series cross-validation, based on Rob Hyndman’s code. I thought I’d expand on that example a little bit, and share some additional wrapper functions I wrote to test other forecasting algorithms. Before you try this at home, be sure to load the cv.ts and tsSummary fu...
2359 sym 12 img
A pure R poker hand evaluator
There’s already a lot of great posts out there about poker hand evaluators, so I’ll keep this short. Kenneth J. Shackleton recently released a very slick 5-card and 7-card poker hand evaluator called SpecialK. This evaluator is licensed under GPL 3, and is described in detail in 2 blog posts: part 1 and part 2. Since the ...
1965 sym 8 img
Time series cross-validation 3
I’ve updated my time-series cross validation algorithm to fix some bugs and allow for a possible xreg term. This allows for cross-validation of multivariate models, so long as they are specified as a function with the following paramters: x (the series to model), xreg (independent variables, optional), newxreg (xregs for th...
2063 sym 8 img
Benchmarking time series models
This is a quick post on the importance of benchmarking time-series forecasts. First we need to reload the functions from my last few posts on times-series cross-validation. (I copied the relevant code at the bottom of this post so you don’t have to find it). Next, we need to load data for the S&P 500. To simplify things, and ...
1995 sym 10 img
My first R package: parallel differential evolution
Last night I was working on a difficult optimization problems, using the wonderful DEoptim package for R. Unfortunately, the optimization was taking a long time, so I thought I’d speed it up using a foreach loop, which resulted in the following function: Here’s what’s going on: I divide the bounds for each parameter into n s...
2105 sym 8 img
Time series cross-validation 4: forecasting the S&P 500
I finally got around to publishing my time series cross-validation package to github, and I plan to push it out to CRAN shortly. You can clone the repo using github for mac, for windows, or linux, and then run the following script to check it out: This script downloads monthly data for S&P 500 (adjusted for splits and dividends),...
1569 sym 10 img