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 allow us to explore seasonality effects, I'm going to load monthly data, back to 1980.
Practical tools for predictive modeling, data science, machine learning and web scraping
Thursday, December 29, 2011
Monday, December 12, 2011
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 the forecast), and h (the number of periods to forecast). Note that h should equal the number of rows in the xreg matrix. Also note that you need to forecast the xreg object BEFORE forecasting your x object. For example, if you wish to forecast 12 months into the future, your xreg object should have 12 extra rows.
Labels:
backtesting,
cross-validation,
finance,
forecasting,
model building,
time-series
Monday, December 5, 2011
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 provided code is open source, I felt free to hack around with it a bit, and ported the python source to R.
Labels:
pokeR
Subscribe to:
Posts (Atom)