-
Notifications
You must be signed in to change notification settings - Fork 1
/
Table_03_ACF_PACF_BRIC_FEWNet.R
124 lines (94 loc) · 3.45 KB
/
Table_03_ACF_PACF_BRIC_FEWNet.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
######################### ACF - PACF Plots: BRIC ####################
set.seed(20240101) # For reproducibility, we are using this seed value
# Load the necessary libraries
library(forecast)
library(ggplot2)
library(gridExtra)
################## Brazil ############################
# Set the working directory
setwd("/FEWNet/dataset/brazil")
getwd()
# Dataset
cpi.df <- read.csv("Brazil_CPI_inf_rate_Monthly_base_mulvar_cpi_epu_gprc_202201.csv",header=TRUE)
str(cpi.df)
# lets remove the last 24 observations (test data) -- Time frame considered: 2003M01 - 2019M11
cpi.train.df<-cpi.df[1:203,1:4]
str(cpi.train.df)
# Create ACF plot
acf_plot <- ggAcf(cpi.train.df$CPI_inflation_rate, lag.max = 36) +
ggtitle("ACF Plot") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Create PACF plot
pacf_plot <- ggPacf(cpi.train.df$CPI_inflation_rate, lag.max = 36) +
ggtitle("PACF Plot") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Arrange both plots side by side
grid.arrange(acf_plot, pacf_plot, ncol = 2)
################## Russia ############################
# Set the working directory
setwd("/FEWNet/dataset/russia")
getwd()
# Dataset
cpi.df <- read.csv("RUS_CPI_inf_rate_Monthly_mulvar_epu_gprc_202201.csv",header=TRUE)
str(cpi.df)
# lets remove the last 24 observations (test data) -- Time frame considered: 2003M01 - 2019M11
cpi.train.df<-cpi.df[1:203,1:4]
str(cpi.train.df)
# Create ACF plot
acf_plot <- ggAcf(cpi.train.df$cpi_inflation_rate, lag.max = 36) +
ggtitle("ACF Plot") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Create PACF plot
pacf_plot <- ggPacf(cpi.train.df$cpi_inflation_rate, lag.max = 36) +
ggtitle("PACF Plot") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Arrange both plots side by side
grid.arrange(acf_plot, pacf_plot, ncol = 2)
################## India ############################
# Set the working directory
setwd("/FEWNet/dataset/india")
getwd()
# Dataset
cpi.df <- read.csv("India_CPI_inf_rate_Monthly_base_mulvar_cpi_epu_gprc_202201.csv",header=TRUE)
str(cpi.df)
# lets remove the last 24 observations (test data) -- Time frame considered: 2003M01 - 2019M11
cpi.train.df<-cpi.df[1:203,1:4]
str(cpi.train.df)
# Create ACF plot
acf_plot <- ggAcf(cpi.train.df$CPI_inflation_Rate, lag.max = 36) +
ggtitle("ACF Plot") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Create PACF plot
pacf_plot <- ggPacf(cpi.train.df$CPI_inflation_Rate, lag.max = 36) +
ggtitle("PACF Plot") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Arrange both plots side by side
grid.arrange(acf_plot, pacf_plot, ncol = 2)
################## China ############################
# Set the working directory
setwd("/FEWNet/dataset/china")
getwd()
# Dataset
cpi.df <- read.csv("China_CPI_inf_rate_Monthly_mulvariate_epu_gprc_202201.csv",header=TRUE)
str(cpi.df)
# lets remove the last 24 observations (test data) -- Time frame considered: 2003M01 - 2019M11
cpi.train.df<-cpi.df[1:203,1:4]
str(cpi.train.df)
# Create ACF plot
acf_plot <- ggAcf(cpi.train.df$cpi_inflation_rate, lag.max = 36) +
ggtitle("ACF Plot") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Create PACF plot
pacf_plot <- ggPacf(cpi.train.df$cpi_inflation_rate, lag.max = 36) +
ggtitle("PACF Plot") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Arrange both plots side by side
grid.arrange(acf_plot, pacf_plot, ncol = 2)