Chapter 6 Time series decomposition

6.2 The plastics data set consists of the monthly sales (in thousands) of product A for a plastics manufacturer for five years.

Monthly sales of product A for a plastics manufacturer.

a. Plot the time series of sales of product A. Can you identify seasonal fluctuations and/or a trend-cycle?

The plastics data set clearly shows seasonal and a trend. The seasonal behavior has a frequency of 12 months that rise and fall periodically once per year. There is a positive trend that shows how sales have increased linearly every year.

b. Use a classical multiplicative decomposition to calculate the trend-cycle and seasonal indices.

We can see above how the decompose function extracted the trend, reploted our data without the trend showing only the seasonal behavior and finally plotted the remainders showing "what is left over when the seasonal and trend-cycle components have been subtracted from the data".

We notice how there appears to be seasonality leftover in the ramainder. This may indicate that trend may be over-smoothing the rapid rise and falls in seasonality - specially in the later part of the data set.

c. Do the results support the graphical interpretation from part a?

The classical multiplicative decomposition results match the observations we did just from observing the plot of the time series itself that clearly shows a repetitive seasonal pattern and a positive/increasing trend.

d. Compute and plot the seasonally adjusted data.

First we need to reset the year index in the series. The "seas" function used for the "X11" method needs a year value higher than 999. The as given plastic time series year index starts at 1.

head(plastics)
##    Jan  Feb  Mar  Apr  May  Jun
## 1  742  697  776  898 1030 1107
library(xts)
data_core <- coredata(plastics) 
test_ts <- ts(data_core, frequency = 12, start = c(2000, 1))
head(test_ts)
##       Jan  Feb  Mar  Apr  May  Jun
## 2000  742  697  776  898 1030 1107

Now we can use the X11 method to compute and show the the seasonally adjusted time series overlayed with the initial time series and the trend.

e. Change one observation to be an outlier (e.g., add 500 to one observation), and recompute the seasonally adjusted data. What is the effect of the outlier?

## [1] 1530

We can observe that the mid outlier affects the seasonally adjusted data while not havin an apparent effect on the extracted trend using the X11 method.

f. Does it make any difference if the outlier is near the end rather than in the middle of the time series?

The outliers clearly have an effect on the on the seasonaly adjusted and trend components extracted from the time series. We can see how the effect on the extracted trend is not only forwards in time from the time of the outlier but also backwards in the time to the start of the time series. The effect of the extreme positive outlier is to depress the trend at the time of the outlier.

6.3 Recall your retail time series data (from Exercise 3 in Section 2.10). Decompose the series using X11. Does it reveal any outliers, or unusual features that you had not noticed previously?

## 
## Call:
## seas(x = ., x11 = "")
## 
## Coefficients:
##               Mon                Tue                Wed  
##         -0.002510          -0.005290          -0.003702  
##               Thu                Fri                Sat  
##          0.003235           0.006741           0.008674  
##         Easter[8]         AO1989.Jan         AO1989.Feb  
##          0.023954          -0.293815          -0.174469  
##        AO1989.Dec  MA-Nonseasonal-01     MA-Seasonal-12  
##          0.172429           0.411782           0.657371

The X11 decomposition method reveals an increasing trend. It also reveals an initially increasing seasonality that levels off at around the year 1989. This discontinuity also appears in the ramainder where the trend has over-smoothed the change in seasonality strength.

There is an outlier present in the data set not observed previously. A dip in retail occurs at around 1989 that we can no observe in the remainder component. This observation was obsercure before by the changing in seasonality strength.