Desigualdad

La desigualdad consiste en la falta de equilibrio o equidad entre las parte que componen la sociedad, la desiguladad se puede analizar desde diferentes puntos de vista, para el analisis actual, se va a empezar analizando los 15 paises más desiguales del planeta, y responder si el contienente al que pertenece el pais puede estar relacionado al nivel de desigualdad. El data set utilizado, está disponible en el siguiente link: http://hdr.undp.org/en/indicators/135006#

Coefficient_of_human_inequality = read.csv2("D:/Maestria/Primer Semestre/Visualizacion/Desigualdad/Coefficient_of_human_inequality.csv")

Coefficient_of_human_inequality = transform(Coefficient_of_human_inequality, Continent=factor(Continent,levels=1:7,labels=c("Africa","Antartida","Asia","Europa","Norte America","Oceania","Sur America")))

str(Coefficient_of_human_inequality)
## 'data.frame':    1444 obs. of  9 variables:
##  $ X             : int  40282 40284 40285 40286 40287 40288 40289 40290 40291 40293 ...
##  $ dimension     : chr  "Inequality" "Inequality" "Inequality" "Inequality" ...
##  $ indicator_id  : int  135006 135006 135006 135006 135006 135006 135006 135006 135006 135006 ...
##  $ indicator_name: chr  "Coefficient of human inequality" "Coefficient of human inequality" "Coefficient of human inequality" "Coefficient of human inequality" ...
##  $ iso3          : chr  "ALB" "AGO" "ARG" "ARM" ...
##  $ country_name  : chr  "Albania" "Angola" "Argentina" "Armenia" ...
##  $ Continent     : Factor w/ 7 levels "Africa","Antartida",..: 4 1 7 3 6 4 3 5 3 4 ...
##  $ year          : chr  "X2010" "X2010" "X2010" "X2010" ...
##  $ value         : num  12.7 38.8 19 10.9 7.7 7.3 13.4 14 28.3 9.3 ...
mundialRanking <- Coefficient_of_human_inequality %>%
  group_by(year) %>%
  arrange(year, desc(value)) %>%
  mutate(ranking = row_number()) %>%
  filter(ranking <=15)


animacion <- mundialRanking %>%
  ggplot() +
  geom_col(aes(ranking, value, fill = Continent)) +
  geom_text(aes(ranking, value, label = value), hjust=-0.1) +
  geom_text(aes(ranking, y=0 , label = country_name), hjust=1.1) + 
  geom_text(aes(x=15, y=max(value) , label = as.factor(year)), vjust = 0.2, alpha = 0.5,  col = "gray", size = 20) +
  coord_flip(clip = "off", expand = FALSE) + scale_x_reverse() +
  theme_minimal() + theme(
    panel.grid = element_blank(), 
    legend.position = "none",
    axis.ticks.y = element_blank(),
    axis.title.y = element_blank(),
    axis.text.y = element_blank(),
    plot.margin = margin(1, 4, 1, 3, "cm")
  ) +
  transition_states(year, state_length = 0, transition_length = 2) +
  enter_fade() +
  exit_fade() + 
  ease_aes('quadratic-in-out') + 
  theme(legend.position="right")
# 
# animate(animacion, width = 700, height = 432, fps = 25, duration = 15, rewind = FALSE)
# anim_save("mundialRanking.gif")

Al revisar esta primera gráfica, se evidencia que los únicos continentes que se ven, son: Norte America, Sur America y Africa, pero africa tiene una gran presencia, esto puede ser diferentes factores internos del continente.

Para revisar otros continentes, se elimina temporalmente africa de la gráfica:

mundialRankingWithoutAfrica <- Coefficient_of_human_inequality %>%
  filter(Continent != "Africa") %>%
  group_by(year) %>%
  arrange(year, desc(value)) %>%
  mutate(ranking = row_number()) %>%
  filter(ranking <=15)


animacion <- mundialRankingWithoutAfrica %>%
  ggplot() +
  geom_col(aes(ranking, value, fill = Continent)) +
  geom_text(aes(ranking, value, label = value), hjust=-0.1) +
  geom_text(aes(ranking, y=0 , label = country_name), hjust=1.1) + 
  geom_text(aes(x=15, y=max(value) , label = as.factor(year)), vjust = 0.2, alpha = 0.5,  col = "gray", size = 20) +
  coord_flip(clip = "off", expand = FALSE) + scale_x_reverse() +
  theme_minimal() + theme(
    panel.grid = element_blank(), 
    legend.position = "none",
    axis.ticks.y = element_blank(),
    axis.title.y = element_blank(),
    axis.text.y = element_blank(),
    plot.margin = margin(1, 4, 1, 3, "cm")
  ) +
  transition_states(year, state_length = 0, transition_length = 2) +
  enter_fade() +
  exit_fade() + 
  ease_aes('quadratic-in-out') + 
  theme(legend.position="right")

# animate(animacion, width = 700, height = 432, fps = 25, duration = 15, rewind = FALSE)
# anim_save("mundialRankingWithoutAfrica.gif")

Al revisar esta gráfica, se puede evidenciar que a través del tiempo la mayoria de los paises son paises asiaticos, por lo que se podría decir que este es el segundo continente con mayor desigualdad del planeta.

Para continuar con nuestro analisis, se elimina así del data set.

mundialRankingWithoutAsia <- Coefficient_of_human_inequality %>%
  filter(Continent != "Asia") %>%
  filter(Continent != "Africa") %>%
  group_by(year) %>%
  arrange(year, desc(value)) %>%
  mutate(ranking = row_number()) %>%
  filter(ranking <=15)


animacion <- mundialRankingWithoutAsia %>%
  ggplot() +
  geom_col(aes(ranking, value, fill = Continent)) +
  geom_text(aes(ranking, value, label = value), hjust=-0.1) +
  geom_text(aes(ranking, y=0 , label = country_name), hjust=1.1) + 
  geom_text(aes(x=15, y=max(value) , label = as.factor(year)), vjust = 0.2, alpha = 0.5,  col = "gray", size = 20) +
  coord_flip(clip = "off", expand = FALSE) + scale_x_reverse() +
  theme_minimal() + theme(
    panel.grid = element_blank(), 
    legend.position = "none",
    axis.ticks.y = element_blank(),
    axis.title.y = element_blank(),
    axis.text.y = element_blank(),
    plot.margin = margin(1, 4, 1, 3, "cm")
  ) +
  transition_states(year, state_length = 0, transition_length = 2) +
  enter_fade() +
  exit_fade() + 
  ease_aes('quadratic-in-out') + 
  theme(legend.position="right")

# animate(animacion, width = 700, height = 432, fps = 25, duration = 15, rewind = FALSE)
# anim_save("mundialRankingWithoutAsia.gif")

En esta grafica se puede ver que gran parte del tiempo estuvo contenida por los contienetes de norte america y sur america.

mundialRankingWithoutAmerica <- Coefficient_of_human_inequality %>%
  filter(Continent != "Asia") %>%
  filter(Continent != "Africa") %>%
  filter(Continent != "Norte America") %>%
  filter(Continent != "Sur America") %>%
  group_by(year) %>%
  arrange(year, desc(value)) %>%
  mutate(ranking = row_number()) %>%
  filter(ranking <=15)


animacion <- mundialRankingWithoutAmerica %>%
  ggplot() +
  geom_col(aes(ranking, value, fill = Continent)) +
  geom_text(aes(ranking, value, label = value), hjust=-0.1) +
  geom_text(aes(ranking, y=0 , label = country_name), hjust=1.1) + 
  geom_text(aes(x=15, y=max(value) , label = as.factor(year)), vjust = 0.2, alpha = 0.5,  col = "gray", size = 20) +
  coord_flip(clip = "off", expand = FALSE) + scale_x_reverse() +
  theme_minimal() + theme(
    panel.grid = element_blank(), 
    legend.position = "none",
    axis.ticks.y = element_blank(),
    axis.title.y = element_blank(),
    axis.text.y = element_blank(),
    plot.margin = margin(1, 4, 1, 3, "cm")
  ) +
  transition_states(year, state_length = 0, transition_length = 2) +
  enter_fade() +
  exit_fade() + 
  ease_aes('quadratic-in-out') + 
  theme(legend.position="right")

# animate(animacion, width = 700, height = 432, fps = 25, duration = 15, rewind = FALSE)
# anim_save("mundialRankingWithoutAmerica.gif")

Al revisar esta ultima gráfica donde solo se encuentra Europa y ocenía, gran parte del tiempo se encuentra con paises de Europa.

Para terminar la revisión de los continentes, se realiza un boxplot por continente.

overallDist <- ggplot(Coefficient_of_human_inequality, aes(x=as.factor(Continent), y=value, group = Continent , color=Continent))
overallDist <- overallDist + geom_point(aes(color=as.factor(Continent)), position=position_jitter(width=0.2,height=.2))
overallDist <- overallDist + geom_boxplot(aes(alpha=0.2))
overallDist <- overallDist + labs(title = "Distribución Global de desiguldad Global", x = "Porcentaje de IHDI")
overallDist <- overallDist + theme(legend.position = "none")
overallDist

En la Gráfica anterior se puede evidenciar que África Sí es el continente con más desigualdad, aunque a diferencia de Asia que fue el segundo continente con mayor desigualdad, en el boxplot se encuentra más abajo que america y norte america, también se puede encontrar que América del Norte y América del Sur son continente muy parecidos en valores estadisticos, y por último se encuentra Europa, que es el continente con la menor desigualdad en el mundo.

Una Vista interna a América del Sur

dataLatam =  subset (Coefficient_of_human_inequality, Coefficient_of_human_inequality$Continent == "Sur America")
latam = ggplot( dataLatam , aes( x=year , y=value , group=country_name , color=country_name  ))
latam = latam + geom_line()
latam = latam + ggtitle("Desigualdad en LATAM")
latam = latam + ylab("Valor de Inequidad")
latam

heatmapLatam <- ggplot(dataLatam, aes(x=country_name, y=year, fill=value))
heatmapLatam <- heatmapLatam + geom_tile()
heatmapLatam <- heatmapLatam + scale_fill_viridis_c(limits = c(0,50))
heatmapLatam <- heatmapLatam + theme(axis.text.x = element_text(angle = 90))
heatmapLatam <- heatmapLatam + labs(title = "Desigualdad en LATAM", x = "Country", y="Year")
heatmapLatam

# 
# 
dataLatamRanking <- dataLatam %>%
  group_by(year) %>%
  arrange(year, desc(value)) %>%
  mutate(ranking = row_number())

animacion <- dataLatamRanking %>%
  ggplot() +
  geom_col(aes(ranking, value, fill = country_name)) +
  geom_text(aes(ranking, value, label = value), hjust=-0.1) +
  geom_text(aes(ranking, y=0 , label = country_name), hjust=1.1) +
  geom_text(aes(x=15, y=max(value) , label = as.factor(year)), vjust = 0.2, alpha = 0.5,  col = "gray", size = 20) +
  coord_flip(clip = "off", expand = FALSE) + scale_x_reverse() +
  theme_minimal() + theme(
    panel.grid = element_blank(),
    legend.position = "none",
    axis.ticks.y = element_blank(),
    axis.title.y = element_blank(),
    axis.text.y = element_blank(),
    plot.margin = margin(1, 4, 1, 3, "cm")
  ) +
  transition_states(year, state_length = 0, transition_length = 2) +
  enter_fade() +
  exit_fade() +
  ease_aes('quadratic-in-out')
# 
# animate(animacion, width = 700, height = 432, fps = 25, duration = 15, rewind = FALSE)
# anim_save("dataLatamRanking.gif")

Conclusiones

  • Es importante mencionar, que aunque al revisar los valores medios de cada continente, Asia está más bajo que América del Norte y Sur, pero lo que se quiere analizar son los paises con mayor desigualdad y dependencia con el continente. teniendo en cuenta esto, se puede decir que los continentes con mayor paises con desigualdad son, África, Asia, Norte y Sur América , Oceania y Europa.

  • Al revisar Solamente los paises de América del Sur, se encuentra que Bolivia lidera con el mayor indice de desigualdad, y en generals e puede evidenciar una tendencia de disminución en el indice año tras año.