8. Preparing Data for Covariate Forecasting

Subtitles Enabled

Sign up for a free trial to access more free content.

Free trial


In this lesson we will learn how to incorporate an independent variable into our time series forecast using the TS Covariate Forecast tool.

Lesson Notes

Covariate Forecasting

  • A covariate is a variable that is possibly predictive of a specified target variable
  • In this case, overall marketing spend is a covariate, while the main variable is sales
  • To prepare for the covariate forecast, historic marketing spend needs to be aggregated to the weekly level and combined with future marketing spend


The time series forecasts we've explored thus far have utilized just one set of values together with the corresponding unit of time. These univariate forecasts consider the underlying trend in the data together with seasonality and other cyclical factors in order to make forward projections with a certain degree of confidence. These forecasts assume that the general conditions that existed historically will be replicated into the future. Specifically our forecast assumes that the general online marketing budget will be unchanged. However, what if our online marketing budget in 2017 was increased to 1.2 million.

How would this change our sales forecast? We can incorporate this change into our forecast with the TS covariate forecast tool. The TS covariate forecast tool allows us to factor future values for an independent variable into our model. Our marketing spend moment by moment is influenced by factors such as cost per click, affiliate actions and so on.

Clearly we're not going to know exactly how much we're going to spend by each channel in any one hour of the coming year. Instead the online marketing team has told us that they'll be allocating the budget of 1.2 million week by week in equal proportions.

Our goal for this lesson is to prepare our data for a covariate forecast by combining our historic sales data and the 2017 budget.

We'll accomplish this by following three key steps. First, we'll consolidate our historic marketing spend information into one combined field. Next, we'll aggregate this data to the weekly level. Finally, we'll combine our aggregated historic data with our 2017 budget.

Our first step is to consolidate our historic marketing spend into one field so that it matches the format of our 2017 budget. We'll need to create a new formula consolidating marketing spend by channel. We'll go to the formula tool, create a new canvas, and name the new field Total_Online_Marketing.

In the canvas we'll simply add paid search, affiliate, referral, social, and content.

We'll then change the data type to FixedDecimal size 12.2. We'll now move onto step two and aggregate the marketing spend data to the weekly level. We can now calculate the historic total online marketing spend by week in the summarize tool. We'll simply select Total_Online_Marketing and choose the sum action.

We'll also rename the output, Weekly_Online_Marketing.

We'll now run the workflow. If we view the summarize tool output we can see that we have two columns of data, Online Sales and Online Marketing both consolidated by week.

Finally, we'll move onto step three and combine our historic data with the 2017 budget.

We'll bring an input data tool onto the canvas and connect to the appropriate spreadsheet. We'll then bring a union tool onto the canvas, connect both datasets and run the workflow to combine the data. As we look at the results window, we can see that we now have our historic information together with budgeted online marketing spend for the year ahead. Notice the 2017 sales data is blank.

In the next lesson we'll use the TS covariate forecast tool to estimate the sales information.