APLA_Replication_Code.Rmd
# Upload Packages for Data analysis and Map
library("dplyr")
library("ggplot2")
theme_set(theme_bw())
library("sf")
library("tmap")
library("rnaturalearth")
library("rnaturalearthdata")
library("tidyr")
library("stringr") # To do text analysis
library(rgeos)
# For color
library("RColorBrewer")
library("viridis")
library("ggrepel") # might be useful later
# Plot all titles in ggplot2 centered
theme_update(plot.title = element_text(hjust = 0.5))
library(devtools)
library(usethis)
install_github("hammoudg/apla_dataset")
## * checking for file ‘/private/var/folders/0w/7nzrslj956n2b6nwy8j7nq3c0000gn/T/RtmpoWzdyv/remotes14c2850f9554c/HammoudG-APLA_Dataset-9c88226/DESCRIPTION’ ... OK
## * preparing ‘APLA’:
## * checking DESCRIPTION meta-information ... OK
## * checking for LF line-endings in source and make files and shell scripts
## * checking for empty or unneeded directories
## * building ‘APLA_0.1.0.tar.gz’
## Warning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L, :
## storing paths of more than 100 bytes is not portable:
## ‘APLA/pdf/Online Appendix - Humanitarian IMPALA and Asylum Policies in Latin America (APLA) Database Coding Frame.pdf’
## Warning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L, :
## using GNU extension for long pathname
library(APLA)
# Upload APLA Database
APLA<- APLA::APLA_Database
library(dplyr)
# Upload Data for Refugee Numbers only
APLA_Data_1<- APLA::Data_Refugees_UNHCR # Data APLA
# Upload Data to Map All Countries Latin America
APLA_Map<- APLA::APLA_Map # Data APLA for Mapping
#APLA<- read.csv("APLA_Database.csv")
#summary(APLA)
# Transform as Tibble
APLA_T <- as_tibble(APLA)
#APLA_T
# Filter out columns on international agreements
APLA_T1<- APLA_T %>% select(1,2, 35:262)
# Only Questions of Liberalisation and Comments included
APLA_T2<- APLA_T1 %>% select(1,2, ends_with(c("2_1","3_1_1")))
# Select only commentary section to calculate number "Art" to calculate Regulatory Complexity
APLA_T3<- APLA_T2 %>%
select(1,2, ends_with("3_1_1"))
# Delete of first row
APLA_T3= APLA_T3[-1,]
# Pivot Table for data manipulation
APLA_T_L <- pivot_longer(APLA_T3, cols = colnames(APLA_T3)[3:length(colnames(APLA_T3))],
names_to = "Question", values_to = "Comment")
# Transform variable from factor to string
APLA_T_L$Comment<- as.character(APLA_T_L$Comment)
# Value 1 if "Art" present "0" otherwise
APLA_T_L1<- APLA_T_L %>%
mutate(Included= ifelse(grepl("Art", APLA_T_L$Comment), 1,0))
# Aggregate values of Included per Country, Year, and Question
APLA_T_L2<- APLA_T_L1 %>%
group_by(Q1,Q2) %>%
summarise(Frequency= sum(Included))
# Calculate Percentage by looking at number of "Included" per Country/Year as a % of total number of indicators = 57
APLA_T_L3<- APLA_T_L2 %>%
mutate(Total=57) %>%
mutate(Regulatory_Complexity= Frequency/Total*100)
# Round Regulatory Complexity
APLA_T_L3$Regulatory_Complexity<- round(APLA_T_L3$Regulatory_Complexity)
# Rename Country and Year, and Year transformed in numeric
colnames(APLA_T_L3)[1] <- "Country"
colnames(APLA_T_L3)[2] <- "Year"
APLA_T_L3$Year<- as.numeric(as.character(APLA_T_L3$Year))
# Run Regulatory Complexity Code First
# Only Questions of Liberalisation and Comments included
APLA_T4<- APLA_T1 %>% select(1,2, ends_with(c("2_1")))
# Delete of first row
APLA_T4= APLA_T4[-1,]
# Pivot Table for data manipulation
APLA_T_L4 <- pivot_longer(APLA_T4, cols = colnames(APLA_T4)[3:length(colnames(APLA_T4))],
names_to = "Question", values_to = "Liberalisation_Score")
# Mutate Liberalisation Score into numeric
APLA_T_L4$Liberalisation_Score<- as.numeric(as.character(APLA_T_L4$Liberalisation_Score, na.rm= TRUE))
APLA_T_L4$Question<- as.factor(APLA_T_L4$Question)
APLA_T_L4[complete.cases(APLA_T_L4),]
# Aggregate values of Included per Country, Year, and Question
APLA_T_L5<- APLA_T_L4 %>%
na.omit() %>%
group_by(Q1,Q2) %>%
summarise(Liberal_Policies= sum(Liberalisation_Score == 0), Restrictive_Policies= sum(Liberalisation_Score == 1)) %>%
mutate(Sum_Both = Liberal_Policies + Restrictive_Policies) %>%
mutate(Liberalisation= Liberal_Policies/ Sum_Both)
# Round Liberalisation
APLA_T_L5$Liberalisation<- round(APLA_T_L5$Liberalisation, digits = 2)
# Take only values where Total_Both => 9
APLA_T_L6<- APLA_T_L5[APLA_T_L5$Sum_Both >= 9, ]
# Rename Country and Year, and Year transformed in numeric
colnames(APLA_T_L6)[1] <- "Country"
colnames(APLA_T_L6)[2] <- "Year"
APLA_T_L6$Year<- as.numeric(as.character(APLA_T_L6$Year))
# Check and change class variable refugees
#class(APLA_Data_1$RefugeeAndLikeSit)
APLA_Data_1$RefugeeAndLikeSit<- as.numeric(APLA_Data_1$RefugeeAndLikeSit)
# Calculate maximum number of Refugees in each country (not used)
APLA_Data_1 %>%
group_by(Country) %>% summarize(m = max(RefugeeAndLikeSit))
## # A tibble: 20 × 2
## Country m
## <chr> <dbl>
## 1 Argentina 11901
## 2 Bolivia 787
## 3 Brazil 20783
## 4 Chile 2001
## 5 Colombia 478
## 6 Costa Rica 276210
## 7 Cuba NA
## 8 Dominican Republic NA
## 9 Ecuador 264907
## 10 El Salvador 20300
## 11 Guatemala 233236
## 12 Honduras 237100
## 13 Mexico 360991
## 14 Nicaragua 16000
## 15 Panama 17665
## 16 Paraguay 250
## 17 Peru 2466
## 18 Rest of Region 62269
## 19 Uruguay 349
## 20 Venezuela 204340
# Create new variable All Other Countries
APLA_Data_Filtered_1<- APLA_Data_1 %>%
filter(Country %in% c("Costa Rica","Ecuador","Guatemala","Honduras","Mexico","Venezuela","Rest of Region"))
# PLOT REFUGEE NUMBERS IN LATIN AMERICA
PLOT<- ggplot(APLA_Data_Filtered_1, aes(Year, RefugeeAndLikeSit, col= Country)) +
geom_line()+
facet_wrap(~ Country, scales = "free_y")+
labs(title = "Figure 2: Refugees in Latin America", x = "",
caption = "Source: UNHCR", y = "Refugee Numbers")+
theme(plot.title = element_text("serif", size = "14", hjust = 0.5))+
theme_bw()
# PLOT WITH ADJUSTED LABELS
require(scales)
PLOT + scale_y_continuous(labels = comma) +
scale_x_continuous(breaks = c(1990, 2000, 2010, 2018))+
theme(legend.position = "none")
#ggsave("Figure_2.jpg", width = 6, height = 4)
ggplot(APLA_T_L3, aes(Year, Regulatory_Complexity)) +
geom_jitter(height=0.8, width = 0.7, aes(color="Country-Year"), alpha=0.5, size=2)+
scale_colour_manual(name='', values = c("Locally Weighted Regression"= "red","Country-Year"="grey", "Linear Regression Line"= "blue"))+
geom_smooth(linetype="dashed", aes(color="Locally Weighted Regression"), se=FALSE)+
geom_smooth(method = 'lm', formula = y~x, aes(color="Linear Regression Line"), se=FALSE)+
scale_shape(solid=FALSE)+
scale_x_continuous(breaks = c(1990, 1995, 2000, 2005, 2010, 2015, 2020))+
theme_bw()+
labs(title = "Figure 3: Regulatory Complexity of Asylum Policies in Latin America", caption = "Source: APLA", x = "") +
ylab("Regulatory Complexity")+
theme(plot.title = element_text("serif", size = "10", hjust = 0.5))+
theme(legend.title = element_blank())+
theme(legend.key = element_rect(fill = "white")) + guides(color=guide_legend(override.aes=list(fill=NA))) #+
#scale_color_brewer(palette="Dark2")
#ggsave("Figure_3.jpg", width = 6, height = 4)
ggplot(APLA_T_L6, aes(Year, Liberalisation)) +
geom_jitter(height=0.3, width = 0.7, aes(color="Country-Year"), alpha=0.5, size=2)+
scale_colour_manual(name='', values = c("Locally Weighted Regression"= "red","Country-Year"="grey", "Linear Regression Line"= "blue"))+
geom_smooth(linetype="dashed", aes(color="Locally Weighted Regression"), se=FALSE)+
geom_smooth(method = 'lm', formula = y~x, aes(color="Linear Regression Line"), se=FALSE)+
scale_shape(solid=FALSE)+
scale_x_continuous(breaks = c(1990, 1995, 2000, 2005, 2010, 2015, 2020))+
theme_bw()+
labs(title = "Figure 4: Liberalization of Asylum Policies in Latin America", caption = "Source: APLA", x = "")+
ylab("Liberalization Score")+
theme(plot.title = element_text("serif", size = "12", hjust = 0.5))+
theme(legend.title = element_blank())+
theme(legend.key = element_rect(fill = "white")) + guides(color=guide_legend(override.aes=list(fill=NA))) #+
#scale_color_brewer(palette="Dark2")
#ggsave("Figure_4.jpg", width = 6, height = 4)
ggplot(APLA_T_L3, aes(Year, Regulatory_Complexity, col= Country)) +
geom_line()+
facet_wrap(.~ Country, ncol= 5)+
theme(legend.position = "none")+ # to remove legend
labs(title = "Figure 5: Regulatory Complexity in Asylum Policies across Latin America, 1990-2020", x = "",
caption = "Source: APLA", y = "Regulatory Complexity")+
theme(plot.title = element_text("serif", size = "14", hjust = 0.5))
#ggsave("Figure_5.jpg", width = 12)
library(data.table)
APLA_T_L3<- APLA_T_L3 %>% mutate(South_America = if_else(Country %in% c("Argentina", "Bolivia", "Brazil", "Chile", "Colombia","Ecuador", "Paraguay", "Peru", "Uruguay", "Venezuela"), "1", "0"))
######
ggplot(APLA_T_L3, aes(Year, Regulatory_Complexity, shape=factor(South_America, labels=c("Rest of Latin America", "South America")), color=factor(South_America, labels=c("Rest of Latin America", "South America")))) +
geom_jitter(height=0.8, width = 0.7)+
geom_smooth(se=FALSE, aes(color=factor(South_America, labels=c("Rest of Latin America", "South America"))))+
scale_x_continuous(breaks = c(1990, 1995, 2000, 2005, 2010, 2015, 2020))+
scale_color_brewer(palette="Dark2")+
labs(title = "Figure 6: Regulatory Complexity, Latin America by Subregion", x = "", y= "Regulatory Complexity",
caption = "Source: APLA")+
theme(plot.title = element_text("serif", size = "12", hjust = 0.5))+
labs(color="Subregion", shape="Subregion")
Source: APLA Database.
#ggsave("Figure_6.jpg", width = 6, height = 4)
ggplot(APLA_T_L6, aes(Year, Liberalisation, col= Country)) +
geom_line()+
facet_wrap(.~ Country, ncol= 5)+
theme(legend.position = "none")+ # to remove legend
labs(title = "Figure 9: Liberalization in Asylum Policies across Latin America, 1990-2020", x = "",
caption = "Source: APLA", y = "Liberalization Score")+
theme(plot.title = element_text("serif", size = "14", hjust = 0.5))
#ggsave("Figure_9.jpg", width = 12)
world <- ne_countries(scale = "medium", returnclass = "sf") # Map of World
#class(world)
APLA_Sel<- APLA_Map %>% # Create Database with Selected Years for Plotting
filter(Year %in% c("1990", "2000", "2010", "2020"))
# Rename column where names is "name", so that I can merge with my other dataset
colnames(world)[4] <- "Country"
# VERY IMPORTANT TO MERGE MAP AND DATA
Map_APLA_Data<- merge(APLA_Sel, world, by="Country")
# to transform MAP_APLA from data frame into sf and data.frame
st_geometry(Map_APLA_Data) <- Map_APLA_Data$geometry
# Display all countries codified so far + Compass + Scale Bar + labels changed!+ Title. USE THIS
MAP<- tm_shape(Map_APLA_Data) + tm_borders("black", lwd= .5) +
tm_layout(title="Figure 1: Countries Codified \nwith APLA,1990-2020", title.size = 1, title.position =c(0.5, "top")) +
tm_polygons("Codified", title="Codified APLA Countries", palette= "Blues", style="fixed", breaks=c(0, 0.1, 1),
labels=c("Not Codified","Codified Countries")) + tm_compass(position = c(0.3, 0.35)) +
tm_scale_bar(width = 0.22, position = c(0.65, 0.08)) + tm_text("Country", size = "AREA") + tm_credits("Source: APLA", position = c( "left", 0.15))
MAP
Source: APLA Database
#tmap_save(MAP, filename = "Figure_1.jpg")
world <- ne_countries(scale = "medium", returnclass = "sf")
#class(world)
# Rename column where names is "name", so that I can merge with my other dataset
colnames(APLA)[1] <- "Name"
colnames(APLA)[2] <- "Year"
colnames(world)[4] <- "Name"
# Create Database with Selected Years for Plotting
Filtered_APLA<- APLA %>%
filter(Year %in% c("1990", "2000", "2010", "2020"))
# To Remove level from dropped rows!!
Filtered_APLA<- droplevels(Filtered_APLA, drop=TRUE)
# VERY IMPORTANT TO MERGE MAP AND DATA
Policy_Maps<- merge(Filtered_APLA, world, by="Name")
# to transform IMPALA from data frame into sf and data.frame
st_geometry(Policy_Maps) <- Policy_Maps$geometry
# to add colour to map
library(RColorBrewer)
#display.brewer.all()
# Cartagena Refugee Definition LA7
Enhanced_Map<- tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA7.1_1", title="Figure 8: Cartagena Refugee Definition \nSource: APLA", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 1.0), labels=c("No or Underdeveloped Legislation","Not Incorporated","Cartagena Incorporated")) + tm_facets(by = "Year")
Enhanced_Map
#tmap_save(Enhanced_Map, filename = "Figure_8.jpg")
# Asylum into Constitution LA3
Constitution_Map<- tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA3.1_1", title="Figure 7: \nAsylum into Constitution\nSource: APLA", palette= "Blues", style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("Not Included","Included into Constitution")) + tm_facets(by = "Year")
Constitution_Map
#tmap_save(Constitution_Map, filename = "Figure_7.jpg")
# First Country of Asylum Q101
First_Country_Map<- tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q101.1_1", title="Figure 10: \nFirst Country of Asylum \nPrinciple \nSource: APLA", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included into Legislation")) + tm_facets(by = "Year")
First_Country_Map
#tmap_save(First_Country_Map, filename = "Figure_10.jpg")
# Free Legal Assistance to Asylum Seeker LA47
Legal_Map<- tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA47.1_1", title="Figure 11: \nFree Legal Assistance \nSource: APLA", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Not guaranteed","Guaranteed")) + tm_facets(by = "Year")
Legal_Map
#tmap_save(Legal_Map, filename = "Figure_11.jpg")
# Cartagena Refugee Definition LA7
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA7.1_1", title="Cartagena Refugee Definition", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 1.0), labels=c("No or Underdeveloped Legislation","Not Incorporated","Cartagena Incorporated")) + tm_facets(by = "Year")
# Resettling into Legislation LA5
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA5.1_1", title="Resettlement Policy", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation", "Legislation but No Resettlement","Legislation with Resettlement")) + tm_facets(by = "Year")
# Asylum into Constitution LA3
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA3.1_1", title="Asylum into Constitution", palette= "Blues", style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("Not Included","Included into Constitution")) + tm_facets(by = "Year")
# First Country of Asylum Q101
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q101.1_1", title="First Country of Asylum \n Principle", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included into Legislation")) + tm_facets(by = "Year")
# Subsidiary Status Q278
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q278.1_1", title="Subsidiary Protection Status \n or Ad Hoc Legal Status", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included into Legislation")) + tm_facets(by = "Year")
# Environmental Refugees Q204
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q204.1_1", title="Environmental Refugees", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included into Legislation")) + tm_facets(by = "Year")
# Detained Asylum Seekers Q133
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q133.1_1", title="Detention Asylum Seekers", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Not Legal","Legal")) + tm_facets(by = "Year")
# Fast Track for weak asylum claims q188
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q188.1_1", title="Fast Track for Weak Asylum Claims", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included into Legislation")) + tm_facets(by = "Year")
# Written Asylum Request q172
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q172.1_1", title="Written Asylum Request", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Required","Legislation and Required")) + tm_facets(by = "Year")
# Asylum Seeker Right to Interview q174
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q174.1_1", title="Asylum Seekers' Right \n to Interview", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Asylum Seeker Right to Legal Representative q180
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q180.1_1", title="Asylum Seekers' Right to \n a Legal Representative", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Time Limit to Submit Asylum Request q184
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q184.1_1", title="Time Limit to Submit \n an Asylum Request", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Not Time Limit","Time Limit")) + tm_facets(by = "Year")
# Special Procedures for Children Asylum Seekers q190
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q190.1_1", title="Special Procedures for \n Children Asylum Seekers", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Right to Work q54
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q54.1_1", title="Right to Work", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Application at border entry q58
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("Q58.1_1", title="Application at Border \n Entry Possible", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Recognition Duties to International Treaties LA1
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA1.1_1", title="Recognition Duties Imposed by \n International Treaties", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Special Procedures for Mass Influx of Refugees LA11
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA11.1_1", title="Special Procedures to Deal with \n Mass Influx of Refugees", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# No Penalisation for Illegal Entry LA13
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA13.1_1", title="No Penalisation for \n Irregular Entry", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Recognition Declarative Character Refugee Condition LA15
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA15.1_1", title="Recognition Declarative Character \n of Refugee Condition", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Duty of Public Officials to pass on a request for asylum to competent authorities LA17
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA17.1_1", title="Duty of Public Officials to \n Process Asylum Requests", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Right to Family Unity LA23
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA23.1_1", title="Right to Family Unity", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Ease Recognition Professional/Academic Qualifications LA27
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA27.1_1", title="Ease Recognition Profession \nor Academic Qualification", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# ID Mention Refugee Status LA29
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA29.1_1", title="ID Mentions Refugee Status", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","ID does not mention Refugee Status","ID can mention Refugee Status")) + tm_facets(by = "Year")
# Guaranteed Access to Asylum Process LA31
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA31.1_1", title="Guaranteed Access to \n the Asylum Process", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Application can be submitted through UNHCR LA33
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA33.1_1", title="Application can be \n submitted through UNHCR", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Confidentiality as part of Asylum Process LA37
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA37.1_1", title="Confidentiality as Part of \n the Asylum Process", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Lack Documentation no Obstacle to Asylum Request Submission LA39
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA39.1_1", title="Lack Documentation not an \n Obstacle to the Submission \n of an Asylum Request", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Right to Appeal First Instance Decision LA41
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA41.1_1", title="Right to Appeal a \n Negative Asylum Decision", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Appeal Decision Body Independent LA43
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA43.1_1", title="Appeal Decision Body \n Indepdendent from First Instance", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("Appeal not Possible","Appeal Not Independent","Appeal Independent")) + tm_facets(by = "Year")
# Gratuity of Refugee Process LA45
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA45.1_1", title="Gratuity of Asylum \n Process Guaranteed", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Not guaranteed","Guaranteed")) + tm_facets(by = "Year")
# Free Legal Assistance to Asylum Seeker LA47
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA47.1_1", title="Free Legal Assistance", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Not guaranteed","Guaranteed")) + tm_facets(by = "Year")
# Interview Considers Social Background LA49
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA49.1_1", title="Interview Considers Social\n Background of \n Asylum Seeker", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Prohibition to contact country of origin without permission LA51
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA51.1_1", title="Prohibition to Contact \n Country of Origin", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Is UNHCR represented in refugee status decision council LA53
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA53.1_1", title="UNHCR representation \nin National Refugee Council", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Is UNHCR informed if negative last instance decision
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA57.1_1", title="UNHCR informed if Negative Decision", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Reasonable Time Limit to Submit Appeal Request LA59
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA59.1_1", title="Reasonable Time to \n Submit an Appeal", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("Appeal not Possible","Less than 15 Days","15 Days or More")) + tm_facets(by = "Year")
# Special Measures to Guarantee Womens' Access to Asylum Process LA61
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA61.1_1", title="Special Measures To Guarantee \nWomens' Access to \nthe Asylum Process", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Special Measures for people with special needs LA63
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA63.1_1", title="Special Measures for \nVulnerable People", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
# Refugee Status due to Persecution based on Gender LA65
tm_shape(Policy_Maps) + tm_borders("black", lwd= .5) + tm_polygons("LA65.1_1", title="Persecution due to \nGender Recognised", palette= c("#ef8a62","#f7f7f7", "#67a9cf"), style="fixed", breaks=c(0.0, 0.9, 1.0), labels=c("No or Underdeveloped Legislation","Legislation but Not Included","Included in Legislation")) + tm_facets(by = "Year")
Model1<-lm(formula=Regulatory_Complexity~Year, data=APLA_T_L3)
# Second step obtain presdicted and residual values
Model1$predicted <- predict(Model1)
Model1$residuals <- residuals(Model1)
# Eight Step Change legend
ggplot(Model1, aes(x=Year, y=Regulatory_Complexity))+
geom_jitter(width = 0.8, height = 0.2, color="lightgrey")+
geom_smooth(method = "lm", se=FALSE, color= "lightgrey")+
geom_segment(aes(xend=Year, yend=Model1$predicted), alpha= .2, color="lightgrey")+
geom_point(aes(color=abs(Model1$residuals), size=abs(Model1$residuals)))+
scale_color_continuous(low="black", high="red")+
guides(color=FALSE, size=guide_legend("Size of Residuals"))+
geom_point(aes(y=Model1$predicted), shape=1, color="lightgrey")+
theme_bw()+
scale_x_continuous(breaks = c(1990, 1995, 2000, 2005, 2010, 2015, 2020))+
ggtitle("Residuals of Regulatory Complexity in Asylum Policies in Latin America")+
ylab("Regulatory Complexity")+
theme(plot.title = element_text("serif", size = "14", hjust = 0.5))
# Merge Regulatory_Complexity and Liberalisation
APLA_Data_Filtered<- APLA_T_L3 %>%
left_join(APLA_T_L6, by = c("Country", "Year"))
# Filter low values
APLA_Data_Filtered<- APLA_Data_Filtered %>%
filter(Regulatory_Complexity > 15)
# Plot Relation between Regulatory Complexity and Liberalisation
ggplot(APLA_Data_Filtered, aes(Regulatory_Complexity, Liberalisation))+
geom_jitter(width=0.5, height= 0.5)+
geom_smooth()