Here we consider a problem, where we need to predict demand for particular store item at a certain date. We have several stores to consider. For this problem, we will construct 2 models: a Prophet-library based and an XGboost based.
library(data.table) # library for fast data processing
library(ggplot2) # library for data visualization
library(xgboost) # library for XGBoost
library(Metrics) # library for evaluation
library(Matrix) # library used to work with sparse matrices
library(prophet) # library create forecasting models
library(dplyr) # library for data engineering
library(lubridate) # library to work with dates
library(zoo)
library(purrr)
library(tidyr)
library(rstan)
library(anomalize) # library to find anomalies
Getting data from train.csv file
setwd("~/Dropbox/RProjects/datasets/demandForecasting/")
df = read.csv("train.csv")
Let’s see what kind of data are in the dataset
head(df)
date store item sales
1 2013-01-01 1 1 13
2 2013-01-02 1 1 11
3 2013-01-03 1 1 14
4 2013-01-04 1 1 13
5 2013-01-05 1 1 10
6 2013-01-06 1 1 12
str(df)
'data.frame': 913000 obs. of 4 variables:
$ date : Factor w/ 1826 levels "2013-01-01","2013-01-02",..: 1 2 3 4 5 6 7 8 9 10 ...
$ store: int 1 1 1 1 1 1 1 1 1 1 ...
$ item : int 1 1 1 1 1 1 1 1 1 1 ...
$ sales: int 13 11 14 13 10 12 10 9 12 9 ...
We change format of dates from Factor to Date
df$date <- ymd(df$date)
Taking into considerations the power of my computer, we will use only 200000 rows of data.
train <- df[c(1:200000),]
We create group variable which will represent relation between store and item.
train$group <- as.factor(paste(train$store,train$item,sep="-"))
train$group_id <- as.integer(train$group)
head(train)
date store item sales group group_id
1 2013-01-01 1 1 13 1-1 12
2 2013-01-02 1 1 11 1-1 12
3 2013-01-03 1 1 14 1-1 12
4 2013-01-04 1 1 13 1-1 12
5 2013-01-05 1 1 10 1-1 12
6 2013-01-06 1 1 12 1-1 12
Since we have created group variable, we can get rid of store and item variables.
df <- train[,c(1,4,6)]
head(df)
date sales group_id
1 2013-01-01 13 12
2 2013-01-02 11 12
3 2013-01-03 14 12
4 2013-01-04 13 12
5 2013-01-05 10 12
6 2013-01-06 12 12
In order to use prophet library we have to rename our date variable to ds and our target variable to y.
colnames(df) <- c("ds","y","group")
summary(df$y)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.00 27.00 46.00 49.47 67.00 181.00
Prophet does not work well with 0 and since our target variable has min vaue of 0, we add 1 to all values.
df$y <- df$y+1
We are aiming to predict sales demand for the last 30 days. Creating test dataset with those days.
test <- df %>% dplyr::group_by(group) %>%
dplyr::top_n(30, ds)
head(test)
# A tibble: 6 x 3
# Groups: group [1]
ds y group
<date> <dbl> <int>
1 2017-12-02 17 12
2 2017-12-03 32 12
3 2017-12-04 8 12
4 2017-12-05 21 12
5 2017-12-06 18 12
6 2017-12-07 19 12
Creating train dataset.
train_prophet <- (anti_join(df,test))
Checking how many NAs are in the train dataset.
sum(is.na(train_prophet))
[1] 0
# creating new dataframe
d1 <- train_prophet %>%
# creates a list of data frames by group containing all the nested variables
nest(-group) %>%
# for each group creates new variable m that contein prophet model
mutate(m = map(data, prophet)) %>%
# creates a new variable future that will contain 30 days we are going to forecast the demand for.
mutate(future = map(m, make_future_dataframe, period = 30)) %>%
# creates a new variable forecast, containing predicted values for 30 days.
mutate(forecast = map2(m, future, predict))
#transforing data back to normal structured dataframe.
d <- d1 %>%
unnest(forecast) %>%
select(ds, group, yhat)
head(d)
ds group yhat
1 2013-01-01 12 9.817356
2 2013-01-02 12 10.439999
3 2013-01-03 12 11.115833
4 2013-01-04 12 12.725259
5 2013-01-05 12 14.583960
6 2013-01-06 12 15.334291
Predicted values have been put to a dataframe named validate. Then we put predicted and fact values of test dataset to a dataframe named final.
validate <- d %>% group_by(group) %>%
top_n(30, ds)
validate <- as.data.frame(validate)
validate$ds <- ymd(validate$ds)
test <- as.data.frame(test)
test$ds <- ymd(test$ds)
final <- inner_join(test,validate)
Using RMSE metric, we can see how good is the model.
rmse(actual = final$y, predicted = final$yhat)
[1] 7.733055
Visualising differences between fact and prediction using plots. Since there are many groups in the dataset, we only plot the graphs for the 2 groups. Let it be group with id 2 and 12.
ggplot(final[final$group==2,], aes(ds)) +
geom_line(aes(y = y, colour = "fatc")) +
geom_line(aes(y = yhat, colour = "prediction"))
ggplot(final[final$group==12,], aes(ds)) +
geom_line(aes(y = y, colour = "fatc")) +
geom_line(aes(y = yhat, colour = "prediction"))
Creating test and train datasets for the model.
ts <- df %>% dplyr::group_by(group) %>%
dplyr::top_n(30, ds)
head(ts) # test dataset
# A tibble: 6 x 3
# Groups: group [1]
ds y group
<date> <dbl> <int>
1 2017-12-02 17 12
2 2017-12-03 32 12
3 2017-12-04 8 12
4 2017-12-05 21 12
5 2017-12-06 18 12
6 2017-12-07 19 12
tr <- (anti_join(df,ts)) # train dataset
For xgboost we create two objects for train and test that would store our dense matrix and target variable.
tr_matrix <- data.matrix(select(tr,-c(y)))
ts_matrix <- data.matrix(select(ts,-c(y)))
train_target <- tr$y
test_target <- ts$y
dtrain <- xgb.DMatrix(data=tr_matrix,label=train_target)
ctest <- xgb.DMatrix(data=ts_matrix,label=test_target)
Creating watchlist to see the intermediate results.
watchlist = list(train=dtrain,test=ctest)
Creating XGboost model based on linear regression.
bst <- xgb.train(data=dtrain,
booster="gbtree",
watchlist = watchlist,
nrounds = 30000,
objective = "reg:linear",
eval_metric="rmse",
maximize = F,
early_stopping_rounds = 10,
max_depth=10,
subsample=0.7,
colsample_bytree=0.7,
lambda=0.01,
alpha=0.0001
)
[1] train-rmse:43.923855 test-rmse:37.270245
Multiple eval metrics are present. Will use test_rmse for early stopping.
Will train until test_rmse hasn't improved in 10 rounds.
[2] train-rmse:35.644768 test-rmse:30.152542
[3] train-rmse:30.748945 test-rmse:25.573338
[4] train-rmse:28.018768 test-rmse:23.688732
[5] train-rmse:26.557682 test-rmse:22.724562
[6] train-rmse:25.804014 test-rmse:22.179096
[7] train-rmse:19.461094 test-rmse:16.007992
[8] train-rmse:15.426314 test-rmse:12.312246
[9] train-rmse:12.926808 test-rmse:10.321694
[10] train-rmse:11.508785 test-rmse:9.485328
[11] train-rmse:10.744953 test-rmse:9.259506
[12] train-rmse:10.351127 test-rmse:9.291866
[13] train-rmse:10.207957 test-rmse:9.394094
[14] train-rmse:10.015311 test-rmse:9.503741
[15] train-rmse:9.923704 test-rmse:9.609166
[16] train-rmse:9.873788 test-rmse:9.712809
[17] train-rmse:9.851348 test-rmse:9.787491
[18] train-rmse:9.838767 test-rmse:9.843113
[19] train-rmse:9.746819 test-rmse:9.916269
[20] train-rmse:9.693826 test-rmse:9.736404
[21] train-rmse:9.687281 test-rmse:9.776039
Stopping. Best iteration:
[11] train-rmse:10.744953 test-rmse:9.259506
Get the predicted values.
ts$yhat <- predict(bst,ctest)
We are using the same metric as with prophet to evaluate the model.
rmse(actual = ts$y, predicted = ts$yhat)
[1] 9.259507
Visualising differences between fact and prediction using plots. Since we have been using liear regression it is not a surprise that will be getting a stright line as our prediction trend.
ggplot(ts[ts$group==12,], aes(ds)) +
geom_line(aes(y = y, colour = "fact")) +
geom_line(aes(y = yhat, colour = "prediction"))
Finding all anomalies days by date for a every group.
dfa <- data.frame()
for (group in unique(df$group)) {
dfa <- rbind(dfa,cbind(tbl_df(df[df$group==group,]) %>%
time_decompose(y,
frequency = "auto",
trend = "1 week") %>%
anomalize(remainder, method = "iqr"), group))
}
dfa2 <- dfa[dfa$anomaly=="Yes", c("ds", "observed", "group")]
colnames(dfa2) <- c("date", "y", "group")
dfa2
date y group
160 2013-06-09 39 12
503 2014-05-18 37 12
651 2014-10-13 7 12
887 2015-06-06 44 12
927 2015-07-16 42 12
938 2015-07-27 14 12
992 2015-09-19 41 12
1068 2015-12-04 30 12
1419 2016-11-19 37 12
1640 2017-06-28 51 12
2699 2015-05-23 54 23
3026 2016-04-14 51 23
3930 2013-10-05 12 34
3979 2013-11-23 19 34
4213 2014-07-15 17 34
4311 2014-10-21 36 34
4470 2015-03-29 42 34
4593 2015-07-30 51 34
4673 2015-10-18 43 34
4679 2015-10-24 15 34
4909 2016-06-10 50 34
4972 2016-08-12 43 34
4974 2016-08-14 45 34
5019 2016-09-28 46 34
5058 2016-11-06 46 34
5072 2016-11-20 47 34
5218 2017-04-15 53 34
5268 2017-06-04 51 34
5288 2017-06-24 29 34
5715 2013-08-25 43 45
6075 2014-08-20 33 45
6150 2014-11-03 31 45
6310 2015-04-12 39 45
6427 2015-08-07 19 45
6786 2016-07-31 55 45
6876 2016-10-29 41 45
7098 2017-06-08 16 45
7129 2017-07-09 53 45
7804 2014-05-15 30 56
7984 2014-11-11 29 56
8197 2015-06-12 14 56
8502 2016-04-12 35 56
8572 2016-06-21 41 56
8908 2017-05-23 37 56
8926 2017-06-10 39 56
9978 2015-04-28 28 67
10155 2015-10-22 32 67
10489 2016-09-20 32 67
10861 2017-09-27 8 67
11310 2013-12-20 23 78
11487 2014-06-15 41 78
11530 2014-07-28 27 78
11619 2014-10-25 9 78
11641 2014-11-16 31 78
11655 2014-11-30 28 78
11726 2015-02-09 23 78
11754 2015-03-09 24 78
11770 2015-03-25 26 78
11811 2015-05-05 27 78
11844 2015-06-07 34 78
11903 2015-08-05 25 78
12166 2016-04-24 37 78
12208 2016-06-05 33 78
12277 2016-08-13 33 78
12462 2017-02-14 25 78
12658 2017-08-29 10 78
12687 2017-09-27 27 78
12732 2017-11-11 29 78
12751 2017-11-30 30 78
13788 2015-10-03 44 89
13938 2016-03-01 38 89
14345 2017-04-12 50 89
14356 2017-04-23 60 89
14360 2017-04-27 23 89
14405 2017-06-11 60 89
14419 2017-06-25 57 89
14427 2017-07-03 21 89
14429 2017-07-05 27 89
14538 2017-10-22 55 89
14563 2017-11-16 51 89
14599 2017-12-22 37 89
15119 2014-05-26 14 100
15575 2015-08-25 10 100
15853 2016-05-29 50 100
15917 2016-08-01 15 100
15919 2016-08-03 15 100
15936 2016-08-20 15 100
16229 2017-06-09 51 100
16264 2017-07-14 50 100
16287 2017-08-06 49 100
16768 2013-11-30 35 1
16985 2014-07-05 49 1
17008 2014-07-28 42 1
17369 2015-07-24 18 1
17623 2016-04-03 49 1
17656 2016-05-06 51 1
17658 2016-05-08 51 1
17837 2016-11-03 14 1
17838 2016-11-04 22 1
18042 2017-05-27 55 1
18089 2017-07-13 22 1
18101 2017-07-25 49 1
18370 2013-04-20 27 15
18819 2014-07-13 103 15
19158 2015-06-17 79 15
19387 2016-02-01 54 15
19511 2016-06-04 104 15
19582 2016-08-14 101 15
19918 2017-07-16 116 15
20246 2013-06-09 120 26
20650 2014-07-18 127 26
20682 2014-08-19 55 26
20904 2015-03-29 109 26
21331 2016-05-29 140 26
21715 2017-06-17 151 26
21745 2017-07-17 72 26
21746 2017-07-18 80 26
22147 2013-08-23 93 37
22476 2014-07-18 105 37
22489 2014-07-31 105 37
22773 2015-05-11 54 37
22799 2015-06-06 117 37
22868 2015-08-14 60 37
22975 2015-11-29 100 37
23172 2016-06-13 46 37
23201 2016-07-12 112 37
23374 2017-01-01 41 37
23458 2017-03-26 108 37
23531 2017-06-07 109 37
23549 2017-06-25 132 37
23611 2017-08-26 128 37
23885 2013-05-27 80 48
23898 2013-06-09 94 48
24623 2015-06-04 106 48
25081 2016-09-04 53 48
25328 2017-05-09 97 48
25381 2017-07-01 125 48
25409 2017-07-29 134 48
25877 2013-11-09 66 59
26132 2014-07-22 37 59
26243 2014-11-10 49 59
26487 2015-07-12 88 59
26897 2016-08-25 35 59
26919 2016-09-16 74 59
27235 2017-07-29 54 59
27341 2017-11-12 84 59
27725 2013-12-01 21 70
27917 2014-06-11 70 70
28251 2015-05-11 57 70
28619 2016-05-13 38 70
28977 2017-05-06 84 70
29012 2017-06-10 92 70
29030 2017-06-28 75 70
29045 2017-07-13 47 70
29090 2017-08-27 84 70
29488 2013-09-29 23 81
29565 2013-12-15 21 81
29679 2014-04-08 26 81
29703 2014-05-02 62 81
29822 2014-08-29 57 81
29823 2014-08-30 63 81
29912 2014-11-27 64 81
30922 2017-09-02 35 81
31377 2013-12-01 37 92
31519 2014-04-22 96 92
31524 2014-04-27 62 92
31593 2014-07-05 124 92
31600 2014-07-12 115 92
31932 2015-06-09 102 92
31967 2015-07-14 104 92
32063 2015-10-18 64 92
32228 2016-03-31 55 92
32296 2016-06-07 113 92
32300 2016-06-11 124 92
32329 2016-07-10 138 92
32402 2016-09-21 105 92
32630 2017-05-07 87 92
32644 2017-05-21 146 92
32682 2017-06-28 65 92
32833 2017-11-26 80 92
33451 2014-08-06 90 103
33567 2014-11-30 100 103
33725 2015-05-07 95 103
34148 2016-07-03 115 103
34169 2016-07-24 118 103
34179 2016-08-03 84 103
34448 2017-04-29 60 103
34468 2017-05-19 109 103
34485 2017-06-05 50 103
34497 2017-06-17 127 103
34503 2017-06-23 108 103
34526 2017-07-16 76 103
35029 2013-12-01 41 4
35267 2014-07-27 113 4
35551 2015-05-07 98 4
35555 2015-05-11 42 4
35610 2015-07-05 120 4
35942 2016-06-01 107 4
36142 2016-12-18 44 4
36145 2016-12-21 31 4
36238 2017-03-24 97 4
36269 2017-04-24 47 4
36490 2017-12-01 48 4
37086 2014-07-20 66 16
37114 2014-08-17 58 16
37365 2015-04-25 58 16
37440 2015-07-09 27 16
37458 2015-07-27 24 16
37505 2015-09-12 61 16
37716 2016-04-10 68 16
37765 2016-05-29 34 16
37773 2016-06-06 20 16
37821 2016-07-24 71 16
37829 2016-08-01 18 16
37875 2016-09-16 59 16
37949 2016-11-29 45 16
38108 2017-05-07 67 16
38135 2017-06-03 38 16
38185 2017-07-23 69 16
38198 2017-08-05 69 16
38554 2013-07-27 81 27
38896 2014-07-04 88 27
38915 2014-07-23 40 27
39311 2015-08-23 84 27
39561 2016-04-29 42 27
39625 2016-07-02 95 27
39953 2017-05-26 83 27
40351 2013-06-28 26 38
40668 2014-05-11 78 38
40765 2014-08-16 75 38
40769 2014-08-20 64 38
40914 2015-01-12 39 38
41051 2015-05-29 65 38
41748 2017-04-25 29 38
41776 2017-05-23 36 38
41793 2017-06-09 77 38
41848 2017-08-03 32 38
41943 2017-11-06 53 38
42559 2014-07-15 62 49
42655 2014-10-19 26 49
42910 2015-07-01 64 49
43014 2015-10-13 59 49
43039 2015-11-07 71 49
43173 2016-03-20 68 49
43188 2016-04-04 58 49
43193 2016-04-09 68 49
43206 2016-04-22 69 49
43243 2016-05-29 77 49
43267 2016-06-22 68 49
43332 2016-08-26 69 49
43359 2016-09-22 64 49
43712 2017-09-10 72 49
43716 2017-09-14 69 49
43765 2017-11-02 60 49
43780 2017-11-17 33 49
44032 2013-07-27 53 60
44492 2014-10-30 10 60
44688 2015-05-14 48 60
44746 2015-07-11 23 60
44752 2015-07-17 54 60
44789 2015-08-23 50 60
44832 2015-10-05 34 60
45154 2016-08-22 17 60
45168 2016-09-05 47 60
45193 2016-09-30 25 60
45195 2016-10-02 21 60
45410 2017-05-05 52 60
46349 2014-11-30 45 71
46909 2016-06-12 61 71
46930 2016-07-03 57 71
46946 2016-07-19 52 71
47306 2017-07-14 58 71
47322 2017-07-30 62 71
47391 2017-10-07 20 71
47691 2013-08-03 41 82
47692 2013-08-04 42 82
48000 2014-06-08 49 82
48152 2014-11-07 45 82
48310 2015-04-14 13 82
48323 2015-04-27 38 82
48328 2015-05-02 48 82
49120 2017-07-02 61 82
49148 2017-07-30 52 82
49293 2017-12-22 35 82
49800 2014-05-13 36 93
49975 2014-11-04 61 93
50541 2016-05-23 31 93
50557 2016-06-08 75 93
50848 2017-03-26 79 93
50895 2017-05-12 79 93
50953 2017-07-09 105 93
50995 2017-08-20 100 93
51004 2017-08-29 72 93
51049 2017-10-13 40 93
51081 2017-11-14 65 93
51220 2013-04-02 43 104
51246 2013-04-28 32 104
51321 2013-07-12 53 104
51324 2013-07-15 48 104
51534 2014-02-10 35 104
51607 2014-04-24 21 104
51682 2014-07-08 60 104
51699 2014-07-25 71 104
51777 2014-10-11 19 104
51812 2014-11-15 58 104
51815 2014-11-18 52 104
51888 2015-01-30 16 104
51993 2015-05-15 36 104
52039 2015-06-30 32 104
52051 2015-07-12 74 104
52055 2015-07-16 68 104
52103 2015-09-02 18 104
52140 2015-10-09 58 104
52148 2015-10-17 60 104
52151 2015-10-20 55 104
52182 2015-11-20 70 104
52334 2016-04-20 61 104
52414 2016-07-09 81 104
52449 2016-08-13 71 104
52522 2016-10-25 53 104
52841 2017-09-09 34 104
52896 2017-11-03 63 104
53265 2013-11-07 17 5
53580 2014-09-18 65 5
54000 2015-11-12 63 5
54120 2016-03-11 63 5
54280 2016-08-18 67 5
54668 2017-09-10 72 5
54727 2017-11-08 35 5
54743 2017-11-24 72 5
55002 2013-08-10 35 17
55032 2013-09-09 5 17
55702 2015-07-11 40 17
55705 2015-07-14 36 17
56055 2016-06-28 15 17
56134 2016-09-15 41 17
56190 2016-11-10 36 17
56332 2017-04-01 38 17
56443 2017-07-21 42 17
56480 2017-08-27 44 17
56713 2013-04-17 12 28
57123 2014-06-01 53 28
57419 2015-03-24 39 28
57471 2015-05-15 57 28
57536 2015-07-19 60 28
57858 2016-06-05 67 28
57933 2016-08-19 53 28
58241 2017-06-23 57 28
58275 2017-07-27 25 28
58278 2017-07-30 63 28
58299 2017-08-20 59 28
59081 2014-10-11 16 39
59310 2015-05-28 46 39
59643 2016-04-25 15 39
59860 2016-11-28 35 39
59999 2017-04-16 24 39
60810 2014-07-06 49 50
60865 2014-08-30 45 50
61153 2015-06-14 55 50
61193 2015-07-24 45 50
61223 2015-08-23 45 50
61271 2015-10-10 41 50
61842 2017-05-03 41 50
61853 2017-05-14 48 50
62202 2013-04-28 38 61
62574 2014-05-05 26 61
62661 2014-07-31 33 61
62750 2014-10-28 27 61
63027 2015-08-01 41 61
63351 2016-06-20 10 61
63371 2016-07-10 39 61
63381 2016-07-20 12 61
63569 2017-01-24 23 61
63742 2017-07-16 38 61
63851 2017-11-02 33 61
63947 2013-02-06 24 72
64084 2013-06-23 33 72
64412 2014-05-17 36 72
64790 2015-05-30 35 72
64915 2015-10-02 31 72
64995 2015-12-21 19 72
65056 2016-02-20 29 72
65193 2016-07-06 10 72
65231 2016-08-13 11 72
65239 2016-08-21 34 72
65248 2016-08-30 8 72
65267 2016-09-18 40 72
65358 2016-12-18 29 72
65476 2017-04-15 36 72
65551 2017-06-29 39 72
65697 2017-11-22 30 72
65707 2017-12-02 9 72
65893 2013-06-06 31 83
66183 2014-03-23 10 83
66560 2015-04-04 12 83
66564 2015-04-08 12 83
66594 2015-05-08 30 83
66596 2015-05-10 30 83
67044 2016-07-31 34 83
67053 2016-08-09 6 83
67384 2017-07-06 34 83
67385 2017-07-07 28 83
67516 2017-11-15 28 83
68029 2014-04-12 19 94
68323 2015-01-31 11 94
68442 2015-05-30 51 94
68443 2015-05-31 53 94
68457 2015-06-14 54 94
68602 2015-11-06 45 94
68725 2016-03-08 14 94
68790 2016-05-12 48 94
68792 2016-05-14 55 94
68793 2016-05-15 57 94
68823 2016-06-14 18 94
68950 2016-10-19 38 94
69183 2017-06-09 26 94
69345 2017-11-18 51 94
69608 2013-08-08 33 105
69626 2013-08-26 33 105
69841 2014-03-29 37 105
69911 2014-06-07 40 105
70281 2015-06-12 19 105
70372 2015-09-11 15 105
70996 2017-05-27 42 105
71039 2017-07-09 50 105
71043 2017-07-13 19 105
71071 2017-08-10 49 105
71093 2017-09-01 42 105
71124 2017-10-02 34 105
71179 2017-11-26 52 105
71549 2013-12-01 9 6
71664 2014-03-26 13 6
71743 2014-06-13 15 6
71766 2014-07-06 48 6
72112 2015-06-17 45 6
72186 2015-08-30 51 6
72512 2016-07-21 26 6
72543 2016-08-21 50 6
72823 2017-05-28 56 6
72867 2017-07-11 21 6
72905 2017-08-18 50 6
72924 2017-09-06 16 6
73614 2014-07-28 7 18
73632 2014-08-15 33 18
73644 2014-08-27 6 18
73649 2014-09-01 9 18
73863 2015-04-03 30 18
73866 2015-04-06 25 18
73945 2015-06-24 32 18
74284 2016-05-28 11 18
74301 2016-06-14 8 18
74333 2016-07-16 37 18
74346 2016-07-29 34 18
74549 2017-02-17 27 18
74697 2017-07-15 38 18
74749 2017-09-05 8 18
74768 2017-09-24 36 18
75028 2013-06-11 39 29
75397 2014-06-15 46 29
75425 2014-07-13 20 29
75502 2014-09-28 44 29
75891 2015-10-22 41 29
76084 2016-05-02 11 29
76116 2016-06-03 24 29
76437 2017-04-20 16 29
76439 2017-04-22 23 29
76494 2017-06-16 47 29
76516 2017-07-08 30 29
76643 2017-11-12 48 29
77179 2014-05-02 37 40
78012 2016-08-12 40 40
78370 2017-08-05 44 40
78372 2017-08-07 9 40
78716 2013-07-17 36 51
78839 2013-11-17 33 51
79056 2014-06-22 18 51
79806 2016-07-11 11 51
79814 2016-07-19 43 51
80189 2017-07-29 50 51
80195 2017-08-04 38 51
80221 2017-08-30 14 51
80334 2017-12-21 28 51
80887 2014-06-27 31 62
81315 2015-08-29 34 62
81365 2015-10-18 8 62
81595 2016-06-04 14 62
81597 2016-06-06 7 62
81678 2016-08-26 32 62
81685 2016-09-02 26 62
81917 2017-04-22 11 62
82624 2014-03-30 26 73
83015 2015-04-25 28 73
83333 2016-03-08 6 73
83373 2016-04-17 29 73
83450 2016-07-03 37 73
83539 2016-09-30 28 73
83638 2017-01-07 25 73
83732 2017-04-11 29 73
83772 2017-05-21 32 73
83833 2017-07-21 34 73
83907 2017-10-03 25 73
84550 2014-07-08 23 84
84765 2015-02-08 21 84
84801 2015-03-16 20 84
84971 2015-09-02 25 84
85116 2016-01-25 19 84
85263 2016-06-20 11 84
85619 2017-06-11 32 84
85783 2017-11-22 26 84
86503 2014-11-12 10 95
87078 2016-06-09 41 95
87207 2016-10-16 15 95
87394 2017-04-21 44 95
87431 2017-05-28 46 95
87550 2017-09-24 47 95
87618 2017-12-01 12 95
87643 2017-12-26 34 95
87709 2013-03-02 28 106
87781 2013-05-13 24 106
87806 2013-06-07 35 106
87982 2013-11-30 33 106
88096 2014-03-24 28 106
88179 2014-06-15 36 106
88199 2014-07-05 37 106
88202 2014-07-08 38 106
88251 2014-08-26 35 106
88311 2014-10-25 32 106
88337 2014-11-20 37 106
88522 2015-05-24 12 106
88525 2015-05-27 11 106
88609 2015-08-19 37 106
88694 2015-11-12 38 106
88858 2016-04-24 38 106
88899 2016-06-04 44 106
89218 2017-04-19 13 106
89286 2017-06-26 18 106
89346 2017-08-25 41 106
89660 2013-07-05 35 7
90345 2015-05-21 15 7
90388 2015-07-03 41 7
90428 2015-08-12 37 7
90434 2015-08-18 39 7
90687 2016-04-27 39 7
90783 2016-08-01 13 7
90904 2016-11-30 36 7
90951 2017-01-16 25 7
91115 2017-06-29 43 7
91136 2017-07-20 42 7
91437 2013-05-17 75 19
91789 2014-05-04 87 19
92272 2015-08-30 94 19
92529 2016-05-13 57 19
92608 2016-07-31 104 19
92681 2016-10-12 78 19
92972 2017-07-30 99 19
93174 2013-02-17 45 30
93476 2013-12-16 55 30
93655 2014-06-13 67 30
93753 2014-09-19 110 30
93797 2014-11-02 74 30
93915 2015-02-28 44 30
93957 2015-04-11 110 30
94011 2015-06-04 118 30
94069 2015-08-01 69 30
94145 2015-10-16 100 30
94246 2016-01-25 65 30
94303 2016-03-22 95 30
94403 2016-06-30 82 30
94489 2016-09-24 81 30
94557 2016-12-01 58 30
94687 2017-04-10 102 30
94721 2017-05-14 134 30
94742 2017-06-04 146 30
94791 2017-07-23 142 30
94798 2017-07-30 145 30
94812 2017-08-13 134 30
94870 2017-10-10 97 30
94922 2017-12-01 45 30
95440 2014-05-03 108 41
95457 2014-05-20 95 41
95468 2014-05-31 69 41
95492 2014-06-24 49 41
95741 2015-02-28 47 41
95816 2015-05-14 60 41
95875 2015-07-12 120 41
95917 2015-08-23 119 41
96118 2016-03-11 88 41
96203 2016-06-04 80 41
96258 2016-07-29 80 41
96383 2016-12-01 38 41
96540 2017-05-07 122 41
96583 2017-06-19 61 41
96596 2017-07-02 137 41
96599 2017-07-05 111 41
96634 2017-08-09 61 41
97279 2014-05-16 101 52
97309 2014-06-15 99 52
97327 2014-07-03 91 52
97345 2014-07-21 48 52
97562 2015-02-23 55 52
97768 2015-09-17 84 52
97960 2016-03-27 93 52
97967 2016-04-03 96 52
97987 2016-04-23 108 52
98003 2016-05-09 43 52
98018 2016-05-24 48 52
98044 2016-06-19 114 52
98055 2016-06-30 111 52
98119 2016-09-02 100 52
98135 2016-09-18 105 52
98334 2017-04-05 89 52
98353 2017-04-24 43 52
98391 2017-06-01 109 52
98399 2017-06-09 106 52
98457 2017-08-06 110 52
98537 2017-10-25 88 52
98570 2017-11-27 41 52
98743 2013-05-19 70 63
98833 2013-08-17 67 63
98847 2013-08-31 65 63
99106 2014-05-17 76 63
99125 2014-06-05 36 63
99148 2014-06-28 79 63
99171 2014-07-21 33 63
99518 2015-07-03 77 63
99597 2015-09-20 81 63
99895 2016-07-14 85 63
99900 2016-07-19 77 63
99902 2016-07-21 80 63
99904 2016-07-23 98 63
100162 2017-04-07 41 63
100256 2017-07-10 38 63
101057 2014-09-19 64 74
101321 2015-06-10 37 74
101414 2015-09-11 72 74
101679 2016-06-02 72 74
101834 2016-11-04 36 74
102053 2017-06-11 90 74
102178 2017-10-14 71 74
102179 2017-10-15 81 74
102199 2017-11-04 79 74
102499 2013-08-31 66 85
103128 2015-05-22 65 85
103224 2015-08-26 29 85
103687 2016-12-01 16 85
103990 2017-09-30 64 85
104263 2013-06-30 60 96
104512 2014-03-06 42 96
104985 2015-06-22 58 96
105064 2015-09-09 39 96
105288 2016-04-20 112 96
105498 2016-11-16 107 96
105650 2017-04-17 52 96
105754 2017-07-30 141 96
105873 2017-11-26 136 96
105878 2017-12-01 50 96
107095 2016-04-01 106 107
107193 2016-07-08 117 107
107236 2016-08-20 116 107
107362 2016-12-24 82 107
107369 2016-12-31 88 107
107478 2017-04-19 90 107
107479 2017-04-20 109 107
107496 2017-05-07 112 107
107520 2017-05-31 48 107
107657 2017-10-15 112 107
108677 2015-08-01 66 8
108950 2016-04-30 100 8
109000 2016-06-19 124 8
109056 2016-08-14 116 8
109078 2016-09-05 44 8
109318 2017-05-03 58 8
109423 2017-08-16 103 8
109679 2013-04-29 57 20
110790 2016-05-14 99 20
110861 2016-07-24 116 20
110961 2016-11-01 75 20
110966 2016-11-06 97 20
110990 2016-11-30 76 20
111164 2017-05-23 84 20
111207 2017-07-05 55 20
111942 2014-07-10 108 31
112281 2015-06-14 136 31
112293 2015-06-26 115 31
112314 2015-07-17 129 31
112350 2015-08-22 124 31
112556 2016-03-15 93 31
112558 2016-03-17 97 31
112573 2016-04-01 121 31
112631 2016-05-29 125 31
112651 2016-06-18 85 31
112982 2017-05-15 50 31
113052 2017-07-24 71 31
113089 2017-08-30 125 31
113281 2013-03-10 41 42
113392 2013-06-29 52 42
113400 2013-07-07 67 42
113707 2014-05-10 104 42
113777 2014-07-19 108 42
113778 2014-07-20 111 42
113923 2014-12-12 34 42
114028 2015-03-27 38 42
114109 2015-06-16 101 42
114129 2015-07-06 53 42
114345 2016-02-07 47 42
114429 2016-05-01 116 42
114538 2016-08-18 58 42
114623 2016-11-11 105 42
114793 2017-04-30 124 42
115007 2017-11-30 89 42
115572 2014-06-18 55 53
115609 2014-07-25 100 53
115842 2015-03-15 48 53
115986 2015-08-06 102 53
116057 2015-10-16 90 53
116294 2016-06-09 56 53
116421 2016-10-14 91 53
116659 2017-06-09 69 53
116698 2017-07-18 112 53
116701 2017-07-21 72 53
116813 2017-11-10 99 53
116814 2017-11-11 102 53
117150 2013-10-13 27 64
117541 2014-11-08 28 64
117561 2014-11-28 68 64
117688 2015-04-04 71 64
117827 2015-08-21 77 64
118144 2016-07-03 89 64
118171 2016-07-30 91 64
118231 2016-09-28 75 64
118292 2016-11-28 24 64
118294 2016-11-30 63 64
118520 2017-07-14 99 64
118521 2017-07-15 85 64
118612 2017-10-14 70 64
118862 2013-06-21 68 75
118940 2013-09-07 68 75
119642 2015-08-10 28 75
119896 2016-04-20 29 75
119995 2016-07-28 90 75
120085 2016-10-26 29 75
120339 2017-07-07 95 75
120360 2017-07-28 50 75
120364 2017-08-01 41 75
120494 2017-12-09 66 75
121088 2014-07-26 78 86
121558 2015-11-08 31 86
121733 2016-05-01 78 86
121824 2016-07-31 85 86
121876 2016-09-21 64 86
122031 2017-02-23 53 86
122225 2017-09-05 31 86
123295 2015-08-11 98 97
123419 2015-12-13 47 97
123551 2016-04-23 62 97
123592 2016-06-03 77 97
123682 2016-09-01 60 97
123915 2017-04-22 119 97
124503 2013-12-01 40 108
124509 2013-12-07 28 108
124598 2014-03-06 79 108
124655 2014-05-02 101 108
124670 2014-05-17 103 108
124674 2014-05-21 81 108
124689 2014-06-05 50 108
124929 2015-01-31 34 108
125056 2015-06-07 109 108
125090 2015-07-11 68 108
125106 2015-07-27 47 108
125131 2015-08-21 96 108
125404 2016-05-20 62 108
125446 2016-07-01 110 108
125476 2016-07-31 118 108
125517 2016-09-10 53 108
125556 2016-10-19 79 108
125567 2016-10-30 101 108
125758 2017-05-09 54 108
125861 2017-08-20 118 108
125902 2017-09-30 97 108
125939 2017-11-06 42 108
125947 2017-11-14 46 108
126105 2013-04-21 49 9
126518 2014-06-08 125 9
126531 2014-06-21 102 9
126789 2015-03-06 87 9
127027 2015-10-30 56 9
127215 2016-05-05 109 9
127219 2016-05-09 51 9
127242 2016-06-01 103 9
127400 2016-11-06 112 9
127625 2017-06-19 63 9
127658 2017-07-22 130 9
127716 2017-09-18 46 9
127745 2017-10-17 92 9
127977 2013-06-06 91 21
128224 2014-02-08 85 21
129134 2016-08-06 114 21
129264 2016-12-14 74 21
129412 2017-05-11 119 21
129471 2017-07-09 138 21
129610 2017-11-25 114 21
129888 2013-08-30 126 32
129972 2013-11-22 62 32
129981 2013-12-01 65 32
130197 2014-07-05 170 32
130277 2014-09-23 128 32
130328 2014-11-13 75 32
130439 2015-03-04 113 32
130568 2015-07-11 122 32
130833 2016-04-01 147 32
130920 2016-06-27 88 32
130954 2016-07-31 182 32
130962 2016-08-08 84 32
131076 2016-11-30 107 32
131226 2017-04-29 162 32
131330 2017-08-11 161 32
132373 2015-06-20 98 43
132388 2015-07-05 150 43
132461 2015-09-16 61 43
132739 2016-06-20 68 43
132758 2016-07-09 168 43
133136 2017-07-22 176 43
133137 2017-07-23 177 43
133144 2017-07-30 179 43
134347 2015-11-15 130 54
134670 2016-10-03 54 54
134725 2016-11-27 155 54
134863 2017-04-14 135 54
135346 2013-08-10 44 65
135619 2014-05-10 100 65
135724 2014-08-23 95 65
135819 2014-11-26 84 65
135873 2015-01-19 45 65
136097 2015-08-31 34 65
136297 2016-03-18 38 65
136369 2016-05-29 112 65
136401 2016-06-30 60 65
136418 2016-07-17 114 65
136530 2016-11-06 121 65
136563 2016-12-09 77 65
136758 2017-06-22 61 65
136771 2017-07-05 58 65
136830 2017-09-02 109 65
136866 2017-10-08 98 65
136919 2017-11-30 92 65
138171 2016-05-05 101 76
138197 2016-05-31 43 76
138606 2017-07-14 113 76
138621 2017-07-29 115 76
138622 2017-07-30 114 76
138733 2017-11-18 103 76
139251 2014-04-20 91 87
139356 2014-08-03 94 87
139388 2014-09-04 80 87
139825 2015-11-15 91 87
140050 2016-06-27 39 87
140056 2016-07-03 106 87
140063 2016-07-10 103 87
140070 2016-07-17 103 87
140435 2017-07-17 46 87
140568 2017-11-27 34 87
140762 2013-06-09 84 98
141216 2014-09-06 138 98
141614 2015-10-09 129 98
141627 2015-10-22 114 98
142176 2017-04-23 167 98
142320 2017-09-14 141 98
142898 2014-04-15 108 109
142915 2014-05-02 68 109
143388 2015-08-18 62 109
143682 2016-06-07 119 109
144223 2017-11-30 113 109
144425 2013-06-20 112 10
144822 2014-07-22 131 10
144827 2014-07-27 153 10
144853 2014-08-22 119 10
145513 2016-06-12 169 10
145533 2016-07-02 149 10
145547 2016-07-16 159 10
145560 2016-07-29 149 10
145660 2016-11-06 153 10
145841 2017-05-06 148 10
145867 2017-06-01 136 10
146023 2017-11-04 141 10
146644 2014-07-18 81 22
146779 2014-11-30 76 22
147056 2015-09-03 65 22
147388 2016-07-31 93 22
147582 2017-02-10 64 22
147705 2017-06-13 76 22
147861 2017-11-16 75 22
148745 2015-04-19 124 33
149191 2016-07-08 121 33
149335 2016-11-29 96 33
149468 2017-04-11 105 33
149701 2017-11-30 99 33
149855 2013-05-03 45 44
149856 2013-05-04 48 44
150033 2013-10-28 18 44
150247 2014-05-30 54 44
150550 2015-03-29 82 44
150556 2015-04-04 45 44
150578 2015-04-26 53 44
150591 2015-05-09 95 44
150755 2015-10-20 72 44
150827 2015-12-31 61 44
150850 2016-01-23 79 44
150913 2016-03-26 92 44
151041 2016-08-01 49 44
151044 2016-08-04 46 44
151113 2016-10-12 86 44
152129 2014-07-25 57 55
152577 2015-10-16 85 55
153250 2017-08-19 100 55
154313 2015-07-18 81 66
154691 2016-07-30 75 66
154692 2016-07-31 76 66
155021 2017-06-25 85 66
155035 2017-07-09 82 66
155272 2013-03-03 25 77
156374 2016-03-09 52 77
156417 2016-04-21 25 77
156517 2016-07-30 82 77
156602 2016-10-23 69 77
156623 2016-11-13 74 77
156759 2017-03-29 59 77
156910 2017-08-27 78 77
157005 2017-11-30 63 77
157111 2013-03-16 52 88
157171 2013-05-15 52 88
157519 2014-04-28 56 88
157583 2014-07-01 24 88
157935 2015-06-18 61 88
158000 2015-08-22 32 88
158677 2017-06-29 68 88
158706 2017-07-28 79 88
158718 2017-08-09 68 88
159400 2014-06-22 110 99
159899 2015-11-03 82 99
159921 2015-11-25 43 99
160173 2016-08-03 47 99
160478 2017-06-04 135 99
160507 2017-07-03 56 99
160511 2017-07-07 127 99
160638 2017-11-11 67 99
161194 2014-05-21 72 110
161207 2014-06-03 76 110
161371 2014-11-14 80 110
161525 2015-04-17 84 110
161563 2015-05-25 72 110
161673 2015-09-12 44 110
161874 2016-03-31 30 110
162037 2016-09-10 89 110
162046 2016-09-19 37 110
162050 2016-09-23 53 110
162277 2017-05-08 36 110
162306 2017-06-06 92 110
162360 2017-07-30 103 110
162381 2017-08-20 107 110
162457 2017-11-04 95 110
162650 2013-05-16 73 11
162678 2013-06-13 74 11
162839 2013-11-21 41 11
162943 2014-03-05 27 11
163010 2014-05-11 52 11
163085 2014-07-25 108 11
163400 2015-06-05 99 11
163517 2015-09-30 73 11
163765 2016-06-04 108 11
163787 2016-06-26 111 11
164087 2017-04-22 94 11
164130 2017-06-04 121 11
164151 2017-06-25 111 11
164158 2017-07-02 76 11
164268 2017-10-20 92 11
164277 2017-10-29 97 11
164280 2017-11-01 90 11
164289 2017-11-10 88 11
164891 2014-07-05 72 13
165008 2014-10-30 88 13
165028 2014-11-19 86 13
165037 2014-11-28 103 13
165263 2015-07-12 121 13
165315 2015-09-02 48 13
165687 2016-09-08 106 13
165957 2017-06-05 53 13
166112 2017-11-07 50 13
166394 2013-08-16 118 24
166708 2014-06-26 143 24
166844 2014-11-09 75 24
166915 2015-01-19 75 24
167007 2015-04-21 120 24
167083 2015-07-06 80 24
167104 2015-07-27 75 24
167177 2015-10-08 120 24
167783 2017-06-05 89 24
167856 2017-08-17 149 24
167864 2017-08-25 166 24
167866 2017-08-27 169 24
167909 2017-10-09 60 24
167961 2017-11-30 123 24
168327 2013-12-01 56 35
168544 2014-07-06 150 35
168561 2014-07-23 74 35
168955 2015-08-21 126 35
169274 2016-07-05 135 35
169563 2017-04-20 69 35
169612 2017-06-08 144 35
169619 2017-06-15 150 35
169635 2017-07-01 159 35
169846 2013-01-28 58 46
170675 2015-05-07 57 46
170739 2015-07-10 75 46
171021 2016-04-17 135 46
171063 2016-05-29 132 46
171104 2016-07-09 140 46
171370 2017-04-01 118 46
171469 2017-07-09 155 46
171470 2017-07-10 65 46
171474 2017-07-14 144 46
171581 2017-10-29 130 46
171607 2017-11-24 70 46
171614 2017-12-01 56 46
172441 2015-03-08 40 57
172548 2015-06-23 91 57
172567 2015-07-12 104 57
172930 2016-07-09 69 57
173277 2017-06-21 45 57
173281 2017-06-25 112 57
173439 2017-11-30 85 57
173650 2013-06-29 40 68
173888 2014-02-22 28 68
173976 2014-05-21 81 68
173998 2014-06-12 80 68
174047 2014-07-31 86 68
174268 2015-03-09 54 68
174412 2015-07-31 100 68
174504 2015-10-31 83 68
174697 2016-05-11 89 68
175093 2017-06-11 68 68
175127 2017-07-15 114 68
175128 2017-07-16 116 68
175265 2017-11-30 89 68
175329 2013-02-02 58 79
175728 2014-03-08 67 79
175846 2014-07-04 91 79
176207 2015-06-30 34 79
176259 2015-08-21 45 79
176530 2016-05-18 37 79
176604 2016-07-31 93 79
176912 2017-06-04 99 79
176982 2017-08-13 93 79
177020 2017-09-20 75 79
177046 2017-10-16 26 79
177063 2017-11-02 48 79
178018 2015-06-15 65 90
178091 2015-08-27 132 90
178329 2016-04-21 71 90
178409 2016-07-10 175 90
178787 2017-07-23 120 90
178794 2017-07-30 171 90
179118 2013-06-19 43 101
179161 2013-08-01 51 101
179591 2014-10-05 113 101
179630 2014-11-13 107 101
179669 2014-12-22 58 101
179827 2015-05-29 57 101
179856 2015-06-27 130 101
179879 2015-07-20 60 101
180189 2016-05-25 111 101
180350 2016-11-02 106 101
180568 2017-06-08 76 101
180586 2017-06-26 76 101
180590 2017-06-30 91 101
180591 2017-07-01 149 101
180632 2017-08-11 135 101
180661 2017-09-09 84 101
180676 2017-09-24 85 101
180924 2013-05-30 52 2
181682 2015-06-27 87 2
181736 2015-08-20 67 2
181935 2016-03-06 127 2
182082 2016-07-31 157 2
182356 2017-05-01 114 2
182364 2017-05-09 126 2
182562 2017-11-23 119 2
183123 2014-06-07 63 14
183425 2015-04-05 58 14
183444 2015-04-24 99 14
183513 2015-07-02 102 14
183535 2015-07-24 114 14
183599 2015-09-26 101 14
183838 2016-05-22 117 14
183880 2016-07-03 122 14
183991 2016-10-22 109 14
184137 2017-03-17 49 14
184371 2017-11-06 45 14
184618 2013-07-11 119 25
184810 2014-01-19 49 25
184947 2014-06-05 131 25
184978 2014-07-06 165 25
185046 2014-09-12 67 25
185216 2015-03-01 121 25
185272 2015-04-26 131 25
185309 2015-06-02 128 25
185321 2015-06-14 148 25
185336 2015-06-29 71 25
185656 2016-05-14 99 25
185720 2016-07-17 168 25
185800 2016-10-05 120 25
185832 2016-11-06 146 25
186063 2017-06-25 167 25
186154 2017-09-24 150 25
186413 2013-06-10 42 36
186916 2014-10-26 64 36
187107 2015-05-05 101 36
187109 2015-05-07 108 36
187160 2015-06-27 91 36
187191 2015-07-28 76 36
187539 2016-07-10 159 36
187548 2016-07-19 87 36
187601 2016-09-10 128 36
187839 2017-05-06 88 36
187892 2017-06-28 75 36
187904 2017-07-10 75 36
187914 2017-07-20 83 36
187917 2017-07-23 170 36
187968 2017-09-12 117 36
188029 2017-11-12 140 36
189293 2016-04-29 68 47
189338 2016-06-13 56 47
189349 2016-06-24 122 47
189739 2017-07-19 72 47
189764 2017-08-13 137 47
189841 2017-10-29 118 47
190180 2013-10-03 65 58
190237 2013-11-29 69 58
190597 2014-11-24 68 58
190742 2015-04-18 44 58
190792 2015-06-07 96 58
190801 2015-06-16 82 58
190975 2015-12-07 50 58
191218 2016-08-06 54 58
191564 2017-07-18 49 58
191658 2017-10-20 43 58
191936 2013-07-25 83 69
192198 2014-04-13 82 69
192673 2015-08-01 54 69
192953 2016-05-07 107 69
193032 2016-07-25 42 69
193071 2016-09-02 43 69
193393 2017-07-21 70 69
193444 2017-09-10 96 69
193474 2017-10-10 32 69
193539 2017-12-14 62 69
193798 2013-08-30 69 80
193800 2013-09-01 34 80
194014 2014-04-03 75 80
194219 2014-10-25 36 80
194684 2016-02-02 56 80
194857 2016-07-24 97 80
194886 2016-08-22 37 80
195171 2017-06-03 100 80
195204 2017-07-06 92 80
195591 2013-07-28 139 91
196081 2014-11-30 127 91
196256 2015-05-24 144 91
196599 2016-05-01 155 91
196632 2016-06-03 91 91
196681 2016-07-22 105 91
196733 2016-09-12 56 91
197040 2017-07-16 171 91
197087 2017-09-01 87 91
197743 2014-06-19 110 102
197774 2014-07-20 131 102
198045 2015-04-17 100 102
198149 2015-07-30 112 102
198263 2015-11-21 122 102
198494 2016-07-09 133 102
198591 2016-10-14 118 102
198607 2016-10-30 122 102
198613 2016-11-05 121 102
198808 2017-05-19 75 102
198823 2017-06-03 138 102
198915 2017-09-03 79 102
198955 2017-10-13 112 102
199214 2013-06-29 122 3
199339 2013-11-01 102 3
199550 2014-05-31 129 3
199690 2014-10-18 110 3
199920 2015-06-05 128 3
199947 2015-07-02 65 3
Plotting anomalies days for the group 2 and 12.
p2 <- tbl_df(df[df$group==2,]) %>%
time_decompose(y,
frequency = "auto",
trend = "1 week") %>%
anomalize(remainder, method = "iqr") %>%
plot_anomaly_decomposition() +
ggtitle("Trend = 1 Week (Local)")
p2
p2 <- tbl_df(df[df$group==12,]) %>%
time_decompose(y,
frequency = "auto",
trend = "1 week") %>%
anomalize(remainder, method = "iqr") %>%
plot_anomaly_decomposition() +
ggtitle("Trend = 1 Week (Local)")
p2
Here we considered 2 model. Looking just at the rmse values, one would say that the difference is not effectiveness of the models. However, the plots clearly show that linear regression shows a flat trend, whereas prophet forecasts closely to the fact values.
A work by YOUR NAME
YOUREMAIL@gmail.com