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

# US meat production

Author: Rutger Lit
Date: July 05, 2022
Software: Time Series Lab - Home Edition
Topics: abnormal ACF pattern

#### US meat production

This case study is on US meat production. Load the dataset us meat production.csv from the data folder located in the install folder of TSL. Select and plot the Pork time series. We see monthly production of pork in the United States in millions of pounds. At first glance, this dataset should not give us too many problems with a clear upward trend and a monthly seasonal. However, this time series turns out to hide some very interesting dynamics which we will uncover in this case study.

#### Basic structural time series model

We begin with the Basic structural time series model consisting of a time-varying level, slope, and monthly seasonal (s=12). Select these components on the Build your own model page and Estimate the model by clicking the Estimate button on the Estimation page. The model fit is:


—————————————————————————————————— MODEL FIT ———————————————————————————————————

Model: TSL001
variable: Pork

TSL001
Log likelihood                              -4187.358
Akaike Information Criterion (AIC)           8406.715
Bias corrected AIC (AICc)                    8407.472
Bayesian Information Criterion (BIC)         8480.335
in-sample MSE                                6005.796
... RMSE                                       77.497
... MAE                                        60.766
... MAPE                                        4.357
Sample size                                       748
Effective sample size                             735
* based on one-step-ahead forecast errors


The graphical output is presented in the following figure:

#### Extracted Level and Seasonal

We see a time-varying seasonal pattern where the difference between months increase over time. Without investigating further we could accept this model but the ACF of the predicted standardized residuals (top right panel of the figure below) shows something interesting and worrying at the same time. The ACF shows strong signs of residual autocorrelation and it is periodic with a period of 3, often followed by a negative correlation spike. The spectral density (bottom right panel next figure) confirms the periodicity with a peak at 2.0/0.7 ≈ 2.86. What is going on here? Apparently there is strong periodicity left in the residuals.
It could be that the periodic behaviour has something to do with reporting rules. A period of ≈ 2.86 means at the end of a quarter. Could it be that numbers need to be reported at the end of each quarter and numbers of the first and second month within a quarter are sometimes reported in the third month?

#### Graphical diagnostics of standardized residuals

If we add a cycle to our model, the model fit strongly improves. The output of TSL is:


—————————————————————————————— PARAMETER SUMMARY ———————————————————————————————

Cycle properties:

Parameter type                   Cycle 1
Variance                       1368.1797
Period                            2.8716
Frequency                         2.1880
Damping factor                    0.9999
Amplitude                        63.0507

—————————————————————————————————— MODEL FIT ———————————————————————————————————

Model: TSL002
variable: Pork

TSL002
Log likelihood                              -4031.384
Akaike Information Criterion (AIC)           8100.767
Bias corrected AIC (AICc)                    8101.829
Bayesian Information Criterion (BIC)         8188.190
in-sample MSE                                3915.803
... RMSE                                       62.576
... MAE                                        47.334
... MAPE                                        3.440
Sample size                                       748
Effective sample size                             735
* based on one-step-ahead forecast errors


Notice that the period of the cycle is estimated at 2.87 which is close to the information contained in the spectral density with a period of 2.0/0.7 ≈ 2.86. The graphical output is shown in the following figure. Again the series shows something interesting. The Extracted cycle itself shows periodic behaviour with a cycle within the cycle.

#### Quarterly data

Another way of dealing with the large spikes in the autocorrelation plot is by aggregating the data. The series can be converted from a monthly series into a quarterly one by summing up the data every three months. Currently this cannot be done in TSL itself but let us know if this is a feature you want to see!
For now we used Excel to aggregate the data. The output of modelling the resulting quarterly series with a time-varing level, slope, and seasonal (s=4) is presented in the following figure. The figure shows us that the ACF of the predicted residuals does not show significant autocorrelation.

#### Further exploration

• Verify that in the model with the cycle, if the cycle period is fixed at exactly 3 months, the model fit is much worse compared to the model with the estimated cycle period of 2.87.
• Verify that the ACF of the standardized residuals of the model with the cycle is much better compared to the model without a cycle but that we still see correlation spikes at some lags.
• Show that the model fit of the model with the cycle can be further improved by letting TSL search for outliers and structural breaks.