Project Team


Project Description

Istanbulites and Turkish people have been desperately waiting for a catastrophic earthquake centering around Istanbul, since the infamous 1999 İzmit earthquake. In the near future, seismologists and researchers expect an earthquake that can even surpass a magnitude of 8.0 and devastate the unprepared city. This looming natural phenomenon is a common threat to all residents in Istanbul. Although buildings in some areas seem new or renovated, whether the city and people are ready for such an earthquake or not is a heated debate. Nevertheless, it is quite visible that most neighborhoods are extremely unguarded as they host numerous obsolete conjoint-apartments, little-to-no run-away zones and impenetrable roads. Measuring the effect of such unguided urbanization and, well, the inevitable earthquake is crucial in laying out a plan. In order to measure the scale of such an event, one should own in-depth data about the buildings and people in them, and also use advanced analysis and methods to grade its effect under numerous aspects and parameters. R Studio is a perfect place to crash data, crunch some numbers, and eventually deduce outcomes and visualize the output. This project outlines the likely effect of a large earthquake in Istanbul, both numerically and visually.


Project Goal & Social Problem Addressed

To be more frank, the problem addressed in this project is much more than being a ‘social’ one. Nowadays, the essence of a social problem is that a disadvantage minority is subject to psychological discrimination which may also lead to negative physical effects. Do not let it be misunderstood; all of the social problems should be taken into account and carefully managed by related authorities. However, when it comes to a large catastrophic natural event, it disobeys the main dynamics of being a social problem, such as ethnicity and wealth. If miserably unprepared, an +7.5 Mw earthquake may severely hit the society in terms of physical health, e.g. deaths, injuries, etc. After the short-lived phenomenon, its psychological effects can be everlasting.

In this project, our goal is to address the weak regions so that the public bodies should immediately take essential actions to strengthen the buildings and the infrastructure. Accordingly, we aim to analyze the related data from Istanbul Metropolitan Municipality in order to scale the vulnerability of districts and neighborhoods against a major earthquake.


Project Data


Contextual Actions Taken

To gain a meaningful insight, the project team has decided to introduce new metrics regarding the comparison between areas in terms of pecuniary and non-pecuniary damages. Below, you can find detailed information and formulation of the originally-formed metrics.

Average Building Vulnerability Rate of a District (BVR)

This metric is formulated to compare average endurance of buildings in a district versus those of other districts. If a district has higher BV rate, it means that the buildings in the district are more vulnerable than those of others. Obviously, this metric does not calculate the scale of vulnerability, meaning that a congested district with a moderate amount of weak buildings can score lower than a small district with a high amount of weak buildings. Nevertheless, our aim by using this metric is to find districts with higher concentration of vulnerable buildings.

Formulation: We assigned different multipliers to all sections of the simulated data related to buildings. Since the buildings with high damage are much riskier than the ones with low damage, we opted to appoint multipliers to each column parabolically, instead of a linear approach. Accordingly, you can see the allocation of multipliers per each column below:

Later, we multiplied each coefficient with its subsequent number of x damaged buildings relatively, and summed them up. Then, we summed up the number of buildings (B) that are built by era (pre-1980, 1980-2000, post-2000), and multiplied with the highest multiplier, 16, to create a base for the most risky theoretical vulnerability of a district. Finally, we divided total damage points to its theoretical maximum amount, and multiplied with 100 to compose a rate. The exact formulation is the following: BVR = 100(L1+M4+H9+S16)/(B16)

Even though this report focuses on rating the districts, below you can find an example of BVR among neighborhoods. We found out that the average BVR among all neighborhoods is 16.14%, with standard deviation of 4.28. The highest and lowest rates are 33.48 and 6.25 respectively. The average BVR among the top 100 is 25.08, whereas the average BVR among the lower end is 10.81. In parallel to our purpose, below are the most vulnerable neighborhoods with highest concentration of weak buildings:

Average Casualties Rate of a District (CR)

This metric is formulated to compare average casualties in a district versus those of other districts. If a district has higher CR rate, it means that the people in the district are more undefended than those of others. Clearly, this metric, like BVR, does not calculate the scale of vulnerability, meaning that a highly-populated district with low exposure can score lower than a highly-exposed district with low population. Still, our aim by using this metric is to find districts with higher concentration of probable casualties.

Formulation: As in BVR, we posted different multipliers to all sections of the simulated data related to buildings. Since higher degree of injury is much riskier than the lower one, we opted to appoint multipliers to each column parabolically, instead of a linear approach. Accordingly, you can see the allocation of multipliers per each column below:

Later, we multiplied each coefficient with its subsequent number relatively, and summed them up. Then, we multiplied the population of each district (P) with the highest multiplier, 16, to create a base for the most catastrophic situation for a district. Finally, we divided total damage points to its theoretical maximum amount, and multiplied with 100 to compose a rate. The exact formulation is the following: CR = 100(L1+H4+S9+D16)/(P16)


Technical Actions Taken

As it can be seen from our code below, we have used various data importing, cleaning, reshaping, exploring, and visualizing techniques.

In detail, primarily we composed a districts data from the original neighborhoods data at Data #1. For example, we summed up serious injuries figures of Fatih’s neighborhoods to come up with the number of serious injuries in Fatih. Second, we followed similar approach for Data #2 in order to reach the total number of buildings in all districts. Then, again we grouped the neighborhood data in Data #3 to get population density for all districts. Also, we had to remove Silivri from our campaign because of the lack of information in previous data, and manually added data for Adalar. Later, we edited some qualitative data for linguistic purposes. We constrained the locational data about all cities and districts of Turkey to solely Istanbul districts, and made some edits. Finally, we merged the up-to-date data to obtain our main data, used our formula to achieve BVR and CRs of all districts; put them on charts and mapped them on.

library(tidyverse)
library(readxl)
library(dplyr)
library(rvest)
library(imputeTS)
library(explore)
library(ggplot2)
library(sf)
library(leaflet)
library(viridis)
d1 <- read_excel("data/deprem_analizi.xlsx")

d1 <- d1 %>% 
  group_by(ilce_adi) %>%
  summarise(cok_agir_hasarli_bina_sayisi= sum(cok_agir_hasarli_bina_sayisi), 
            agir_hasarli_bina_sayisi= sum(agir_hasarli_bina_sayisi),
            orta_hasarli_bina_sayisi= sum(orta_hasarli_bina_sayisi),
            hafif_hasarli_bina_sayisi= sum(hafif_hasarli_bina_sayisi),
            can_kaybi_sayisi= sum(can_kaybi_sayisi),
            agir_yarali_sayisi= sum(agir_yarali_sayisi),
            hastanede_tedavi_sayisi= sum(hastanede_tedavi_sayisi),
            hafif_yarali_sayisi= sum(hafif_yarali_sayisi),
            dogalgaz_boru_hasari= sum(dogalgaz_boru_hasari),
            icme_suyu_boru_hasari= sum(icme_suyu_boru_hasari),
            atik_su_boru_hasari= sum(atik_su_boru_hasari),
            gecici_barinma= sum(gecici_barinma))
d1 <- d1[order(d1$ilce_adi),]
# Data d2 contains information from 2017
d2 <- read_excel("data/bina_sayisi.xlsx")
d2$bina_sayisi <- rowSums(d2[ , c(4:6)], na.rm=TRUE)

d2 <- d2 %>% 
#  filter(!ilce_adi == "ADALAR")  %>%
  group_by(ilce_adi) %>%
  summarise(bina_sayisi= sum(bina_sayisi))
d2 <- d2[order(d2$ilce_adi),]
unique(d2[c("ilce_adi")])
## # A tibble: 39 x 1
##    ilce_adi    
##    <chr>       
##  1 ADALAR      
##  2 ARNAVUTKÖY  
##  3 ATASEHIR    
##  4 AVCILAR     
##  5 BAGCILAR    
##  6 BAHÇELIEVLER
##  7 BAKIRKÖY    
##  8 BASAKSEHIR  
##  9 BAYRAMPASA  
## 10 BESIKTAS    
## # ... with 29 more rows
url <- "https://www.atlasbig.com/tr/istanbul-mahalleleri-nufus-yogunlugu"
h <- read_html(url)
tab <- h %>%
   html_nodes("table")
d3 <- tab %>%
   html_table %>% .[[1]] %>% 
  select(-Sıra)
colnames(d3)[2] <-"ilce_adi"
                   
d3 <- d3 %>% 
  mutate_at("Nüfus", funs(as.numeric(gsub(',', '', .)))) %>%
  group_by(ilce_adi) %>%
  summarise(Nüfus= sum(Nüfus))
#Adalar population was not included in this dataset, we added it later from other sources.
adalar <- data.frame("Adalar", 14907)  
names(adalar) <- c("ilce_adi", "Nüfus")
d3 <- rbind(d3, adalar)
d3 <- d3[order(d3$ilce_adi),]
cbind(d1$ilce_adi, d2$ilce_adi, d3$ilce_adi)
##       [,1]            [,2]            [,3]           
##  [1,] "ADALAR"        "ADALAR"        "Adalar"       
##  [2,] "ARNAVUTKÖY"    "ARNAVUTKÖY"    "Arnavutköy"   
##  [3,] "ATASEHIR"      "ATASEHIR"      "Atasehir"     
##  [4,] "AVCILAR"       "AVCILAR"       "Avcilar"      
##  [5,] "BAGCILAR"      "BAGCILAR"      "Bagcilar"     
##  [6,] "BAHÇELIEVLER"  "BAHÇELIEVLER"  "Bahçelievler" 
##  [7,] "BAKIRKÖY"      "BAKIRKÖY"      "Bakirköy"     
##  [8,] "BASAKSEHIR"    "BASAKSEHIR"    "Basaksehir"   
##  [9,] "BAYRAMPASA"    "BAYRAMPASA"    "Bayrampasa"   
## [10,] "BESIKTAS"      "BESIKTAS"      "Besiktas"     
## [11,] "BEYKOZ"        "BEYKOZ"        "Beykoz"       
## [12,] "BEYLIKDÜZÜ"    "BEYLIKDÜZÜ"    "Beylikdüzü"   
## [13,] "BEYOGLU"       "BEYOGLU"       "Beyoglu"      
## [14,] "BÜYÜKÇEKMECE"  "BÜYÜKÇEKMECE"  "Büyükçekmece" 
## [15,] "ÇATALCA"       "ÇATALCA"       "Çatalca"      
## [16,] "ÇEKMEKÖY"      "ÇEKMEKÖY"      "Çekmeköy"     
## [17,] "ESENLER"       "ESENLER"       "Esenler"      
## [18,] "ESENYURT"      "ESENYURT"      "Esenyurt"     
## [19,] "EYÜP"          "EYÜP"          "Eyüp"         
## [20,] "FATIH"         "FATIH"         "Fatih"        
## [21,] "GAZIOSMANPASA" "GAZIOSMANPASA" "Gaziosmanpasa"
## [22,] "GÜNGÖREN"      "GÜNGÖREN"      "Güngören"     
## [23,] "KADIKÖY"       "KADIKÖY"       "Kadiköy"      
## [24,] "KAGITHANE"     "KAGITHANE"     "Kagithane"    
## [25,] "KARTAL"        "KARTAL"        "Kartal"       
## [26,] "KÜÇÜKÇEKMECE"  "KÜÇÜKÇEKMECE"  "Küçükçekmece" 
## [27,] "MALTEPE"       "MALTEPE"       "Maltepe"      
## [28,] "PENDIK"        "PENDIK"        "Pendik"       
## [29,] "SANCAKTEPE"    "SANCAKTEPE"    "Sancaktepe"   
## [30,] "SARIYER"       "SARIYER"       "Sariyer"      
## [31,] "SILE"          "SILE"          "Sile"         
## [32,] "SILIVRI"       "SILIVRI"       "Silivri"      
## [33,] "SISLI"         "SISLI"         "Sisli"        
## [34,] "SULTANBEYLI"   "SULTANBEYLI"   "Sultanbeyli"  
## [35,] "SULTANGAZI"    "SULTANGAZI"    "Sultangazi"   
## [36,] "TUZLA"         "TUZLA"         "Tuzla"        
## [37,] "ÜMRANIYE"      "ÜMRANIYE"      "Ümraniye"     
## [38,] "ÜSKÜDAR"       "ÜSKÜDAR"       "Üsküdar"      
## [39,] "ZEYTINBURNU"   "ZEYTINBURNU"   "Zeytinburnu"
d2$ilce_adi <- d3$ilce_adi
d1$ilce_adi <- d3$ilce_adi
# Goodbye to Silivri 
# We had to eliminate Silivri because we do not have Silivri in our geospatial dataset
d1 <- d1 %>% filter(!ilce_adi == "Silivri")
d2 <- d2 %>% filter(!ilce_adi == "Silivri")
d3 <- d3 %>% filter(!ilce_adi == "Silivri")
d4 = dplyr::left_join(d2, d3, by = "ilce_adi")
d5 = dplyr::left_join(d1, d4, by = "ilce_adi")
ilce <- readRDS("data/gadm36_TUR_2_sf.rds")
colnames(ilce)[7] <-"ilce_adi"
istanbul_sf <- ilce %>% 
                  filter(NAME_1 == "Istanbul") %>%
                  select(ilce_adi)  
istanbul_sf <- istanbul_sf[order(istanbul_sf$ilce_adi),]
cbind(d5$ilce_adi, istanbul_sf$ilce_adi)
##       [,1]            [,2]           
##  [1,] "Adalar"        "Adalar"       
##  [2,] "Arnavutköy"    "Arnavutkoy"   
##  [3,] "Atasehir"      "Atasehir"     
##  [4,] "Avcilar"       "Avcilar"      
##  [5,] "Bagcilar"      "Bagcilar"     
##  [6,] "Bahçelievler"  "Bahçelievler" 
##  [7,] "Bakirköy"      "Bakirköy"     
##  [8,] "Basaksehir"    "Basaksehir"   
##  [9,] "Bayrampasa"    "Bayrampasa"   
## [10,] "Besiktas"      "Besiktas"     
## [11,] "Beykoz"        "Beykoz"       
## [12,] "Beylikdüzü"    "Beylikduzu"   
## [13,] "Beyoglu"       "Beyoglu"      
## [14,] "Büyükçekmece"  "Büyükçekmece" 
## [15,] "Çatalca"       "Çatalca"      
## [16,] "Çekmeköy"      "Çekmekoy"     
## [17,] "Esenler"       "Esenler"      
## [18,] "Esenyurt"      "Esenyurt"     
## [19,] "Eyüp"          "Eyüp"         
## [20,] "Fatih"         "Fatih"        
## [21,] "Gaziosmanpasa" "Gaziosmanpasa"
## [22,] "Güngören"      "Güngören"     
## [23,] "Kadiköy"       "Kadiköy"      
## [24,] "Kagithane"     "Kagithane"    
## [25,] "Kartal"        "Kartal"       
## [26,] "Küçükçekmece"  "Küçükçekmece" 
## [27,] "Maltepe"       "Maltepe"      
## [28,] "Pendik"        "Pendik"       
## [29,] "Sancaktepe"    "Sancaktepe"   
## [30,] "Sariyer"       "Sariyer"      
## [31,] "Sile"          "Sile"         
## [32,] "Sisli"         "Sisli"        
## [33,] "Sultanbeyli"   "Sultanbeyli"  
## [34,] "Sultangazi"    "Sultangazi"   
## [35,] "Tuzla"         "Tuzla"        
## [36,] "Ümraniye"      "Ümraniye"     
## [37,] "Üsküdar"       "Üsküdar"      
## [38,] "Zeytinburnu"   "Zeytinburnu"
istanbul_sf$ilce_adi <- d5$ilce_adi
data <- merge(istanbul_sf, d5, by = "ilce_adi") 
data$bina_zafiyeti <- with(data,
                            ((cok_agir_hasarli_bina_sayisi)*16 + (agir_hasarli_bina_sayisi)*9 + 
                                     (orta_hasarli_bina_sayisi)*4 + (hafif_hasarli_bina_sayisi))/(bina_sayisi)*16)
data$insan_zafiyeti <- with(data, 
                            ((hafif_yarali_sayisi) + (hastanede_tedavi_sayisi)*4 +
                                     (agir_yarali_sayisi)*9 + (can_kaybi_sayisi)*16)/(Nüfus)*16)
pal_col <- colorNumeric(c("#e6e6fa", "#9b30ff", "#551a8b"), domain = data$insan_zafiyeti) 
labels <-  sprintf("Districts:<strong> %s</strong><br/> Population:<strong> %s</strong><br/>
                   <br/> Casualties Rate:<strong> %s</strong><br/>", data$ilce_adi, data$Nüfus, round(data$insan_zafiyeti,4)) %>%
            lapply(htmltools::HTML)  #converts it into a HTML content
data %>%
  leaflet() %>%
  addPolygons(color="white", weight = 1,
              fillColor = ~pal_col(insan_zafiyeti),
              fillOpacity = 0.9,
              label = labels) %>%
  fitBounds(lng1 = 27.5117, lat1 = 40.9781, 
            lng2 = 31.1240, lat2 = 41.0882
 ) %>%
  addTiles() %>%
  addLegend("bottomright",  
  pal=pal_col,    
  bins=4,
  values=~insan_zafiyeti, 
  title = 'Casulties Vulnerability Rate in Each District ') 
data %>%
  ggplot() +
  geom_sf(aes_string(fill = "bina_zafiyeti"), color = "black") +
  scale_fill_steps2(low = "#e0ffff", mid = "#00e5ee", high = "#00868b", midpoint = 40, guide=FALSE) +
  theme_void() +
  ggtitle("Building Vulnerability Rate in Each District ") +
  geom_sf_label(data=subset(data, bina_zafiyeti > 5), 
              aes(label = round(bina_zafiyeti,2)), colour = "Black", size = 1.9, hjust=0) +
  theme(title = element_text(face="bold")) 

# We tried to show how much dependency there is between the number of heavily damaged buildings 
# and temporary accommodation according to the population of the districts with scatter plot.
data(data)
ggplot(data, aes(x=bina_zafiyeti, y=insan_zafiyeti)) + 
  geom_point(aes(color=ilce_adi, size=Nüfus, guide=FALSE)) + 
  labs(x="Building Vulnerability Rate", 
       y="Casualties Rate",
       title="Casualties Rate and Building Vulnerability Rate") + 
        theme_linedraw() +
       theme(plot.title = element_text(size=14, color = "darkblue"), 
             axis.text.x= element_text(size=14),
             axis.text.y= element_text(size=14), 
             axis.title=element_text(size=14, color = "darkblue"))

# Top 8 neighborhoods in CR
data[data$insan_zafiyeti>1,] %>%
ggplot(aes(x=ilce_adi, y=insan_zafiyeti))+
geom_bar(stat="identity",
         width=0.5, fill="lightblue")+
  scale_y_continuous(limits=c(0,3.5))+
 labs(x="Districts",
      y="Casualties Rate", 
      title="Districts with High Casualties Rate")+ 
theme_bw()+
theme(plot.title = element_text(hjust=0.5, size=18, color = "darkblue"),
      axis.text.x= element_text(size=12, color = "darkblue"),
      axis.text.y= element_text(size=12, color = "darkblue"), 
      axis.title=element_text(size=15, color = "darkblue")) +
theme(axis.text.x=element_text(hjust = 0, angle=90), 
      axis.title.y =element_text(hjust = 0.5, vjust = 1)) +
theme(plot.background = element_rect(fill = "lightyellow", color = "lightgreen", size = 0.5, linetype = "solid"),
      panel.grid.major = element_line(size = 0.5, linetype = 'dotted', colour = "darkblue"), 
      panel.grid.minor = element_line(size = 0.25, linetype = 'dotted', colour = "darkblue")
  )

########
# Low 8 neighborhoods in CR
data[data$insan_zafiyeti<0.09,] %>%
ggplot(aes(x=ilce_adi, y=insan_zafiyeti))+
geom_bar(stat="identity",
         width=0.5, fill="lightblue")+
  scale_y_continuous(limits=c(0,0.1))+
 labs(x="Districts",
      y="Casualties Rate", 
      title="Districts with Low Casualties Rate")+ 
theme_bw()+
theme(plot.title = element_text(hjust=0.5, size=18, color = "darkblue"),
      axis.text.x= element_text(size=12, color = "darkblue"),
      axis.text.y= element_text(size=12, color = "darkblue"), 
      axis.title=element_text(size=15, color = "darkblue")) +
theme(axis.text.x=element_text(hjust = 0, angle=90), 
      axis.title.y =
element_text(hjust = 0.5, vjust = 1)) +
theme(plot.background = element_rect(fill = "lightyellow", color = "lightgreen", size = 0.5, linetype = "solid"),
      panel.grid.major = element_line(size = 0.5, linetype = 'dotted', colour = "darkblue"), 
      panel.grid.minor = element_line(size = 0.25, linetype = 'dotted', colour = "darkblue")
  )

########
# Low 8 neighborhoods in BVR
data[data$bina_zafiyeti<9,] %>%
ggplot(aes(x=ilce_adi, y=bina_zafiyeti))+
geom_bar(stat="identity",
         width=0.5, fill="orange")+
  scale_y_continuous(limits=c(0,10))+
 labs(x="Districts",
      y="Building Vulnerability Rate", 
      title="Districts with Low Building Vulnerability Rate")+ 
theme_bw()+
theme(plot.title = element_text(hjust=0.5, size=18, color = "darkblue"),
      axis.text.x= element_text(size=12, color = "darkblue"),
      axis.text.y= element_text(size=12, color = "darkblue"), 
      axis.title=element_text(size=15, color = "darkblue")) +
theme(axis.text.x=element_text(hjust = 0, angle=90), 
      axis.title.y =
element_text(hjust = 0.5, vjust = 1)) +
theme(plot.background = element_rect(fill = "lightyellow", color = "lightgreen", size = 0.5, linetype = "solid"),
      panel.grid.major = element_line(size = 0.5, linetype = 'dotted', colour = "darkblue"), 
      panel.grid.minor = element_line(size = 0.25, linetype = 'dotted', colour = "darkblue")
  )

########
# Top 8 neighborhoods in BVR
data[data$bina_zafiyeti>35,] %>%
ggplot(aes(x=ilce_adi, y=bina_zafiyeti))+
geom_bar(stat="identity",
         width=0.5, fill="orange")+
 scale_y_continuous(limits=c(0,60))+
 labs(x="Districts",
      y="Building Vulnerability Rate", 
      title="Districts with High Building Vulnerability Rate")+ 
theme_bw()+
theme(plot.title = element_text(hjust=0.5, size=18, color = "darkblue"),
      axis.text.x= element_text(size=12, color = "darkblue"),
      axis.text.y= element_text(size=12, color = "darkblue"), 
      axis.title=element_text(size=15, color = "darkblue")) +
theme(axis.text.x=element_text(hjust = 0, angle=90), 
      axis.title.y =
element_text(hjust = 0.5, vjust = 1)) +
theme(plot.background = element_rect(fill = "lightyellow", color = "lightgreen", size =1, linetype = "solid"),
      panel.grid.major = element_line(size = 0.5, linetype = 'dotted', colour = "darkblue"), 
      panel.grid.minor = element_line(size = 0.25, linetype = 'dotted', colour = "darkblue")
  )

ggplot(sample_n(data,38), aes(ilce_adi, gecici_barinma)) + 
geom_count(col="tomato3", show.legend=T)+
labs(x="Districts",
     y="Temporary Shelters", 
     title="Temporary Shelters")+  
theme_set(theme_bw()) +
theme(plot.title = element_text(size=17, hjust=0.5, color="darkgreen")
      ,axis.text.x= element_text(size=12, angle=90),
       axis.text.y= element_text(size=12),
        axis.title=element_text(size=15, color="darkgreen"))

##########

data[data$gecici_barinma>30000,] %>%
ggplot(aes(x=ilce_adi, y=gecici_barinma))+
geom_bar(stat="identity",
         width=0.5, fill="green")+
 #scale_y_continuous(limits=c(0,60))+
 labs(x="Districts", 
      y="Temporary Shelters", 
      title="Districts That Need More Shelters")+ 
theme_bw()+
theme(plot.title = element_text(hjust=0.5, size=18, color = "darkblue"),
      axis.text.x= element_text(size=12, color = "darkblue"),
      axis.text.y= element_text(size=12, color = "darkblue"), 
      axis.title=element_text(size=15, color = "darkblue")) +
theme(axis.text.x=element_text(hjust = 0, angle=90), 
      axis.title.y =
element_text(hjust = 0.5, vjust = 1)) +
theme(plot.background = element_rect(fill = "lightyellow", color = "lightgreen", size =1, linetype = "solid"),
      panel.grid.major = element_line(size = 0.5, linetype = 'dotted', colour = "darkblue"), 
      panel.grid.minor = element_line(size = 0.25, linetype = 'dotted', colour = "darkblue")
  )

######
data[data$gecici_barinma<10000,] %>%
ggplot(aes(x=ilce_adi, y=gecici_barinma))+
geom_bar(stat="identity",
         width=0.5, fill="green")+
 #scale_y_continuous(limits=c(0,60))+
 labs(x="Districts", 
      y="Temporary Shelters", 
      title="Districts That Need Fewer Shelters")+ 
theme_bw()+
theme(plot.title = element_text(hjust=0.5, size=18, color = "darkblue"),
      axis.text.x= element_text(size=12, color = "darkblue"),
      axis.text.y= element_text(size=12, color = "darkblue"), 
      axis.title=element_text(size=15, color = "darkblue")) +
theme(axis.text.x=element_text(hjust = 0, angle=90), 
      axis.title.y =
element_text(hjust = 0.5, vjust = 1)) +
theme(plot.background = element_rect(fill = "lightyellow", color = "lightgreen", size =1, linetype = "solid"),
      panel.grid.major = element_line(size = 0.5, linetype = 'dotted', colour = "darkblue"), 
      panel.grid.minor = element_line(size = 0.25, linetype = 'dotted', colour = "darkblue")
  )

#Correlogram 
#In this plot, correlation coefficients are colored according to the value. 
# Correlation matrix can be also reordered according to the degree of association between variables.
library(corrplot)
vis <- d5 %>% select(-ilce_adi)
res <- cor(vis)
round(res, 3)
##                              cok_agir_hasarli_bina_sayisi
## cok_agir_hasarli_bina_sayisi                        1.000
## agir_hasarli_bina_sayisi                            0.944
## orta_hasarli_bina_sayisi                            0.807
## hafif_hasarli_bina_sayisi                           0.599
## can_kaybi_sayisi                                    0.857
## agir_yarali_sayisi                                  0.903
## hastanede_tedavi_sayisi                             0.856
## hafif_yarali_sayisi                                 0.843
## dogalgaz_boru_hasari                                0.474
## icme_suyu_boru_hasari                               0.512
## atik_su_boru_hasari                                 0.579
## gecici_barinma                                      0.723
## bina_sayisi                                         0.103
## Nüfus                                               0.272
##                              agir_hasarli_bina_sayisi orta_hasarli_bina_sayisi
## cok_agir_hasarli_bina_sayisi                    0.944                    0.807
## agir_hasarli_bina_sayisi                        1.000                    0.942
## orta_hasarli_bina_sayisi                        0.942                    1.000
## hafif_hasarli_bina_sayisi                       0.739                    0.896
## can_kaybi_sayisi                                0.838                    0.767
## agir_yarali_sayisi                              0.871                    0.784
## hastanede_tedavi_sayisi                         0.849                    0.789
## hafif_yarali_sayisi                             0.851                    0.808
## dogalgaz_boru_hasari                            0.689                    0.756
## icme_suyu_boru_hasari                           0.712                    0.750
## atik_su_boru_hasari                             0.753                    0.781
## gecici_barinma                                  0.821                    0.873
## bina_sayisi                                     0.219                    0.426
## Nüfus                                           0.396                    0.597
##                              hafif_hasarli_bina_sayisi can_kaybi_sayisi
## cok_agir_hasarli_bina_sayisi                     0.599            0.857
## agir_hasarli_bina_sayisi                         0.739            0.838
## orta_hasarli_bina_sayisi                         0.896            0.767
## hafif_hasarli_bina_sayisi                        1.000            0.573
## can_kaybi_sayisi                                 0.573            1.000
## agir_yarali_sayisi                               0.584            0.994
## hastanede_tedavi_sayisi                          0.600            0.999
## hafif_yarali_sayisi                              0.631            0.995
## dogalgaz_boru_hasari                             0.560            0.627
## icme_suyu_boru_hasari                            0.532            0.620
## atik_su_boru_hasari                              0.571            0.725
## gecici_barinma                                   0.762            0.913
## bina_sayisi                                      0.706           -0.009
## Nüfus                                            0.813            0.444
##                              agir_yarali_sayisi hastanede_tedavi_sayisi
## cok_agir_hasarli_bina_sayisi              0.903                   0.856
## agir_hasarli_bina_sayisi                  0.871                   0.849
## orta_hasarli_bina_sayisi                  0.784                   0.789
## hafif_hasarli_bina_sayisi                 0.584                   0.600
## can_kaybi_sayisi                          0.994                   0.999
## agir_yarali_sayisi                        1.000                   0.993
## hastanede_tedavi_sayisi                   0.993                   1.000
## hafif_yarali_sayisi                       0.987                   0.998
## dogalgaz_boru_hasari                      0.594                   0.649
## icme_suyu_boru_hasari                     0.597                   0.641
## atik_su_boru_hasari                       0.699                   0.745
## gecici_barinma                            0.894                   0.928
## bina_sayisi                               0.012                   0.016
## Nüfus                                     0.420                   0.473
##                              hafif_yarali_sayisi dogalgaz_boru_hasari
## cok_agir_hasarli_bina_sayisi               0.843                0.474
## agir_hasarli_bina_sayisi                   0.851                0.689
## orta_hasarli_bina_sayisi                   0.808                0.756
## hafif_hasarli_bina_sayisi                  0.631                0.560
## can_kaybi_sayisi                           0.995                0.627
## agir_yarali_sayisi                         0.987                0.594
## hastanede_tedavi_sayisi                    0.998                0.649
## hafif_yarali_sayisi                        1.000                0.671
## dogalgaz_boru_hasari                       0.671                1.000
## icme_suyu_boru_hasari                      0.658                0.983
## atik_su_boru_hasari                        0.761                0.961
## gecici_barinma                             0.947                0.767
## bina_sayisi                                0.044                0.139
## Nüfus                                      0.512                0.429
##                              icme_suyu_boru_hasari atik_su_boru_hasari
## cok_agir_hasarli_bina_sayisi                 0.512               0.579
## agir_hasarli_bina_sayisi                     0.712               0.753
## orta_hasarli_bina_sayisi                     0.750               0.781
## hafif_hasarli_bina_sayisi                    0.532               0.571
## can_kaybi_sayisi                             0.620               0.725
## agir_yarali_sayisi                           0.597               0.699
## hastanede_tedavi_sayisi                      0.641               0.745
## hafif_yarali_sayisi                          0.658               0.761
## dogalgaz_boru_hasari                         0.983               0.961
## icme_suyu_boru_hasari                        1.000               0.968
## atik_su_boru_hasari                          0.968               1.000
## gecici_barinma                               0.735               0.822
## bina_sayisi                                  0.103               0.081
## Nüfus                                        0.367               0.447
##                              gecici_barinma bina_sayisi Nüfus
## cok_agir_hasarli_bina_sayisi          0.723       0.103 0.272
## agir_hasarli_bina_sayisi              0.821       0.219 0.396
## orta_hasarli_bina_sayisi              0.873       0.426 0.597
## hafif_hasarli_bina_sayisi             0.762       0.706 0.813
## can_kaybi_sayisi                      0.913      -0.009 0.444
## agir_yarali_sayisi                    0.894       0.012 0.420
## hastanede_tedavi_sayisi               0.928       0.016 0.473
## hafif_yarali_sayisi                   0.947       0.044 0.512
## dogalgaz_boru_hasari                  0.767       0.139 0.429
## icme_suyu_boru_hasari                 0.735       0.103 0.367
## atik_su_boru_hasari                   0.822       0.081 0.447
## gecici_barinma                        1.000       0.191 0.689
## bina_sayisi                           0.191       1.000 0.589
## Nüfus                                 0.689       0.589 1.000
corrplot(res, type = "upper", order = "hclust", 
         tl.col = "black", tl.srt = 45)

#Heatmap
#Correlations between columns
col<- colorRampPalette(c("blue", "white", "red"))(20)
heatmap(x = res, col = col, symm = TRUE)

cor(data$gecici_barinma, data$cok_agir_hasarli_bina_sayisi)
## [1] 0.7228121
#Linear Regression between Temporary Shelters and Building Vulnerability Rate
data(data)
fit1 <- lm(gecici_barinma ~ hafif_yarali_sayisi, data = data)
summary(fit1)
## 
## Call:
## lm(formula = gecici_barinma ~ hafif_yarali_sayisi, data = data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -14128.1  -3479.4   -602.3   2969.8  17649.7 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         5746.9688  1321.8604   4.348 0.000108 ***
## hafif_yarali_sayisi    8.0892     0.4572  17.694  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5977 on 36 degrees of freedom
## Multiple R-squared:  0.8969, Adjusted R-squared:  0.894 
## F-statistic: 313.1 on 1 and 36 DF,  p-value: < 2.2e-16
require(ggplot2)
# we could not change x and y title  names because it came from column names
ggplot(data,aes(y=gecici_barinma,x=hafif_yarali_sayisi),
       scale_x_continuous(limits=c(0,80000)))+
  geom_point()+
  geom_smooth(method="lm")+
theme(axis.title=element_text(size=15, color = "darkblue"))+
theme(plot.background = element_rect(fill = "lightyellow", color = "black", size =1, linetype = "solid"),
      panel.grid.major = element_line(size = 0.5, linetype = 'dotted', colour = "darkblue"), 
      panel.grid.minor = element_line(size = 0.25, linetype = 'dotted', colour = "darkblue")
  )


Results

In the interim report, it was founded that Fatih, Bakırköy and Adalar host the most vulnerable buildings against a 7.5 Mw earthquake in Istanbul. Basinköy, Yeşi̇lköy, Saridemi̇r and Yedi̇kule can be the most affected neighborhoods after a big earthquake.

After making few modifications, there are the benchmark results of the project subject to the main target: - Top 3 Districts with high Casualties Rate: Adalar, Bakırköy, Fatih - Top 3 Districts with low Casualties Rate: Şile, Çekmeköy, Arnavutköy - Top 3 Districts with high Building Vulnerability Rate: Adalar, Bakırköy, Fatih - Top 3 Districts with low Building Vulnerability Rate: Şişli, Sultangazi, Çatalca - Top 3 Districts that need more shelters: Küçükçekmece, Esenyurt, Bahçelievler - Top 3 Districts that need fewer shelters: Kağıthane, Sarıyer, Beykoz

From these results, the following may interpreted: - BVRs and CRs are very correlated when the most vulnerable regions are tried to be examined. The results indicate that Adalar, Bakırköy and Fatih host the most dense and vulnerable buildings in the city, so they may also suffer higher casualties in a +7.5 Mw earthquake. - Lower BVRs and CRs do not match resoundingly as the higher ones. Nevertheless, we may assume that Şile, Arnavutköy and Çatalca have lower rates because relatively they do not have congested areas and buildings with high floors. Thus, they are less likely to be affected by a large earthquake. On the other hand, it is apparent that Şişli, Sultangazi and Çekmeköy have some congested areas and buildings with high floors, but still they appear at the lower end of the list. This may show that some of the old buildings in these districts may have received urban transformation, most buildings were built to be made as strong as possible, and/or these areas enjoy better soil structure behind the buildings like large blocks of rock. - The need for shelters is also partially related to the population of a district. It is known that Küçükçekmece, Esenyurt and Bahçelievler have higher populations than those of other districts. Moreover, Sarıyer and Beykoz need fewer shelters because a large portion of the residential buildings in these districts are detached houses, which may have their own shelters. Conversely, Kağıthane is an interesting case because the characteristics of the region may seem very similar to those of Küçükçekmece and Bahçelievler. Still, it is safe to guess that even though the region is congested, the buildings in Kağıthane are recently built and obliged to have a shelter at their basement floors, so the numerical deduction is correct.


Conclusion

Knowing that Istanbul is already facing a major threat of +7.5 Mw earthquake, the project team has gathered data to find out which areas are more vulnerable. The principal takeaway of the analysis is that Adalar, Bakırköy and Fatih are the most dangerous districts for their inhabitants in case of a such catastrophic earthquake.

We suggest that every building in these districts should be graded in terms of durability and strength, and the weak ones should be rebuilt immediately. For instance, in order to encourage such moves, the public bodies can give decorated financial incentives to the inhabitants and contractors under strict conditions and circumstances. Also, organizations can organize activities to increase awareness for the possible threat of a large earthquake in Istanbul.


URL Address of the Project


References