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.
July 5, 2021
TSL module: State Space Edition - Univariate Basic
Topics: cyclical patterns in data
In this case study we illustrate how to model the presence of a cycle using the numbers of furs of minks and muskrats traded annually by the Hudson Bay Company in Canada from 1848 to 1909. The main issue concerns the existence of a cycle in the pattern of traded furs of both minks and muskrats. Parts of this case study are from the STAMP manual.
The MINKMUSK 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.
Go to the Database section and load the data in TSL and plot it by clicking the Lmink (L for logarithm) header in the database section. Click the autocorrelation function button in the bottom right of the screen. The autocorrelation function shows evidence of a cycle buried within the noise. The spectral density shows the same message. 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 10 years.
Proceed to Model setup and select a Fixed Level, a Stochastic Slope and a Cycle component.
Estimation section ► Estimation ends at t = 1909 ► Estimate
Once the estimation has been finished we are automatically brought to the Graphics and diagnostics section.
Graphics and diagnostics ► Clear all ► select the Individual tab ► plot Y data and Level
plot Y data ► select the Composite tab and plot Composite signal
select the Individual tab and plot Cycle
select the Residuals tab, select Smoothing, and plot Residuals
It can be seen in the Figure above that the estimated trends are relatively smooth. The smoothness arises because the level variances were constrained to be zero and the q-ratios for the slope are small.
More precise information about the fitted cycle can be found in the written output on the Text output page.
The written output shows 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 $
Now let's turn our attention to the Lmuskrat series. Repeat all steps as described above but now for the Lmuskrat series. We obtain the following cycle properties:
|Parameter type||Cycle 1|
Let's investigate the cycles of Lmink and Lmuskrat by plotting the cycles in one graph.
For this we explore the Add plots to database functionality on the Graphics and diagnostics page. This functionality can be switched on and off with the switch in the top middle of the Graphics and diagnostics page. When switched on (this is the default), every component that is or was plotted is stored in the Database on the Database page.
Go to the Database page and click on Lmink Cycle (Smo) followed by Ctrl-click Lmuskrat Cycle (Smo). Both cycles are now plotted in one graph and from this you can see that the cycle extracted from the Lmuskrat series leads the cycle of Lmink by three years.
- [Not statistics] Why would the cycle of Lmuskrat lead the cycle of Lmink by three years?
- The multivariate module of TSL - State Space Edition enables us to model both the Lmink and Lmuskrat series simultaneously, see also the example in STAMP
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.