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.
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
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|
- 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 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:
|Cycle 1 variance||6.6204e-06||3.5134e-09|
|Cycle 2 variance||0.0014||7.3690e-07|
|Parameter type||Cycle 1||Cycle 2|
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.
- 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.