Load in and read the data

rm(list = ls())
library(readr)
Data <- read_csv("C:/Users/buffe/Documents/Forecasting Principles/Sales_Transactions_Dataset_Weekly-1.csv")
## Parsed with column specification:
## cols(
##   .default = col_integer(),
##   Product_Code = col_character(),
##   `Normalized 0` = col_double(),
##   `Normalized 1` = col_double(),
##   `Normalized 2` = col_double(),
##   `Normalized 3` = col_double(),
##   `Normalized 4` = col_double(),
##   `Normalized 5` = col_double(),
##   `Normalized 6` = col_double(),
##   `Normalized 7` = col_double(),
##   `Normalized 8` = col_double(),
##   `Normalized 9` = col_double(),
##   `Normalized 10` = col_double(),
##   `Normalized 11` = col_double(),
##   `Normalized 12` = col_double(),
##   `Normalized 13` = col_double(),
##   `Normalized 14` = col_double(),
##   `Normalized 15` = col_double(),
##   `Normalized 16` = col_double(),
##   `Normalized 17` = col_double(),
##   `Normalized 18` = col_double()
##   # ... with 33 more columns
## )
## See spec(...) for full column specifications.
View(Data)

Find top 10 products based on highest average for the 52 weeks

#Only raw data
library(fpp2)
## Warning: package 'fpp2' was built under R version 3.4.4
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.4.3
## Loading required package: forecast
## Warning: package 'forecast' was built under R version 3.4.4
## Loading required package: fma
## Warning: package 'fma' was built under R version 3.4.4
## Loading required package: expsmooth
## Warning: package 'expsmooth' was built under R version 3.4.4
raw <- Data[,c(1:55)]

raw$Total <- raw$W0 + raw$W1 + raw$W2 + raw$W3 + raw$W4 + raw$W5 + raw$W6 + raw$W7 + raw$W8 + raw$W9 + raw$W10 + raw$W11 + raw$W12 + raw$W13 + raw$W14 + raw$W15 + raw$W16 + raw$W17 + raw$W18 + raw$W19 + raw$W20 + raw$W21 + raw$W22 + raw$W23 + raw$W24 + raw$W25 + raw$W26 + raw$W27 + raw$W28 + raw$W29 + raw$W30 + raw$W31 + raw$W32 + raw$W33 + raw$W34 + raw$W35 + raw$W36 + raw$W37 + raw$W38 + raw$W39 + raw$W40 + raw$W41 + raw$W42 + raw$W43 + raw$W44 + raw$W45 + raw$W46 + raw$W47 + raw$W48 + raw$W49 + raw$W50 + raw$W51

raw$Average <- raw$Total/52

print(raw$Average)
##   [1]  9.63461538  3.98076923  8.69230769  8.26923077  8.46153846
##   [6]  4.23076923  4.09615385  8.65384615 10.36538462 19.42307692
##  [11] 11.55769231  3.90384615  9.03846154 11.82692308 34.71153846
##  [16] 36.05769231 33.94230769 32.34615385 32.44230769  8.94230769
##  [21]  8.88461538  9.36538462  4.13461538 36.09615385 30.80769231
##  [26] 10.28846154 34.69230769 32.61538462 12.07692308 32.50000000
##  [31]  8.50000000  9.09615385 11.61538462 37.15384615 34.71153846
##  [36] 35.44230769 35.73076923 36.38461538 33.76923077 35.84615385
##  [41] 34.96153846 32.11538462 36.78846154 32.53846154 31.75000000
##  [46] 33.00000000 33.42307692 34.69230769 34.55769231  8.82692308
##  [51] 17.92307692 32.98076923  4.50000000 35.76923077 31.57692308
##  [56] 32.71153846 33.15384615 33.42307692  8.96153846 32.98076923
##  [61] 32.13461538 16.03846154 35.05769231 31.71153846  9.40384615
##  [66] 35.42307692 32.53846154  8.50000000 33.57692308 32.07692308
##  [71]  9.50000000 34.86538462 32.82692308  9.01923077 35.28846154
##  [76] 32.36538462  4.50000000 31.94230769 32.34615385 30.73076923
##  [81]  8.90384615  8.53846154 34.84615385 33.69230769 31.69230769
##  [86] 32.76923077 31.59615385 31.26923077 32.21153846 32.86538462
##  [91]  8.78846154 36.46153846  8.71153846  8.78846154 12.30769231
##  [96] 34.67307692 31.61538462  4.03846154  9.28846154 11.13461538
## [101] 35.55769231 31.59615385  8.25000000  3.96153846  3.75000000
## [106] 10.71153846 17.71153846  2.84615385  9.40384615  8.86538462
## [111]  4.57692308 34.76923077 31.00000000  9.36538462 10.98076923
## [116]  9.32692308  4.34615385  9.65384615 33.15384615 33.19230769
## [121]  8.86538462  8.92307692  3.59615385  4.61538462  8.36538462
## [126]  4.32692308  2.25000000 35.09615385 35.23076923 33.94230769
## [131] 33.55769231 34.98076923 34.25000000 35.40384615 36.92307692
## [136] 35.75000000 36.42307692 31.98076923 32.88461538 33.36538462
## [141] 32.23076923 31.98076923 32.57692308  9.48076923  9.03846154
## [146]  8.44230769  9.19230769  3.86538462  9.34615385  3.94230769
## [151]  4.25000000  9.11538462  9.34615385  8.34615385  3.92307692
## [156]  3.59615385  8.26923077  3.46153846  4.07692308  9.09615385
## [161]  4.38461538  8.63461538  3.92307692  8.94230769  9.84615385
## [166]  9.65384615 33.30769231 34.34615385 31.09615385 32.90384615
## [171]  8.61538462 34.69230769 36.48076923 36.26923077 35.07692308
## [176] 32.92307692 33.07692308 37.01923077 36.61538462 35.63461538
## [181] 32.78846154 31.48076923 31.09615385 34.28846154 34.00000000
## [186] 34.59615385 30.36538462 32.26923077 32.26923077 36.76923077
## [191] 35.65384615 32.38461538 35.75000000 31.01923077  4.34615385
## [196] 32.63461538  9.61538462 10.23076923  3.32692308 17.40384615
## [201]  3.78846154 15.48076923  6.07692308  2.34615385 12.15384615
## [206]  2.63461538  5.65384615 31.63461538  9.90384615 12.55769231
## [211] 11.32692308  0.42307692  0.23076923  0.25000000  0.01923077
## [216]  0.19230769  0.13461538  0.09615385  0.30769231  0.25000000
## [221]  0.28846154  0.21153846  0.19230769  0.46153846  0.23076923
## [226]  0.17307692  0.11538462  0.03846154  0.17307692  0.03846154
## [231]  0.17307692  0.05769231  0.11538462  0.07692308  0.15384615
## [236]  0.09615385  0.09615385  0.26923077  0.21153846  0.21153846
## [241]  0.25000000  0.23076923  0.07692308  0.17307692  0.26923077
## [246]  0.13461538  0.36538462  0.23076923  0.07692308  0.03846154
## [251]  0.01923077  0.15384615  0.03846154  0.01923077  1.05769231
## [256]  0.07692308  0.65384615  0.09615385  0.01923077  0.09615385
## [261] 20.55769231 32.32692308 18.05769231  9.42307692  1.98076923
## [266]  9.46153846  9.34615385 18.46153846 12.30769231 19.80769231
## [271]  3.48076923  0.40384615  0.19230769  0.13461538  0.07692308
## [276]  0.05769231  0.26923077  0.13461538  0.03846154  0.13461538
## [281]  0.96153846  0.63461538  0.51923077 17.88461538  9.19230769
## [286] 18.46153846  1.17307692  0.84615385  0.40384615  0.26923077
## [291]  3.51923077  3.71153846  3.78846154  9.32692308  4.44230769
## [296]  4.21153846  3.92307692  3.94230769  9.11538462  4.28846154
## [301]  4.07692308  4.17307692  3.84615385  8.26923077  4.92307692
## [306]  4.07692308  4.36538462  3.98076923  9.26923077  4.46153846
## [311]  4.34615385  4.07692308  4.23076923  9.69230769  3.98076923
## [316]  4.21153846  4.34615385  3.67307692  9.11538462  4.21153846
## [321]  4.15384615  3.71153846  4.05769231  9.07692308  4.11538462
## [326]  4.07692308  3.88461538  4.01923077  4.44230769  4.01923077
## [331]  4.73076923  8.84615385  9.09615385  9.86538462  3.25000000
## [336]  3.50000000  3.86538462  2.61538462  1.21153846  0.57692308
## [341]  3.23076923  2.30769231  1.98076923  1.57692308  2.55769231
## [346]  0.32692308  0.38461538  0.44230769  0.30769231  0.15384615
## [351]  0.05769231  0.11538462  0.07692308  0.07692308  3.78846154
## [356]  2.19230769  1.23076923  5.09615385  0.98076923  2.53846154
## [361]  1.15384615  0.51923077 12.61538462  3.67307692  3.05769231
## [366]  2.25000000  5.38461538  3.92307692  3.55769231  2.19230769
## [371]  2.13461538  1.44230769  1.13461538  0.57692308  0.59615385
## [376]  0.59615385  0.38461538  0.25000000  0.05769231  0.03846154
## [381]  0.03846154  0.03846154  0.30769231  0.05769231  3.21153846
## [386]  2.94230769  2.48076923  2.67307692  2.59615385  5.36538462
## [391]  1.34615385  2.50000000  2.34615385  2.34615385  9.65384615
## [396] 12.00000000 12.69230769 15.73076923  3.80769231  3.26923077
## [401] 15.82692308  9.07692308 18.57692308 13.28846154 18.42307692
## [406] 12.01923077 42.69230769 16.53846154 17.01923077  3.50000000
## [411]  9.15384615  3.21153846  3.38461538  1.09615385  0.48076923
## [416]  0.30769231  0.23076923  0.09615385  0.03846154  0.78846154
## [421]  0.25000000  0.30769231  0.07692308  0.11538462  0.17307692
## [426]  0.03846154  8.78846154 12.36538462  6.13461538  7.96153846
## [431]  4.07692308  2.61538462 16.67307692  8.88461538  6.11538462
## [436]  0.44230769  0.42307692  0.28846154  0.26923077  0.40384615
## [441]  0.30769231  0.07692308  0.23076923  0.23076923  0.26923077
## [446]  0.48076923  0.40384615  0.32692308  0.28846154  0.28846154
## [451]  0.19230769  0.15384615  0.46153846  0.48076923  0.07692308
## [456]  0.25000000  0.26923077  0.36538462  0.21153846  0.13461538
## [461]  0.11538462  0.13461538  0.11538462  0.05769231  0.03846154
## [466]  0.03846154  0.01923077  0.13461538  0.03846154  0.23076923
## [471]  0.05769231  0.05769231  2.55769231  1.13461538  0.76923077
## [476]  1.05769231  0.90384615  0.40384615  1.32692308  0.63461538
## [481]  0.32692308  4.38461538  9.61538462 18.17307692 12.01923077
## [486] 10.75000000  4.42307692  8.32692308 17.82692308 10.69230769
## [491] 10.71153846 11.78846154 15.88461538  8.98076923  4.46153846
## [496]  3.82692308  8.78846154  6.23076923  5.09615385 12.51923077
## [501] 15.59615385 11.19230769 15.32692308 12.13461538 16.82692308
## [506]  8.76923077  5.65384615  7.28846154 24.78846154 18.51923077
## [511] 17.73076923 11.42307692  9.19230769 18.63461538 11.57692308
## [516]  9.67307692 18.59615385 12.17307692 10.11538462 10.67307692
## [521] 11.36538462  9.86538462 12.21153846 15.69230769 10.86538462
## [526] 10.88461538 12.65384615 15.76923077  4.88461538  9.09615385
## [531] 24.09615385  9.07692308 18.25000000 11.59615385 17.69230769
## [536] 12.67307692  9.26923077 17.46153846 10.69230769 10.73076923
## [541] 10.32692308 11.53846154 15.94230769 11.57692308 10.09615385
## [546] 32.51923077 31.44230769  9.19230769  9.15384615  8.69230769
## [551]  3.88461538 18.38461538 10.32692308 15.11538462 25.28846154
## [556] 11.90384615 11.26923077  9.59615385  3.90384615  4.23076923
## [561]  8.65384615  9.23076923  8.48076923 18.19230769  3.82692308
## [566]  3.23076923  2.67307692  2.51923077  5.32692308  1.38461538
## [571]  3.25000000  0.53846154  0.44230769  0.28846154  0.75000000
## [576]  0.26923077  0.15384615  3.30769231  3.13461538  2.38461538
## [581]  2.69230769  3.07692308  1.32692308  6.03846154  3.55769231
## [586]  2.09615385  1.48076923  3.61538462  2.67307692  1.21153846
## [591]  3.34615385  3.28846154  2.65384615  5.48076923  1.30769231
## [596] 12.23076923  3.82692308  2.19230769  1.67307692  0.78846154
## [601]  0.55769231  0.26923077  1.21153846  0.84615385  0.25000000
## [606]  0.44230769  3.44230769  3.75000000  3.55769231 13.09615385
## [611] 22.17307692  5.46153846 24.32692308  4.88461538 31.84615385
## [616] 34.26923077 32.15384615 30.63461538 32.65384615 32.55769231
## [621] 32.17307692  8.88461538  9.34615385  8.92307692  9.84615385
## [626]  8.40384615  9.26923077  8.65384615  8.84615385 10.00000000
## [631]  9.44230769  9.96153846  8.90384615 11.40384615  4.23076923
## [636] 12.82692308  0.19230769 16.67307692  2.50000000  3.40384615
## [641]  0.09615385  0.03846154  0.03846154  0.11538462  0.03846154
## [646]  0.05769231  0.36538462  0.19230769  0.25000000  0.03846154
## [651]  0.11538462  0.03846154  0.11538462  0.15384615  0.11538462
## [656]  0.13461538  0.05769231  0.07692308  0.73076923  0.42307692
## [661]  0.25000000  0.21153846  0.21153846  0.05769231  0.09615385
## [666]  0.75000000  0.34615385  0.21153846  3.07692308  7.32692308
## [671]  4.40384615  3.11538462  0.09615385  0.11538462  0.17307692
## [676]  0.01923077  0.13461538  0.07692308  0.07692308  0.01923077
## [681]  0.07692308  2.55769231  1.01923077  0.61538462  0.40384615
## [686]  0.44230769  0.26923077  2.26923077  2.55769231  0.30769231
## [691]  0.25000000  0.21153846  0.44230769  2.32692308  1.00000000
## [696]  0.88461538  3.03846154  5.78846154  3.01923077  0.75000000
## [701]  2.61538462  1.26923077  0.73076923  0.03846154  0.17307692
## [706]  0.05769231  0.07692308  0.13461538  0.07692308  0.05769231
## [711]  0.15384615  0.30769231  0.05769231  0.15384615  0.01923077
## [716]  0.03846154  0.09615385  1.11538462  3.03846154  0.78846154
## [721]  0.23076923  0.09615385  0.30769231  1.34615385  0.71153846
## [726]  0.42307692  0.34615385  1.19230769  2.78846154  0.67307692
## [731]  0.30769231  0.19230769  0.23076923  1.00000000  0.94230769
## [736]  0.17307692  5.23076923  1.21153846  2.90384615  0.67307692
## [741]  0.67307692  0.34615385  0.40384615  2.11538462  0.90384615
## [746]  0.94230769  0.42307692  0.32692308  0.28846154  0.23076923
## [751]  0.19230769  0.03846154  0.05769231  1.71153846  0.03846154
## [756]  3.17307692  0.78846154  0.48076923  1.28846154  3.96153846
## [761]  1.32692308  0.28846154  0.28846154  0.26923077  0.17307692
## [766]  0.11538462  0.07692308  0.30769231  0.21153846  0.15384615
## [771]  0.23076923  0.15384615 16.44230769  3.63461538 13.21153846
## [776]  3.38461538  2.13461538  2.26923077  1.30769231  3.40384615
## [781]  3.15384615  2.42307692  5.51923077  1.42307692  3.01923077
## [786]  0.65384615  0.44230769  3.32692308  2.94230769  2.28846154
## [791]  4.82692308  1.46153846  2.88461538  0.73076923  3.55769231
## [796]  2.92307692  2.65384615  5.17307692  1.30769231  3.11538462
## [801]  0.76923077  0.38461538  3.53846154  1.53846154  2.34615385
## [806]  5.11538462  0.44230769  2.73076923  0.50000000  0.32692308
## [811]  0.30769231
raw$Volatility <- raw$MAX - raw$MIN

results <- raw[,c(1,54,55,56,57,58)]
results
## # A tibble: 811 x 6
##    Product_Code   MIN   MAX Total   Average Volatility
##           <chr> <int> <int> <int>     <dbl>      <int>
##  1           P1     3    21   501  9.634615         18
##  2           P2     0    10   207  3.980769         10
##  3           P3     3    14   452  8.692308         11
##  4           P4     2    19   430  8.269231         17
##  5           P5     3    18   440  8.461538         15
##  6           P6     0    11   220  4.230769         11
##  7           P7     0    10   213  4.096154         10
##  8           P8     3    15   450  8.653846         12
##  9           P9     3    18   539 10.365385         15
## 10          P10     9    33  1010 19.423077         24
## # ... with 801 more rows
results <- results[order(-results$Total),]
results
## # A tibble: 811 x 6
##    Product_Code   MIN   MAX Total  Average Volatility
##           <chr> <int> <int> <int>    <dbl>      <int>
##  1         P409    23    73  2220 42.69231         50
##  2          P34    23    55  1932 37.15385         32
##  3         P178    19    53  1925 37.01923         34
##  4         P135    16    56  1920 36.92308         40
##  5          P43    20    61  1913 36.78846         41
##  6         P190    21    54  1912 36.76923         33
##  7         P179    19    55  1904 36.61538         36
##  8         P173    15    54  1897 36.48077         39
##  9          P92    19    59  1896 36.46154         40
## 10         P137    22    54  1894 36.42308         32
## # ... with 801 more rows
results.10 <- results[c(1:25),]

top10 <- results.10$Product_Code[c(1:10)]
top10
##  [1] "P409" "P34"  "P178" "P135" "P43"  "P190" "P179" "P173" "P92"  "P137"
full.top10 <- Data[Data$Product_Code %in% top10,]


colSums(raw[c(2:53)])
##   W0   W1   W2   W3   W4   W5   W6   W7   W8   W9  W10  W11  W12  W13  W14 
## 7220 7404 7615 7881 7765 7677 7883 7774 7935 7852 7940 7849 7970 7856 8035 
##  W15  W16  W17  W18  W19  W20  W21  W22  W23  W24  W25  W26  W27  W28  W29 
## 8147 8137 8033 8116 7822 7988 7875 8031 7998 8245 7212 5637 5834 5988 5952 
##  W30  W31  W32  W33  W34  W35  W36  W37  W38  W39  W40  W41  W42  W43  W44 
## 6170 6172 6293 6412 6482 6486 6500 6548 6692 6460 6636 6683 6808 6746 6840 
##  W45  W46  W47  W48  W49  W50  W51 
## 6939 7072 7032 7035 7214 7187 7209
total <- ts(as.numeric(colSums(raw[c(2:53)])), start = c(2015,1), frequency = 52)
autoplot(total)

Time series for each of the top 10 products

full.top10$Product_Code
##  [1] "P34"  "P43"  "P92"  "P135" "P137" "P173" "P178" "P179" "P190" "P409"
p34 <- ts(as.numeric(full.top10[c(1),c(2:53)]), start = c(2015,1), frequency = 52)

p43 <- ts(as.numeric(full.top10[c(2),c(2:53)]), start = c(2015,1), frequency = 52)

p92 <- ts(as.numeric(full.top10[c(3),c(2:53)]), start = c(2015,1), frequency = 52)

p135 <- ts(as.numeric(full.top10[c(4),c(2:53)]), start = c(2015,1), frequency = 52)

p137 <- ts(as.numeric(full.top10[c(5),c(2:53)]), start = c(2015,1), frequency = 52)

p173 <- ts(as.numeric(full.top10[c(6),c(2:53)]), start = c(2015,1), frequency = 52)

p178 <- ts(as.numeric(full.top10[c(7),c(2:53)]), start = c(2015,1), frequency = 52)

p179 <- ts(as.numeric(full.top10[c(8),c(2:53)]), start = c(2015,1), frequency = 52)

p190 <- ts(as.numeric(full.top10[c(9),c(2:53)]), start = c(2015,1), frequency = 52)

p409 <- ts(as.numeric(full.top10[c(10),c(2:53)]), start = c(2015,1), frequency = 52)

Number 1: P34

autoplot(p34)

autoplot(diff(p34))

fit34.auto <- auto.arima(p34, seasonal = FALSE)

fit34.auto
## Series: p34 
## ARIMA(3,1,2) 
## 
## Coefficients:
##           ar1      ar2      ar3      ma1      ma2
##       -0.9397  -0.5901  -0.2055  -0.0596  -0.5850
## s.e.   0.3688   0.2525   0.2577   0.3408   0.2344
## 
## sigma^2 estimated as 55.82:  log likelihood=-173.4
## AIC=358.8   AICc=360.71   BIC=370.39
autoplot(forecast(fit34.auto, h=8))

checkresiduals(fit34.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(3,1,2)
## Q* = 7.9037, df = 5.4, p-value = 0.1932
## 
## Model df: 5.   Total lags used: 10.4

This product is really volitile with no trend. The ACF plot looks good

Number 2: P43

autoplot(p43)

autoplot(diff(p43))

fit43.auto <- auto.arima(p43, seasonal = FALSE)

fit43.auto
## Series: p43 
## ARIMA(1,1,1) 
## 
## Coefficients:
##          ar1      ma1
##       0.0796  -0.7157
## s.e.  0.2426   0.1910
## 
## sigma^2 estimated as 68.48:  log likelihood=-179.42
## AIC=364.85   AICc=365.36   BIC=370.64
autoplot(forecast(fit43.auto, h=8)) 

checkresiduals(fit43.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(1,1,1)
## Q* = 6.3172, df = 8.4, p-value = 0.6519
## 
## Model df: 2.   Total lags used: 10.4

The forecast for this product is a flat line. The ACF plot looks good.

Number 3: P92

autoplot(p92)

autoplot(diff(p92))

fit92.auto <- auto.arima(p92, seasonal = FALSE)

fit92.auto
## Series: p92 
## ARIMA(2,1,0) 
## 
## Coefficients:
##           ar1      ar2
##       -0.5942  -0.5493
## s.e.   0.1244   0.1255
## 
## sigma^2 estimated as 67.46:  log likelihood=-179.18
## AIC=364.36   AICc=364.87   BIC=370.15
autoplot(forecast(fit92.auto, h=8))

checkresiduals(fit92.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(2,1,0)
## Q* = 9.3586, df = 8.4, p-value = 0.3492
## 
## Model df: 2.   Total lags used: 10.4

This product has a little volitility. The forecast looks good and ends on the upside.

Number 4: P135

autoplot(p135)

autoplot(diff(p135))

fit135.auto <- auto.arima(p135, seasonal = FALSE)

fit135.auto
## Series: p135 
## ARIMA(0,1,1) 
## 
## Coefficients:
##           ma1
##       -0.7394
## s.e.   0.1240
## 
## sigma^2 estimated as 56.83:  log likelihood=-175.28
## AIC=354.56   AICc=354.81   BIC=358.42
autoplot(forecast(fit135.auto, h=8))

checkresiduals(fit135.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(0,1,1)
## Q* = 9.1443, df = 9.4, p-value = 0.462
## 
## Model df: 1.   Total lags used: 10.4

This product has high volitility. The forecast for this product is a flat line.

Number 5: P137

autoplot(p137)

autoplot(diff(p137))

fit137.auto <- auto.arima(p137, seasonal = FALSE)

fit137.auto
## Series: p137 
## ARIMA(1,1,1) 
## 
## Coefficients:
##           ar1      ma1
##       -0.2454  -0.8096
## s.e.   0.1573   0.1099
## 
## sigma^2 estimated as 48.26:  log likelihood=-170.95
## AIC=347.89   AICc=348.4   BIC=353.69
autoplot(forecast(fit137.auto, h=8))

checkresiduals(fit137.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(1,1,1)
## Q* = 5.9723, df = 8.4, p-value = 0.6893
## 
## Model df: 2.   Total lags used: 10.4

This product has high volitility. The forecast for this product starts as a downward slop then goes into a flat line.

Number 6: P173

autoplot(p173)

autoplot(diff(p173))

fit173.auto <- auto.arima(p173, seasonal = FALSE)

fit173.auto
## Series: p173 
## ARIMA(0,1,1) 
## 
## Coefficients:
##           ma1
##       -0.6073
## s.e.   0.1481
## 
## sigma^2 estimated as 53.82:  log likelihood=-173.72
## AIC=351.45   AICc=351.7   BIC=355.31
autoplot(forecast(fit173.auto, h=8))

checkresiduals(fit173.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(0,1,1)
## Q* = 3.7648, df = 9.4, p-value = 0.9404
## 
## Model df: 1.   Total lags used: 10.4

This product has medium volitility. The forecast for this product is a flat line.

Number 7: P178

autoplot(p178)

autoplot(diff(p178))

fit178.auto <- auto.arima(p178, seasonal = FALSE)

fit178.auto
## Series: p178 
## ARIMA(0,1,1) 
## 
## Coefficients:
##           ma1
##       -0.7081
## s.e.   0.1116
## 
## sigma^2 estimated as 55.12:  log likelihood=-174.45
## AIC=352.9   AICc=353.15   BIC=356.77
autoplot(forecast(fit178.auto, h=8))

checkresiduals(fit178.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(0,1,1)
## Q* = 4.456, df = 9.4, p-value = 0.8993
## 
## Model df: 1.   Total lags used: 10.4

This product has medium volitility. The forecast for this product is a flat line.

Number 8: P179

autoplot(p179)

autoplot(diff(p179))

fit179.auto <- auto.arima(p179, seasonal = FALSE)

fit179.auto
## Series: p179 
## ARIMA(0,0,0) with non-zero mean 
## 
## Coefficients:
##          mean
##       36.6154
## s.e.   0.9461
## 
## sigma^2 estimated as 47.46:  log likelihood=-173.64
## AIC=351.27   AICc=351.52   BIC=355.17
autoplot(forecast(fit179.auto, h=8))

checkresiduals(fit179.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(0,0,0) with non-zero mean
## Q* = 14.308, df = 9.4, p-value = 0.1297
## 
## Model df: 1.   Total lags used: 10.4

This product has high volitility. The forecast for this product is a flat line and the CF is a rectangle.

Number 9: P190

autoplot(p190)

autoplot(diff(p190))

fit190.auto <- auto.arima(p190, seasonal = FALSE)

fit190.auto
## Series: p190 
## ARIMA(0,1,1) 
## 
## Coefficients:
##           ma1
##       -0.7946
## s.e.   0.0902
## 
## sigma^2 estimated as 46.61:  log likelihood=-170.33
## AIC=344.65   AICc=344.9   BIC=348.52
autoplot(forecast(fit190.auto, h=8))

checkresiduals(fit190.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(0,1,1)
## Q* = 3.7511, df = 9.4, p-value = 0.9411
## 
## Model df: 1.   Total lags used: 10.4

This product has volitility with a slight downward trend. The forecast is a straight line. The ACF plot looks good.

Number 10: P409

autoplot(p409)

autoplot(diff(p409))

fit409.auto <- auto.arima(p409, seasonal = FALSE)

fit409.auto
## Series: p409 
## ARIMA(1,0,0) with non-zero mean 
## 
## Coefficients:
##          ar1     mean
##       0.5160  43.2755
## s.e.  0.1267   2.9042
## 
## sigma^2 estimated as 110.2:  log likelihood=-195.17
## AIC=396.34   AICc=396.84   BIC=402.2
autoplot(forecast(fit409.auto, h=8))

checkresiduals(fit409.auto)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(1,0,0) with non-zero mean
## Q* = 13.541, df = 8.4, p-value = 0.1113
## 
## Model df: 2.   Total lags used: 10.4

The forecast for this product starts out with a decreasing slop and then levels out.