GC.DOD.TOTL.GD.ZS(merkezi hükümet borcu) BN.CAB.XOKA.CD(cari hesap bakiyesi)

##dünya bankasından veri indirmek

library(WDI)
data <- WDI(indicator = c("GC.DOD.TOTL.GD.ZS", "BN.CAB.XOKA.CD" ))

##kesit veri

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.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── 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
data2003 <- data %>% filter(year == 2003)

##zaman serisi

dataTR <- data %>% filter (country == "TURKIYE")
library(ggplot2)
ggplot(dataTR, aes("year","GC.DOD.TOTL.GD.ZS")) + geom_line()
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?

ggplot(dataTR, aes(GC.DOD.TOTL.GD.ZS, BN.CAB.XOKA.CD)) + geom_point()

ggplot(dataTR, aes(GC.DOD.TOTL.GD.ZS)) + geom_histogram()

model <- lm (GC.DOD.TOTL.GD.ZS ~ BN.CAB.XOKA.CD, data = data )
summary(model)
## 
## Call:
## lm(formula = GC.DOD.TOTL.GD.ZS ~ BN.CAB.XOKA.CD, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -56.856 -28.086  -8.491  18.023 217.681 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     5.985e+01  8.670e-01   69.03   <2e-16 ***
## BN.CAB.XOKA.CD -2.269e-12  1.134e-11   -0.20    0.841    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 38.65 on 1986 degrees of freedom
##   (15036 observations deleted due to missingness)
## Multiple R-squared:  2.017e-05,  Adjusted R-squared:  -0.0004833 
## F-statistic: 0.04007 on 1 and 1986 DF,  p-value: 0.8414