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
June 3, 2021
TSL module: State Space Edition - Univariate Basic / Univariate Extended
Topics: cyclical patterns in data

In this case study we illustrate how to model the presence of cycles using annual observations on rainfall in Fortaleza in North-East Brazil, starting in 1849. The unit of measurement is centimetres, with the data being recorded to the nearest millimetre. The series is one of the longest records of tropical rainfall available, and it as been subject to a great deal of study since the region inland from Fortaleza frequently suffers from severe droughts. The main issue concerns the existence of a cycle, or cycles, in the pattern of rainfall; see, for example, Kane and Trivedi (1986). Parts of this case study are from the STAMP manual.

The rainfall dataset is part of the TSL installer and can be found in the data folder located in the install folder of TSL - State Space Edition. It is instructive to carry out a preliminary analysis on the data. Database: load the data in TSL and plot it by clicking the RainFort header in the database section. Click the autocorrelation function button in the bottom right of the screen. Although the individual autocorrelations are quite small, the correlogram shows evidence of a cycle buried within the noise. The spectral density shows the same message, but more clearly. On this graph, the period is given by dividing 2 by the scaled frequency, on the horizontal axis. Thus there appears to be a cycle with a period of around 12 or 13 years. Re-estimating the spectrum with the window implied by 50 lags, indicates the possibility of a second cycle of around 25 years. There is also a smaller peak in the spectrum at around four years.

For the moment we will assume a single cycle. The possibility of such a cycle leads us to formulate a model consisting of a Fixed Level and a Cycle. The Slope component is not selected.

Estimate section ► Estimation ends at t = 1992 ► Estimate

rainfall signal
Plot 1: rainfall data and level. Plot 2: extracted cycle. Plot 3: residuals

It can be seen in the Figure above that the cycle is deterministic. It looks like it does not always corrspond with the data but removing the cycle and estimating the model with only a stochastic level with or without a stochastic slope does not improve model fit. We can verify this by inspecting the Model fit section of the printed output on the Text output page. Including the cycle leads to a higher Log likelihood and a lower AIC and BIC (lower numbers are preferred for AIC and BIC). More precise information about the fitted cycle can be found in the written output on the Text output page.

The written output show us (among other things) the Cycle properties:

Parameter type Cycle 1  
Variance 354.4407  
Period 12.8198  
Frequency 0.4901  
Damping factor 1.0000  
Amplitude 25.6596  

The parameters are as follows:
  • A variance parameter which is responsible for making the cycle stochastic
  • A period (in years), $\lambda $
  • A frequency (in radians) $2 \pi / \lambda$
  • A damping factor $\rho $
The output shows the period to be just under 13 years. The variance of the cycle itself, as opposed to the variance of the disturbance term generating it, is also shown. The sum of this variance and the variance of the irregular should, in theory, be equal to the variance of the observed variable.

The extended edition of TSL - State Space Edition is needed for parts of the next section.

The model can be extended so as to include several cycles at different frequencies.

Model setup ► include Cycle medium and keeping the rest the same
Estimate section ► set start value of Cycle 2 to 25 ► Estimate

We obtain the following results:

Variance type Value   q-ratio  
Level variance 0.0000   0.0000  
Cycle 1 variance 6.6204e-06   3.5134e-09  
Cycle 2 variance 0.0014   7.3690e-07  
Irregular variance 1884.3299   1.0000  

Parameter type Cycle 1   Cycle 2  
Variance 363.8520   169.8736  
Period 12.8116   24.3594  
Frequency 0.4904   0.2579  
Damping factor 1.0000   1.0000  
Amplitude 26.0988   17.0454  

Thus estimation of the two-cycle model gives two deterministic cycles. The sum of the variance components is 2418; this is close to the series variance of 2392. The diagnostics are satisfactory and if a third cycle is included in the model, it is either very small or disappears completely, depending on the starting values used. The results are similar to those reported in Kane and Trivedi (1986). The two-cycle model appears to be stable and its predictive performance is rather good.

rainfall signal
Plot 1: rainfall data and composite signal. Plot 2: sum of cycles. Plot 3: residuals
Further exploration:
  • Verify that the forecast function of the model with (two) deterministic cycle(s) and a damping factor of 1.000 is persistent.



Kane, R.P., N.B. Trivedi (1986). Are droughts predictable. Climate Change 8, 208–223.

Koopman, S.J., A.C. Harvey, J.A. Doornik, and N. Shephard (2012). STAMP: Structural time series analyser, modeller and predictor. London, Timberlake Consultants Ltd.