In the last post, we examined different methods for identifying which variable to predict. Once we’ve made a sound, data-driven assessment of what variables matter most to us, we build a predictive model around it.
To create accurate forecasts, we must use software built for the explicit purpose of time-series prediction. The generally-accepted standard for prediction of time-series data is an algorithm known as S-ARIMA, which is an acronym for Auto-Regressive Integrated Moving Average with Seasonality. Here’s the raw formula:
This isn’t particularly helpful, is it? Let’s dig in briefly into what S-ARIMA does using commute time prediction as an analogy. It’s imperfect (statistically speaking) but useful. Imagine for a moment we want to determine how long it will take to commute to work – a time-based prediction. If we know the distance and the average speed we drive to there, we can predict an Average time to our destination.
Not all roads are created alike. Some of our roads are small back roads, while others are major highways. To improve the accuracy of our prediction, we might want to calculate a Moving Average, taking into account differing speeds on differing parts of our commute.
So far, so good. Next, knowing what’s happened already on our drive should impact our prediction. If we just spent the last 20 minutes sitting in a traffic jam, our prediction should take that into account on a continuous basis. This would make it an Auto-Regressive Moving Average.
Now, suppose we take into account the rate of change. If I’ve gone 5 miles per hour in the last 3 minutes, and I’ve gone 5 miles per hour in the 3 minutes before that, I’m probably stuck in traffic. It’s logical to assume that as long as I’m stuck in traffic, I’m probably going to go 5 miles per hour. Thus, we want to keep an eye on the differences between past moving averages as a way of judging the next reasonable prediction. This is integration, making our prediction an Auto-Regressive Integrated Moving Average.
I happen to live in the metro Boston area. There’s a big difference in commute time in Boston in February versus July.
There’s a big difference in commute time during the summer vacation months versus regular months. Our prediction of commute time should incorporate this sort of seasonality into our traffic forecast, creating an Auto-Regressive Integrated Moving Average with Seasonality.
This analogy helps us deconstruct the S-ARIMA algorithm; it’s a small leap of the imagination to extend it to things like marketing data. We have averages for website traffic, email opens, social media engagements, etc. We can take into account all the seasonality of our businesses, the performance to date, the different methods, etc. and see how S-ARIMA-based predictive analytics applies to our business.
The best predictive analytics software available today comes from the open-source movement. While many vendors offer predictive analytics pre-packaged software for “reassuringly expensive” prices, the reality is that the underlying algorithms are all pretty much the same. The reason why is that much of the research and development in predictive analytics comes out of academia, and thus open-source software is the engine which powers it.
I recommend picking up either R or Python as the programming languages to develop predictive analytics capabilities, and then look at the many, many predictive analytics packages built for either R or Python such as pandas, timekit, scikit, and many others.
Making a Prediction
One of my favorite data sources for predictive analytics is search data. It’s generally well-formed, and unlike other marketing data, search data indicates forward-looking intent. A customer searches for something for intent to purchase in the future.
Suppose we take search data for a term like “iced coffee”.
We know, intuitively, that iced coffee interest is likely higher when it’s warmer and lower when it’s cooler. However, that’s very general prediction. What we’re interested in is specific prediction. When in the future should we plan for iced coffee sales to increase, with specificity?
Using R and Google Trends data, we project forward the search volume for iced coffee based on the past five years’ data:
We now have a specific set of predictions for iced coffee search volume.
As you’ve likely noticed, the prediction itself is not the valuable part of predictive analytics. The real value is in what we do with it, which we’ll cover next. Stay tuned!
Want to read more like this from Christopher Penn? Get updates here:
Get your copy of AI For Marketers (2019 Edition)