DATA 624 Homework 3

library(knitr)
library(rmdformats)

## Global options
options(max.print="31")
opts_chunk$set(echo=FALSE,
                 cache=TRUE,
               prompt=FALSE,
               tidy=TRUE,
               comment=NA,
               message=FALSE,
               warning=FALSE)
opts_knit$set(width=31)

library(ggplot2)
library(scales)
library(fma) # fma: Data Sets from "Forecasting: Methods and Applications" by Makridakis, Wheelwright & Hyndman (1998)
## Loading required package: forecast
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
library(fpp2)
## Loading required package: expsmooth
library(seasonal)
library(gridExtra)

6.2

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

a

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

Ans: There is definitely a seaonality spotted from the seasonal plot. Sales peaked in August and bottomed in Feb. And there is an apparent upward trend spotted in the seasonal plot where there appears to have a consistent increase in sales year over year, from 1 to 5.

b

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

c

Do the results support the graphical interpretation from part a?
Ans: Yes, it does support the trend very well. It also shows in the seasonal component that there is a seasonal pattern in the time series.

d

Compute and plot the seasonally adjusted data.

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?

Ans: The outliner did affect the trend as you could tell it was inflated for a segment of it in the trend component in the decomposision plot above. It didn’t affect the seasonal plot. The remainder of the graph did show there was a spike at the same time as the outliner occurred.

f

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

Ans: It only does affect the remainder plot if the outliner turns out to appear at the end of the plot. I don’t think think it makes a difference in the seasonal plot in the decomposition plot, which means there is no difference in saasonally adjusted plot.

6.3

Ans: I don’t see any differences in the seaonal and trend component of the decompositions. However, there are apparently some major differecnes in the remainder between the classical decomposition method (additive) and the X11 decomposition method.