If you're interested in time series analysis and forecasting, this is the right place to be. The Time Series Lab (TSL) software platform makes time series analysis available to anyone with a basic knowledge of statistics. Future versions will remove the need for a basic knowledge altogether by providing fully automated forecasting systems. The platform is designed and developed in a way such that results can be obtained quickly and verified easily. At the same time, many advanced time series and forecasting operations are available for the experts. In our case studies, we often present screenshots of the program so that you can easily replicate results.
Did you know you can make a screenshot of a TSL program window? Press Ctrl + p to open a window which allows you to save a screenshot of the program. The TSL window should be located on your main monitor.
Click on the buttons below to go to our case studies. At the beginning of each case study, the required TSL package is mentioned. Our first case study, about the Nile data, is meant to illustrate the basic workings of the program and we advise you to start with that one.
Date: July 05, 2022
Software: Time Series Lab - Home Edition
Topics: complex seasonal pattern
In this case study we analyse call center data to illustrate how to use TSL to model complex seasonal patterns. The series is used in the second application of the TBATS paper of De Livera, A.M., R.J. Hyndman, and R.D. Snyder (2011) and it can be downloaded from here. The call center time series consists of 10,140 observations on call arrivals per 5-minute interval between 7:00 AM and 9:00 PM on weekdays. The series contains a daily seasonal pattern with period 169 (number of 5-minute intervals between 7:00 AM and 9:00 PM) and a weekly seasonal pattern with period 169 × 5 weekdays = 845. Just as in De Livera, A.M., R.J. Hyndman, and R.D. Snyder (2011), we use 7605 observations (9 weeks) for our training sample which leaves 2535 observations (3 weeks) to analyse forecasting performance. Note that in contrast to the data as shown in figure 1b and 5 of De Livera, A.M., R.J. Hyndman, and R.D. Snyder (2011), the data set we downloaded has two days of missing values (04/04/2003 and 07/04/2003), see the figure below. On further inspection of figure 5 of De Livera, A.M., R.J. Hyndman, and R.D. Snyder (2011), we see that the corresponding days in their figure have a more smooth pattern than the rest of the data so they might have used some fill-in values for the missing values. In TSL there is no need for this. Missing values are part of time series analysis, see also Section 11.1.4 of the TSL manual.
Call center data set with two days of missing values
Building the model
We select a time-varying level, time-varying seasonal 1 with a period of 169 and 20 factors, and a time-varying seasonal 2 with a period of 845 and 10 factors.
Important: The number of factors, in combination with the time series length, strongly influences estimation times and higher numbers seldom lead to better forecasts, Therefore, it is strongly advised to not choose the number of factors too high and it is almost never needed to go beyond 40.
Select a training sample of 7605 on the Estimation page and estimate the model. After TSL is done estimating, the graph page shows us the following figure:
Extracted level and two seasonals
From this figure we see that TSL has no problem with the missing data. The Kalman Filter / Smoother algorithm nicely interpolates all the selected components. Furthermore, we see from the top panel that the Level is not smooth and it looks like the level itself picks up some dynamics. This is confirmed by the ACF of the predicted residuals which shows significant first order autocorrelation among other lags. Before we fix this, let's first make some forecasts to compare this model to the following models. Go to the model comparison page and click the start loss calculation button in the top right corner.
Our next modelling step is to add an ARMA(1,0) process to the existing model to do something about the first order autocorrelation that is still present in the residuals. Select the ARIMA(1,0) component on the Build your own model page, leave everything else the same, and estimate the model. The result should be like the figure below. We see that the level is much smoother.
Extracted level and two seasonals + ARMA(1,0) errors
If we look at the ACF of the predicted residuals we see that the first order autocorrelation is still present. Again, let's make some forecasts to compare this model to the first and the following models. Go to the model comparison page and click the start loss calculation button in the top right corner.
Seasonal variance extension
The default is to have one variance per seasonal component for all seasonal factors. In some situations, this is somewhat restrictive and estimating additional seasonal variances can improve model fit and forecast performance. However, there are an extremely large number of factor combinations and machine learning needs to assist here since we cannot try all combinations. TSL has a machine learning method that determines which seasonal factor gets its own variance parameter. To see this in action, go the top menu bar and click on Advanced settings and switch on Seasonal 1 variance extension. Go to the Estimation page and make sure no parameters are set to fixed. Click on Estimate and wait till the algorithm is finished. This takes some time with an extensive model like this. After the estimation is completed, go to the Model comparison page and start the loss calculation for this model as well. After that is completed you should see three check boxes in the top left corner. When all are checked the resulting figure should look like the one below. The lowest loss line belongs to the last estimated model and is at least as good as the loss obtained from the TBATS package as presented in De Livera, A.M., R.J. Hyndman, and R.D. Snyder (2011).
Keep in mind that the analysis performed by TSL in this case study is based on the call center time series with missing values.
Model comparison based on forecast performance
De Livera, A.M., R.J. Hyndman, and R.D. Snyder (2011). Forecasting Time Series With Complex Seasonal Patterns Using Exponential Smoothing. Journal of the American Statistical Association 106:496, 1513-1527.