In-Class Exercise

The data set contains various data on the housing sector in Istanbul. Data are available from 2010 to 2020 on a monthly basis.

Preprocessing

data <- read_excel("C:/Users/Aybike/Desktop/data.xlsx")
summary(data)
##     Tarih           TP AKONUTSAT1 T40 TP AKONUTSAT2 T40 TP AKONUTSAT3 T40
##  Length:129         Min.   : 6113     Min.   :  987     Min.   : 2022    
##  Class :character   1st Qu.:17240     1st Qu.: 6018     1st Qu.: 7567    
##  Mode  :character   Median :19357     Median : 7247     Median : 8494    
##                     Mean   :19828     Mean   : 7076     Mean   : 8675    
##                     3rd Qu.:21638     3rd Qu.: 8621     3rd Qu.: 9542    
##                     Max.   :40317     Max.   :24000     Max.   :14772    
##                     NA's   :36        NA's   :36        NA's   :36       
##  TP AKONUTSAT4 T40 TP DISKONSAT ISTANBUL TP HEDONIKYKFE IST   TP HKFE02     
##  Min.   : 4091     Min.   : 120.0        Min.   : 35.90     Min.   : 36.00  
##  1st Qu.: 9332     1st Qu.: 441.0        1st Qu.: 47.80     1st Qu.: 46.33  
##  Median :10526     Median : 571.0        Median : 76.35     Median : 76.85  
##  Mean   :11153     Mean   : 823.7        Mean   : 74.79     Mean   : 74.17  
##  3rd Qu.:11852     3rd Qu.:1009.0        3rd Qu.: 99.88     3rd Qu.:100.40  
##  Max.   :29003     Max.   :2650.0        Max.   :130.80     Max.   :125.10  
##  NA's   :36        NA's   :36            NA's   :1          NA's   :1       
##  TP TCBF02 ISTANBUL
##  Min.   :1415      
##  1st Qu.:1904      
##  Median :3466      
##  Mean   :3332      
##  3rd Qu.:4638      
##  Max.   :5767      
##  NA's   :1
colnames(data)[5]="TP_AKONUTSAT4_T40"
colnames(data)[6]="TP_DISKONSAT_ISTANBUL"
summary(data)
##     Tarih           TP AKONUTSAT1 T40 TP AKONUTSAT2 T40 TP AKONUTSAT3 T40
##  Length:129         Min.   : 6113     Min.   :  987     Min.   : 2022    
##  Class :character   1st Qu.:17240     1st Qu.: 6018     1st Qu.: 7567    
##  Mode  :character   Median :19357     Median : 7247     Median : 8494    
##                     Mean   :19828     Mean   : 7076     Mean   : 8675    
##                     3rd Qu.:21638     3rd Qu.: 8621     3rd Qu.: 9542    
##                     Max.   :40317     Max.   :24000     Max.   :14772    
##                     NA's   :36        NA's   :36        NA's   :36       
##  TP_AKONUTSAT4_T40 TP_DISKONSAT_ISTANBUL TP HEDONIKYKFE IST   TP HKFE02     
##  Min.   : 4091     Min.   : 120.0        Min.   : 35.90     Min.   : 36.00  
##  1st Qu.: 9332     1st Qu.: 441.0        1st Qu.: 47.80     1st Qu.: 46.33  
##  Median :10526     Median : 571.0        Median : 76.35     Median : 76.85  
##  Mean   :11153     Mean   : 823.7        Mean   : 74.79     Mean   : 74.17  
##  3rd Qu.:11852     3rd Qu.:1009.0        3rd Qu.: 99.88     3rd Qu.:100.40  
##  Max.   :29003     Max.   :2650.0        Max.   :130.80     Max.   :125.10  
##  NA's   :36        NA's   :36            NA's   :1          NA's   :1       
##  TP TCBF02 ISTANBUL
##  Min.   :1415      
##  1st Qu.:1904      
##  Median :3466      
##  Mean   :3332      
##  3rd Qu.:4638      
##  Max.   :5767      
##  NA's   :1
sub_data<-data %>% select(Tarih,TP_AKONUTSAT4_T40,TP_DISKONSAT_ISTANBUL) %>% mutate(Gün=as.Date(paste0(Tarih,"-01"))) %>% mutate(Yıl=year(Gün)) 
sum_data<- sub_data %>% group_by(Yıl) %>% summarise(Toplam_TP_AKONUTSAT4_T40 =  sum(TP_AKONUTSAT4_T40),Toplam_TP_DISKONSAT_ISTANBUL=sum(TP_DISKONSAT_ISTANBUL))
sum_data
## # A tibble: 11 x 3
##      Yıl Toplam_TP_AKONUTSAT4_T40 Toplam_TP_DISKONSAT_ISTANBUL
##    <dbl>                    <dbl>                        <dbl>
##  1  2010                       NA                           NA
##  2  2011                       NA                           NA
##  3  2012                       NA                           NA
##  4  2013                   130936                         2447
##  5  2014                   122518                         5580
##  6  2015                   127276                         7493
##  7  2016                   122104                         5811
##  8  2017                   123651                         8182
##  9  2018                   122825                        14270
## 10  2019                   145294                        20857
## 11  2020                   142618                        11966

Data Analysis with R

tsp <- ggplot(data = sum_data, aes(x = Yıl, y = Toplam_TP_AKONUTSAT4_T40))+geom_line(color="#d3501d",size=1)+
labs(title = "Toplam_TP_AKONUTSAT4_T40 vs Yıl")+
xlim(2013,2019)
tsp

Toplam_TP_AKONUTSAT4_T40 = Sum of second-hand house sales in ISTANBUL

Yıl = Year

I observed that second-hand house sales significantly increased in 2019. I think that it could be due to decreasing of affordability.

  • 2020 is an incomplete year so it is excluded.
tsp <- ggplot(data = sum_data, aes(x = Yıl, y = Toplam_TP_DISKONSAT_ISTANBUL))+ geom_line(color = "#00AFBB", size = 1) + xlim(2013,2019)+labs(title = "Toplam_TP_DISKONSAT_ISTANBUL vs Yıl")
tsp

Toplam_TP_DISKONSAT_ISTANBUL= Sum of house sales to foreigners in ISTANBUL

Yıl = Year

I observed that home sales to foreigners increased sharply after 2017. I think that it could be due to appreciation of Dollar currency against Turkish Lira.

  • 2020 is an incomplete year so it is excluded.

References

You may click here to reach other items of my progress journal.