if (!require("fpp2")) install.packages("fpp2")
if (!require("seasonal")) install.packages("seasonal")plastics data set consists of the monthly sales (in thousands) of product A for a plastics manufacturer for five years.There is a increasing trend in the timeseries. All sales are at peak in summer
fit <- decompose(plastics, type="multiplicative")
trend_indices <- fit$trend
seasonal_indices <- fit$seasonal
autoplot(trend_indices)The results in of the multiplicative decomposition show that there is an increasing trend till 5 years. After that we can see decreasing it is decresing.
seasonal_indices is identical in thoughout all years
Yes, Results does support the graphical interpretation. summer months does have sales higher than other seasonal
obs_plast <- plastics
obs_plast[17] = obs_plast[17] + 500
fit2 <- decompose(obs_plast, type="multiplicative")
change_obes <- seasadj(fit2)
plot(change_obes)There is sudden spike in plot
obs_plast1 <- plastics
obs_plast1[55] = obs_plast[55] + 500
fit3 <- decompose(obs_plast1, type="multiplicative")
change_obes_end <- seasadj(fit3)
plot(change_obes_end)It appears that it doesn’t matter where the outlier occurs. we see a identical spike at the end like seen in previous plot
library(readxl)
library(seasonal)
retaildata <- readxl::read_excel("C:/Users/patel/Documents/Data_624/retail.xlsx", skip=1)
myts <- ts(retaildata[,"A3349398A"], frequency=12, start=c(1982,4))
myts %>% seas(x11="") -> myts_x11
autoplot(myts_x11) +
ggtitle("X11 decomposition")The X11 decomposition method reveals a smooth upward trend. The remainder plot describes that after 1992 trend and seasonality appear consistent. The unusual features that I had not noticed previously was there is sudden spike at 1986 in remainder plot despite there is consistancy in tread before and after that.