Dünya bankasından veri indirmek

library(WDI)

AG.LND.AGRI.ZS “Tarım arazisi (arazi alanının yüzdesi)” TX.VAL.FUEL.ZS.UN “Yakıt ihracatı (mal ihracatının yüzdesi)”

data <- WDI(indicator = c("AG.LND.AGRI.ZS","TX.VAL.FUEL.ZS.UN"))

Kesit veri

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)
dataTC <- data %>% filter(country=="Chad")
library(ggplot2)
ggplot(dataTC,aes(year,AG.LND.AGRI.ZS)) +geom_line()
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_line()`).

ggplot(dataTC,aes(year,AG.LND.AGRI.ZS)) +geom_point()
## Warning: Removed 3 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(AG.LND.AGRI.ZS))
data2000 <- data2000 %>% aes(!is.na(TX.VAL.FUEL.ZS.UN))
library(ggplot2)
ggplot(data, aes(AG.LND.AGRI.ZS)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2310 rows containing non-finite outside the scale range
## (`stat_bin()`).

ggplot(dataTC,aes(year,TX.VAL.FUEL.ZS.UN)) +geom_line()
## Warning: Removed 50 rows containing missing values or values outside the scale range
## (`geom_line()`).

ggplot(dataTC,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()`).

Regresyon

model <- lm(AG.LND.AGRI.ZS ~ TX.VAL.FUEL.ZS.UN, data = dataTC)
summary(model)
## 
## Call:
## lm(formula = AG.LND.AGRI.ZS ~ TX.VAL.FUEL.ZS.UN, data = dataTC)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.027010 -0.009575 -0.000045  0.001834  0.077740 
## 
## Coefficients:
##                    Estimate Std. Error  t value Pr(>|t|)    
## (Intercept)       38.013957   0.009103 4175.953   <2e-16 ***
## TX.VAL.FUEL.ZS.UN  0.003493   0.001787    1.955   0.0743 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.02537 on 12 degrees of freedom
##   (50 observations effacées parce que manquantes)
## Multiple R-squared:  0.2416, Adjusted R-squared:  0.1784 
## F-statistic: 3.823 on 1 and 12 DF,  p-value: 0.07426