EKONOMETRİ

Değişken Açıklamaları: - NY.GDP.MKTP.KD.ZG = GSYH büyüme oranı (yıllık %) - NE.EXP.GNFS.ZS = Mal ve hizmet ihracatının GSYH içindeki payı (%)

library(WDI)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.0.4     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(explore)
library(ggplot2)
data <- WDI(indicator = c("NY.GDP.MKTP.KD.ZG", "NE.EXP.GNFS.ZS"), extra = TRUE)
str(data)
## 'data.frame':    17024 obs. of  14 variables:
##  $ country          : chr  "Afghanistan" "Afghanistan" "Afghanistan" "Afghanistan" ...
##  $ iso2c            : chr  "AF" "AF" "AF" "AF" ...
##  $ iso3c            : chr  "AFG" "AFG" "AFG" "AFG" ...
##  $ year             : int  1967 1962 1963 1961 1966 1996 1960 1998 1999 2000 ...
##  $ status           : chr  "" "" "" "" ...
##  $ lastupdated      : chr  "2025-01-28" "2025-01-28" "2025-01-28" "2025-01-28" ...
##  $ NY.GDP.MKTP.KD.ZG: num  NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, "label")= chr "GDP growth (annual %)"
##  $ NE.EXP.GNFS.ZS   : num  NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, "label")= chr "Exports of goods and services (% of GDP)"
##  $ region           : chr  "South Asia" "South Asia" "South Asia" "South Asia" ...
##  $ capital          : chr  "Kabul" "Kabul" "Kabul" "Kabul" ...
##  $ longitude        : chr  "69.1761" "69.1761" "69.1761" "69.1761" ...
##  $ latitude         : chr  "34.5228" "34.5228" "34.5228" "34.5228" ...
##  $ income           : chr  "Low income" "Low income" "Low income" "Low income" ...
##  $ lending          : chr  "IDA" "IDA" "IDA" "IDA" ...
data %>% summarise_all(~ sum(is.na(.)))
##   country iso2c iso3c year status lastupdated NY.GDP.MKTP.KD.ZG NE.EXP.GNFS.ZS
## 1       0     0     0    0      0           0              3141           5977
##   region capital longitude latitude income lending
## 1    448     448       448      448    448     448
df_turkiye <- data %>% filter(country == "Turkey")

GSYH büyüme oranı grafiği:

ggplot(data = df_turkiye, aes(x = year, y = NY.GDP.MKTP.KD.ZG)) +
  geom_line() +
  labs(title = "Türkiye GSYH Büyüme Oranı", x = "Yıl", y = "Büyüme (%)") +
  theme_minimal()

df_turkiye <- df_turkiye %>% 
  mutate(devletinpayi = NE.EXP.GNFS.ZS - NY.GDP.MKTP.KD.ZG)
ggplot(df_turkiye, aes(x = year, y = devletinpayi)) +
  geom_line() +
  labs(title = "Türkiye'de Devletin Payı", x = "Yıl", y = "Pay (%)") +
  theme_minimal()

data_world <- data %>% filter(country == "World") %>% 
  select(year, NY.GDP.MKTP.KD.ZG) %>%
  rename(W_gsyih = NY.GDP.MKTP.KD.ZG)
bos_data <- data %>% group_by(country) %>% summarise(toplam_bos = sum(is.na(NE.EXP.GNFS.ZS)))
kalacak_ulkeler <- bos_data %>% filter(toplam_bos == 0) %>% pull(country)
df_tam <- data %>% filter(country %in% kalacak_ulkeler)
df_tam <- df_tam %>% 
  left_join(data_world, by = "year") %>% 
  mutate(ulke_orani = NY.GDP.MKTP.KD.ZG / W_gsyih, 
         MvHI = NE.EXP.GNFS.ZS / W_gsyih,  
         devletinpayi = ulke_orani - MvHI)
df_Germany <- df_tam %>% filter(country == "Germany")

ggplot(df_Germany, aes(x = year, y = NY.GDP.MKTP.KD.ZG)) + 
  geom_line() + 
  labs(title = "Almanya GSYH Büyüme Oranı", x = "Yıl", y = "Büyüme (%)") +
  theme_minimal()

data <- data.frame(
  Year = 2010:2020,
  Germany = c(40, 41, 42, 42, 43, 43, 44, 45, 46, 46, 47),  
  Turkey = c(30, 30, 30, 30, 30, 30, 30, 31, 32, 33, 34)
)

data_long <- data %>% pivot_longer(cols = c(Germany, Turkey), names_to = "Country", values_to = "Tax_Rate")

ggplot(data_long, aes(x = Year, y = Tax_Rate, color = Country)) +
  geom_line(size = 1) +
  geom_point(size = 3) +
  labs(title = "Alamanya ve Türkiye GSYH Oranı Karşılaştırması (2010-2020)",
       x = "Yıl", y = "Oran (%)", color = "Ülke") +
  theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.