Geopolitische Risiken haben politische, wirtschaftliche, gesellschaftliche Auswirkungen; diese Liste kann noch erweitert werden. Klar ist, dass ein entsprechender Index für viele interessant ist.
Ähnlich wie der hier bereits vorgestellte EPU-Index funktioniert auch der GPR-Index von Dario Caldara und Matteo Iacoviello. Der Index sucht nach Artikeln aus elf englisch-sprachigen Zeitungen mit Wörtern welche geopolitische, nukleare, Kriegs- und terroristische Bedrohungen (a), als auch kriegerische und terroristische Handlungen (b) beschreiben. Die Häufigkeit dieser Artikel wird an der Gesamtzahl an Artikeln referenziert. Heraus kommt ein Index, welcher das weltweite geopolitische Risiko beschreibt; von Caldara und Iacoviello definiert als "risk associated with wars, terrorist acts, and tensions between states that affect the normal and peaceful course of international relations."
Diesen Index haben sie noch einmal unterteilt in Bedrohungen (a) und eigentliche Handlungen (b). De Grafik zeigt, dass der Threat-Index dem Act-Index vorläuft als auch viel häufiger ausschlägt. Interessanterweise scheint es in den letzten Jahren eine Zunahme an Drohungen zu geben
Auch aus der Sicht des Codens ist dieser Blogpost, bzw die Grafiken interessant. Im Code unten wird sichtbar, wie ich in Plot 1 und Plot 2 mit verschiedenen Bausteinen ein ähnliches Ergebnis für die Labels realisierte.
library(rio)
library(ggplot2)
library(fpp2)
library(dplyr)
library(zoo)
library(openxlsx)
library(reshape)
library(dplyr)
library(readr)
library(Hmisc)
library(directlabels)
library(viridis)
library(ggrepel)
library(lubridate)
# Plot 1 - GPR Index
data_GPR <- import("https://www.matteoiacoviello.com/gpr_files/gpr_web_latest.xlsx", sheet = 2) %>%
mutate(Date = as.Date(as.numeric(Date),origin="1900-01-01")) %>%
melt(., id.vars=c("Date")) %>%
as.data.frame()
data_GPR %>%
filter(variable == c("GPR","GPR_THREAT", "GPR_ACT")) %>%
mutate(category = ifelse(variable %in% c("GPR_THREAT", "GPR_ACT"), 'detailed', 'absolute')) %>%
ggplot(aes(x=Date, y=value, fill=variable, color=variable)) +
geom_area(alpha = 0.4) +
#geom_smooth(size = 0.5, span=0.1, se=FALSE)
theme_minimal() +
theme(legend.position="none", panel.grid.major = element_blank(), strip.background = element_blank(), strip.text = element_blank()) +
scale_x_date(expand = c(0,0,0.2, 0)) +
facet_wrap(category~., nrow=2) +
scale_fill_viridis(discrete=TRUE, option="viridis") +
scale_color_viridis(discrete=TRUE, option="viridis") +
geom_dl(aes(label = variable), method = list(dl.combine("last.points"), cex= 0.8)) +
labs(
x = NULL, y = NULL,
title = paste("The Geopolitical Risk Index"),
subtitle = ("drilldown to sub-Indizes"),
caption = "Plot1")
# Plot 2 - Länderindizes
data_GPR_countries = import("https://www.matteoiacoviello.com/gpr_files/gpr_web_latest.xlsx", sheet = 3) %>%
mutate(Date = as.Date(Date)) %>%
melt(., id.vars=c("Date")) %>%
`colnames<-`(c("Date", "country", "value")) %>%
mutate(continent = ifelse(country %in% c("GPR_TURKEY", "GPR_RUSSIA", "GPR_UKRAINE"), 'Europe',
ifelse(country %in% c("GPR_MEXICO", "GPR_BRAZIL", "GPR_ARGENTINA", "GPR_COLOMBIA", "GPR_VENEZUELA"), 'Americas',
ifelse(country %in% c("GPR_SAUDI_ARABIA", "GPR_SOUTH_AFRICA", "GPR_ISRAEL"), 'MEA',
ifelse(country %in% c("GPR_KOREA", "GPR_INDIA", "GPR_CHINA", "GPR_INDONESIA", "GPR_THAILAND",
"GPR_MALAYSIA", "GPR_PHILIPPINES", "GPR_HONG_KONG"), 'Asia', 'global')))))
data_GPR_countries %>%
ggplot(aes(x=Date, y=value, color=country)) +
geom_smooth(size = 0.5, span=0.1, se=FALSE) +
theme_minimal()+
theme(legend.position="none", panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
strip.text = element_text(face="bold", size=9)) +
scale_x_date(expand = c(0,0,0.3, 0)) +
geom_hline(yintercept = 0, color = "grey", size =0.2) +
facet_wrap(~continent) +
scale_color_viridis(discrete=TRUE) +
geom_text_repel(data = subset(data_GPR_countries, Date == max(Date)),
mapping = aes(x = Date, y = value, label = country), size = 2, segment.color = NA,
nudge_x = 0.5, direction = "y", hjust = 0) +
labs(
x = NULL, y = NULL,
title = paste("The Geopolitical Risk Index"),
subtitle = ("Emerging Countries"),
caption = "Plot2")
# Plot 3 - Boxplots
data_GPR_countries %>%
ggplot(aes(x=factor(country, level=c("GPR_TURKEY", "GPR_RUSSIA", "GPR_UKRAINE", "GPR_MEXICO", "GPR_BRAZIL",
"GPR_ARGENTINA", "GPR_COLOMBIA", "GPR_VENEZUELA", "GPR_SAUDI_ARABIA",
"GPR_SOUTH_AFRICA", "GPR_ISRAEL", "GPR_KOREA", "GPR_INDIA", "GPR_CHINA",
"GPR_INDONESIA", "GPR_THAILAND", "GPR_MALAYSIA", "GPR_PHILIPPINES", "GPR_HONG_KONG"
)), y=value, color=continent, fill=continent)) +
geom_boxplot() +
theme_minimal()+
theme(legend.position="none", panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
strip.text = element_text(face="bold", size=9), axis.text.x = element_text(angle=90, hjust=1)) +
#scale_x_date(expand = c(0,0,0.3, 0)) +
#geom_hline(yintercept = 0, color = "grey", size =0.2) +
#facet_wrap(~continent) +
scale_color_viridis(discrete=TRUE) +
scale_fill_viridis(discrete=TRUE) +
#geom_text_repel(data = subset(data_GPR_countries, Date == max(Date)),
# mapping = aes(x = Date, y = value, label = country), size = 2, segment.color = NA,
# nudge_x = 0.5, direction = "y", hjust = 0
#) +
labs(
x = NULL, y = NULL,
title = paste("The Geopolitical Risk Index"),
subtitle = ("Emerging Countries - Boxplots"),
caption = "Plot3")
# Plot 4 - Monate
data_GPR_countries_change <- data_GPR_countries %>%
mutate(month = format(Date,"%m")) %>%
group_by(country) %>%
mutate(value_lag1 = lag(value, n=1L)) %>%
ungroup() %>%
mutate(change = (value - value_lag1) / value_lag1) %>%
group_by(country, continent, month) %>%
summarise(change = mean(change))
data_GPR_countries_change %>%
ggplot(aes(x=month, y=change, group=country, color=country)) +
geom_line() +
geom_point() +
theme_minimal() +
theme(legend.position="none", panel.grid.major = element_blank()) +
scale_y_continuous(labels = scales::percent) +
scale_x_discrete(expand = c(0,0,0.3, 0)) +
facet_wrap(~continent) +
scale_color_viridis(discrete=TRUE, direction=-1) +
geom_hline(yintercept = 0, color = "grey", size =0.4) +
geom_text_repel(data = subset(data_GPR_countries_change, month == 12),
mapping = aes(x = month, y = change, label = country), size = 2, segment.color = NA,
nudge_x = 0.5, direction = "y", hjust = 0
) +
labs(
x = NULL, y=NULL,
title = paste("The Geopolitical Risk Index"),
subtitle = ("durchschnittliche Veränderung zum Vormonat"),
caption = "Plot 4")
Photo by Tima Miroshnichenko from Pexels