Case Studies

The Time Series Lab (TSL) software packages make time series analysis available to anyone with a basic knowledge of statistics. The program is written in such a way that results can be obtained quickly. However, many advanced options are available for the time series experts among us. The modelling process in TSL consists of a five step procedure: Database, Model setup, Estimation, Graphics & diagnostics, and Forecasting. 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.


Rutger Lit
May 20, 2021
TSL module: State Space Edition - Univariate Basic
Topics: basic working of program

In this first case study we illustrate the fundamentals of TSL - State Space Edition using observations from the river Nile. The data set consists of a series of readings of the annual flow volume at Aswan from 1871 to 1970. The Nile dataset is part of any TSL - State Space Edition installer file and can be found in the data folder located in the install folder of TSL - State Space Edition.

After starting TSL, a screen like the one below should be visible. Depending on the installed toolboxes, some parts of the module menu are greyed out. For the analysis of the Nile data, we only need the Univariate module.

TSL frontpage
Time Series Lab - State Space Edition front page. This screen is shown after the program is started. It can also be reached via File ► Front page.

For the modelling of the Nile data we select the Univariate module and click the Get started! button. The program brings us to Step 1 of the modelling process which is the Database page. On this page we load, visually inspect, and prepare our data for the modelling process. The data set is loaded and selected from the file system by pressing the Load database button on the right of the screen or by selecting Load data from the File menu in the top left corner.

Important: The data set should be in column format with headers. The format of the data should be *.xls(x), or *.csv, *.txt with commas as field separation. The program does not sort the data which means that the data should be in the correct time series order before loading it into the program.

After loading the data, the headers of the data columns are displayed in the Database section at the top left of the page. Clicking on a header name plots the data in the plot area at the bottom of the page. As shown in the figure below, the Nile data is currently highlighted and (automatically) plotted.

TSL step 1
Time Series Lab - State Space Edition Database page. This screen shows step 1 (out of 5) of the modelling process. Many more options than discussed in this case study are available at this page. Among them are data transformation, different plot types, and zooming in on specific areas of the plot.

The highlighted variable Nile also appears in the Select dependent variable pull down menu. This is the so-called y-variable of the time series equation and it is the time series variable of interest, i.e. the time series variable you want to model, analyse, and forecast.
Optionally, a time series axis can be specified. The program’s algorithm tries to auto-detect the time axis specification (e.g. annual data, daily data) from the first column of the data set. In the case of the Nile data illustration, it finds an annual time axis specification. If auto-detection fails, the program selects the Index axis option which is just a number for each observation, 1,2,3,... You can specify the time axis manually as well via the User specified option or the Select time axis option. The User specified option, opens a new window in which the user can specify the date and time stamp of the first observation and the interval and frequency of the time series. The newly specified time axis shows up in the plot after pressing confirm (and exit). The Select time axis option allows the user to select the time axis from the loaded database. If the time axis format is not automatically found by the program the user can specify this via the Format input field. Note that a time axis is not strictly necessary for the program to run and an Index axis will always do.

Step 2 of the modelling process is the selection of components. In the case of the Nile data we illustrate TSL with the Local Level model. The settings are shown in the screenshot below. Notice that the blue border around the icon on the left of the screen indicates in which step we currently are. The blue model description pane in the top right corner of the screen summarises the selected model. As you can see only one component is selected but many more model specifications are possible. We refer to the other case studies for more in-depth analysis and more complicated models.

TSL step 2
Time Series Lab - State Space Edition model setup page with settings that correspond with the Local Level model. This screen shows step 2 (out of 5) of the modelling process.

Step 3 of the modelling process is the estimation of the model. In the figure below, under the header Edit and fix parameter values, all parameters that need to be estimated are summarised. For specific model specifications we can fix parameters at certain values. If User defined starting values is switched off (which is the default), an algorithm determines the starting values before optimisation. Note that the current values in the column Value are not the algorithmic determined starting values. That process starts after the green Estimate button has been clicked. For the majority of the cases, it is best to let TSL determine the starting values. For our Nile data example, we do not need to do anything except clicking the green Estimate button. During estimation, TSL shows output on the Text output page. When the estimation is finished, we are automatically brought to step 4.

TSL step 2
Time Series Lab - State Space Edition estimation page. This screen shows step 3 (out of 5) of the modelling process. For the local level model, all we need to do is click the Estimate button.

Step 4 of the modelling process is the graphical output of the estimated model. Components, or combinations of components, can be easily plotted and removed from the plot by checking or unchecking the tickboxes in the top left of the page. Confidence intervals can be included in the plot as well. A major benefit of the Kalman filter is that the error bounds can easily be obtained. You can also choose between Predicting, Filtering, and Smoothing by changing the table view in the top left corner. You can add subplots as well to create a grid of plots.

Click on a (sub)plot to activate it. Notice that by clicking on a subplot, the checkboxes in the top left of the window correspond to the current selection of lines in the subplot. If not all checkbox settings correspond with the lines in the subplot, switch tabs to show the rest of the selection.

To see what is meant by the text above: switch from Smoothing to Filtering. You now see that the Level checkbox is unchecked because the level that is currently plotted corresponds to the Smoothed level and not the Filtered level. The reason the Smoothed level does not automatically switch to a Filtered level on changing is that we sometimes want to compare Smoothed, Filtered, and Predicted components in one plot.
The difference between Smoothed, Filtered, and Predicted components has to do with the subset of the data used to determine the statistical properties of the components, i.e. the data up to time t-1 (forecasting), the data up to time t (filtering) or the whole data set (smoothing).

TSL step 2
Time Series Lab - State Space Edition graph page. This screen shows step 4 (out of 5) of the modelling process. Create a grid of subplots by clicking the checkboxes in the topleft and adding subplots with the button on the top right.

Step 5 of the modelling process is forecasting. Another major benefit of the Kalman filter is the ease of which it handles missing values. Missing values can be anywhere in the dataset and this allows us to easily make forecasts. We simply extend our dataset with missing values and run the Kalman filter on the extended dataset. TSL is doing this process for you and the results are shown in the figure below. A forecast from the Local Level model is just the last value of the level and therefore the forecasts form a straight line since no other data comes in to adjust the level. Note that the local level model is not just a theoretical model, it has practical value as well. For example for inflation modelling, the local level is a strong contender. Other TSL case studies show (much) more extensive models compared to the Local Level model.

TSL step 2
Time Series Lab - State Space Edition forecast page. This screen shows step 5 (out of 5) of the modelling process.
Further exploration:
  • Click on the Text output button which is located on the left of your screen. The right area of the screen is dedicated to text output that will be printed, for example, during the modelling process. The text output area works as a basic text editor in which you can type and remove text.
  • On the Graphics and diagnostics page, click on the Diagnostics button in the top right of the screen. This opens up a new window in which you can request additional output and test statistics.
  • On the Estimation page, specify the end of the estimation sample at 90 instead of 100. You now created a test sample which you can use to analyse out-of-sample forecast accuracy. Estimate the model with the new sample (1 - 90) and see what happens on the Forecasting page. You should see a new button (Model comparison) appear on the top right of the screen which allows you to do a forecast comparison with other models.



Durbin, J. and Koopman, S. J. (2012). Time series analysis by state space methods. Oxford university press.

Harvey, A. (1989). Forecasting, Structural Time Series Models and the Kalman Filter. Cambridge: Cambridge University Press. doi:10.1017/CBO9781107049994