# this code basically installed packages if not installed already and load the mentioned packages
if (!require("pacman")) install.packages("pacman")
## Loading required package: pacman
pacman::p_load("moments","extRemes","stringi", "ggplot2", "TTR", "forecast","zoo","xts")
setwd("d:/google drive/FA/RCode")
op <- par(oma=c(5,7,1,1))
ShampooSales.data <- read.csv("ShampooSales.csv")
ShampooSales.ts <- ts(ShampooSales.data$Shampoo.Sales, start = c(1995,1), end = c(1997, 12), freq = 12)
ShampooSales.lm <- tslm(ShampooSales.ts ~ trend + I(trend^2))
par(op)
Above graph clearly showed that this is a Upward Exponantial Trend with additive Seasonality.
All 4 levels presnts in this time series
Yes, we expects seasonality in sales of shampoo. After decomposing time series
## Jan Feb Mar Apr May Jun
## 1995 -19.193924 -2.218924 -48.175174 27.591493 -44.800174 6.345660
## 1996 -19.193924 -2.218924 -48.175174 27.591493 -44.800174 6.345660
## 1997 -19.193924 -2.218924 -48.175174 27.591493 -44.800174 6.345660
## Jul Aug Sep Oct Nov Dec
## 1995 2.951910 30.431076 -1.171007 20.295660 37.274826 -9.331424
## 1996 2.951910 30.431076 -1.171007 20.295660 37.274826 -9.331424
## 1997 2.951910 30.431076 -1.171007 20.295660 37.274826 -9.331424
There are 3 reasons of seasonality 1. People buy more shampoo during summer time (like jun, july and august) as shown in above table
2. People tends to buy more during Off season sales periods like Oct and/or November 3. April shows positive numbers which indicates people stocked up shampoo as they deffered their purchases during winter season.