Alteryx makes it easy for analysts to perform time series forecasting using the R tool. In this blog, I will be running the Holt-Winters forecasting, also known as the Holt-Winters method or triple exponential smoothing using R in Alteryx. Holt-Winters is a popular time series forecasting technique. It is used to forecast future values based on historical data and is particularly effective for data with trends and seasonality.

The Holt-Winters method takes into account three components of a time series: level, trend, and seasonality. It uses exponential smoothing to estimate the level, trend and seasonality components and make predictions. Here’s the steps in R:

  1. Connect to the ‘Daily Vitamins Sales.xls’ data and transform the dates to monthly.
  2. Bring in the R tool into the canvas. In the configuration, these are the codes that I had used to read the data and convert it into a data frame. We will write out the output in anchor output #1.monthly_sales = read.Alteryx(“#1″, mode=”data.frame”)
    write.Alteryx(monthly_sales, 1) 

3. These are the library packages that we will be using. Type them into the the configuration box.

4. Convert the data into a time series object first. The codes are:

monthly_sales_ts <- ts(monthly_sales$total, frequency=12, start=c(2019,7))

5. To fit the Holt-Winters model, I used the following codes in R:

fit_holtwinters <- hw(monthly_sales_ts, seasonal=’additive’)
print(summary(fit_holtwinters))
plot(fit_holtwinters)
checkresiduals(fit_holtwinters)

6. Finally, to write out the model’s summary, we have to convert it into a data frame first. We will write out the summary into output anchor #2.

df_naive<-data.frame(fit_holtwinters)
write.Alteryx(df_holtwinters, 2)

7. The output for the forecasts are as follows and I am excited that we are able to do this simply in Alteryx.

8.  There you have it folks. Integrating with R on Alteryx is simple and easy. I prefer the Holt-Winters method for any time series forecast as it can be used to forecast future values by projecting the level, trend, and seasonality forward. Thanks for reading my blog!

Shaida Shamuri
Author: Shaida Shamuri