MAPE plots for each country by using statistical and neural networks models

MAPE plots for each country by using statistical and neural networks models

Makarovskikh Tatyana Anatolyevna “Макаровских Татьяна Анатольевна”

Abotaleb mostafa“Аботалеб Мостафа”

Department of Electrical Engineering and Computer Science

South ural state university, Chelyabinsk, Russian federation

library(fpp2)
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## -- Attaching packages ---------------------------------------------- fpp2 2.4 --
## v ggplot2   3.3.2     v fma       2.4  
## v forecast  8.13      v expsmooth 2.3
## 
library(forecast)
library(ggplot2)
library("readxl")
library(moments)
library(forecast)
require(forecast)  
require(tseries)
## Loading required package: tseries
require(markovchain)
## Loading required package: markovchain
## Package:  markovchain
## Version:  0.8.5-3
## Date:     2020-12-03
## BugReport: https://github.com/spedygiorgio/markovchain/issues
require(data.table)
## Loading required package: data.table
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:base':
## 
##     format.pval, units
library(ascii)
library(pander)
## 
## Attaching package: 'pander'
## The following object is masked from 'package:ascii':
## 
##     Pandoc
MAPE.Value<-c(0.5388,0.4301,0.4178,0.4089,5.6585,0.7259,0.844,0.714,2.726)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.Value)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.Value)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.Value)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

#################################################################
## USA
MAPE.USA<-c(0.972,0.961,0.811,1.102,7.415,1.824,1.67,0.76,0.87)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.USA)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.USA)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.USA)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
##India
MAPE.India<-c(0.073,0.082,0.118,0.049,1.205,0.072,1.88,2.13,8.47)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.India)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.India)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.India)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
##Brazil
MAPE.Brazil<-c(0.412,0.407,0.492,0.262,3.284,0.511,0.48,0.68,0.45)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.Brazil)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.Brazil)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.Brazil)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
##Russia 
MAPE.Russia<-c(0.086,0.089,0.224,0.063,5.191,0.195,0.13,0.51,1.12)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.Russia)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.Russia)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.Russia)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
#United kingdom
MAPE.England<-c(0.454,0.319,0.080,0.272,13.949,0.789,0.30,0.63,0.62)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.England)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.England)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.England)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
##France
MAPE.France<-c(0.737,0.711,0.504,0.550,3.848,0.309,0.25,0.39,3.98)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.France)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.France)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.France)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
##Turkey
MAPE.Turkey<-c(0.953,0.421,0.148,0.364,6.101,1.017,0.87,0.21,3.87)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.Turkey)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.Turkey)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.Turkey)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
##Italy
MAPE.Italy<-c(0.320,0.290,0.158,0.406,5.012,0.255,1.10,0.91,0.62)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.Italy)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.Italy)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.Italy)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
##Spain
MAPE.Spain<-c(0.725,0.310,0.827,0.398,3.772,0.354,0.70,0.26,1.19)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.Spain)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.Spain)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.Spain)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))

########################################################
##Germany
MAPE.Germany<-c(0.656,0.711,0.816,0.623,6.808,1.933,1.06,0.66,6.07)
Model<-c("BATS","TBATS","Holt","ARIMA" ,"SIR","NNAR(1,5)","LSTM","BiLSTM","GRU")
channel_data<-data.frame(Model,MAPE.Germany)
# Normally, the entire expression below would be assigned to an object, but we're
# going bare bones here.
ggplot(channel_data, aes(x = Model, y = MAPE.Germany)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = MAPE.Germany)) +  # x AND y INHERITED. WE JUST NEED TO SPECIFY "label"
  coord_flip() +
  scale_y_continuous(expand = c(0, 0))