The precursor to this blog introduced time series forecasting in Alteryx with the ARIMA and ETS tools. This blog looks at configuring these tools to generate an effective time series forecast. The data set I’ve used contains monthly beer production in Australia from 1956 to 1964.
The ARIMA tool contains a configuration pane with 4 tabs. The first, required parameters, lets you input a model name, select the target field, and select the frequency of the values in this field. As the name suggests, these parameters are required for the tool to run.
The second tab contains options for altering the hyperparameters of the model. As with other predictive modelling tools you can alter these, one parameter at a time in a new tool, and compare each different model with the TS Comparison tool.
In the example shown, ‘Customize the parameters used for automatic model creation’ has been ticked to allow a Box-Cox transformation with a lambda of 0 to be selected (which produces the natural logarithm of the target value). Don’t panic if you don’t know what this means, a Box-Cox transformation basically normalizes the data for the purpose of deducing trends. All the other options in this pane have been left with the default values that Alteryx provides.
The third tab allows you to specify the starting year and month of the data, as well as the number of months you would like to forecast. Graphics options are configurable in the final tab so you can set up the size of the visuals produced by the ARIMA tool.
The ETS tool configuration is very similar to the ARIMA tool, however the second tab is the ‘Model Type’ and lets you select the desired error type, trend type, trend dampening and seasonal type. There’s an ‘Auto’ option for all these questions which I used for my analysis. The auto option for each of these parameters considers all other options (eg. additive or multiplicative) and selects the best one based on in-built statistical criteria. The other options are as below:
Configuring the TS Forecast tool
As mentioned in Part 1 of this blog series, the TS forecast tool takes a model object from either the ARIMA or ETS tool and outputs the predicted values for a specified period as well as the upper and lower confidence intervals. The larger and smaller confidence intervals can be configured to fit your needs as shown below. It is also required in this tool configuration to specify the number of time periods (in our case months) to forecast into the future.
Putting it all together
The data must be sorted ascending for forecasting so step 1 above involves converting the date string into a date type and sorting it. In step 2 we assign a record ID to each row and use the filter tool to holdout the last 12 months of data. This holdout will be used in the model comparison tool to determine the error of each model. The training data from the T output of the filter tool is then connected to the ETS and ARIMA tools as per their previously discussed configuration. These models are then unioned and fed into the left input of the model comparison tool while the holdout data is connected to the right input.
The model comparison tool outputs the error of each model as well as an interactive chart showing the actual values compared with the predicted values.
The mean absolute percentage forecast error (MAPE) and the mean absolute scale error (MASE) can be found in the Accuracy Measures table of the ‘R’ output to indicate which model gives a more accurate forecast. For all measures in this table, the lower the value the better.
For this reason, the ARIMA tool is used in step 3 of the workflow to generate a 12-month forecast. The forecast values are found in the ‘O’ output of the forecast tool and…voila! In a few easy steps with a simple workflow a time series forecast can be generated.
For further reading and clarification on any of the tools mentioned in this blog, consult the time series documentation on the Alteryx website.