Case Studies

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.

Rainfall

Author: Rutger Lit
Date: June 30, 2022
Software: Time Series Lab - Home Edition
Topics: cyclical patterns in data
Batch program: rainfall.txt

Rainfall in Fortaleza

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. 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.

Go to the Estimation page and make sure the parameter corresponding to the cycle period is set to 12 years.
Estimate section ► Estimation ends at t = 1992 ► Estimate

Rainfall data with Level and cycle

Data inspection and preparation page
Plot 1: rainfall data and level. Plot 2: extracted cycle. Plot 3: residuals.

It can be seen from the Figure above that the cycle is deterministic. This is confirmed by the close to zero variance for the cycle component on the Text output page. It looks like the cycle does not always correspond with the data but removing the cycle and estimating the model with only a stochastic level with or without a stochastic slope decreases 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.

Two cycle model

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

Model setup ► include Cycle medium and keep the rest the same
Estimate section ► make sure that the parameter starting values of the Cycle 1 and Cycle 2 periods are around 12 and 23 respectively ► Estimate

We obtain the following results:

Variance type Value   q-ratio  
Level variance 0.0000   0.0000  
Cycle 1 variance 3.0706e-07   1.6326e-10  
Cycle 2 variance 3.0311e-04   1.6116e-07  
Irregular variance 1880.8000   1.0000  

Parameter type Cycle 1   Cycle 2  
Variance 348.2113   165.9518  
Period 12.8125   24.3500  
Frequency 0.4904   0.2580  
Damping factor 1.0000   1.0000  
Amplitude 26.0222   16.9972  

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 data and two cycle model

Data inspection and preparation page
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.

Bibliography

References

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.