library(WDI)
DT.DOD.DECT.GN.ZS “Stocks de la dette extérieure (% du RNB)” TX.VAL.FUEL.ZS.UN “Yakıt ihracatı (mal ihracatının yüzdesi)”
data <- WDI(indicator = c("DT.DOD.DECT.GN.ZS","TX.VAL.FUEL.ZS.UN"))
2000
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
data2000 <- data %>% filter(year==2000)
dataSO <- data %>% filter(country=="Somalia")
library(ggplot2)
ggplot(dataSO,aes(year,DT.DOD.DECT.GN.ZS)) +geom_line()
## Warning: Removed 11 rows containing missing values or values outside the scale range
## (`geom_line()`).
ggplot(dataSO,aes(year,DT.DOD.DECT.GN.ZS)) +geom_point()
## Warning: Removed 33 rows containing missing values or values outside the scale range
## (`geom_point()`).
data2000 <- data %>% filter(year==2000)
view(data2000)
data2000 <- data2000 %>% filter(year==2000)
data2000 <- data2000 %>% aes(!is.na(DT.DOD.DECT.GN.ZS))
data2000 <- data2000 %>% aes(!is.na(TX.VAL.FUEL.ZS.UN))
library(ggplot2)
ggplot(data, aes(DT.DOD.DECT.GN.ZS)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 11284 rows containing non-finite outside the scale range
## (`stat_bin()`).
ggplot(dataSO,aes(year,TX.VAL.FUEL.ZS.UN)) +geom_line()
## Warning: Removed 43 rows containing missing values or values outside the scale range
## (`geom_line()`).
ggplot(dataSO,aes(year,TX.VAL.FUEL.ZS.UN)) +geom_point()
## Warning: Removed 50 rows containing missing values or values outside the scale range
## (`geom_point()`).
library(ggplot2)
ggplot(data, aes(TX.VAL.FUEL.ZS.UN)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 7883 rows containing non-finite outside the scale range
## (`stat_bin()`).
model <- lm(DT.DOD.DECT.GN.ZS ~ TX.VAL.FUEL.ZS.UN, data = dataSO)
summary(model)
##
## Call:
## lm(formula = DT.DOD.DECT.GN.ZS ~ TX.VAL.FUEL.ZS.UN, data = dataSO)
##
## Residuals:
## Min 1Q Median 3Q Max
## -30.98 -28.55 -22.67 11.07 79.55
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 53.652 13.783 3.893 0.003 **
## TX.VAL.FUEL.ZS.UN 12.463 9.351 1.333 0.212
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 42.58 on 10 degrees of freedom
## (52 observations effacées parce que manquantes)
## Multiple R-squared: 0.1509, Adjusted R-squared: 0.06594
## F-statistic: 1.776 on 1 and 10 DF, p-value: 0.2122