Dünya bankasından veri indirmek

library(WDI)

SE.PRM.UNER.MA “okula gitmeyen çocuklar,ılkokul,erkek SE.XPD.TOTL.GB.ZS”Eğitime yönelik kamu harcamaları, toplam (kamu harcamalarının yüzdesi)”

data <-  WDI(indicator= c("SE.PRM.UNER.MA","SE.XPD.TOTL.GB.ZS"))

kesit veri

2002

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
data2002 <- data %>% filter(year==2002)

zaman serisi

dataID <- data %>% filter(country=="Indonesia")
library(ggplot2)
ggplot(dataID,aes(year,SE.PRM.UNER.MA)) +geom_line()
## Warning: Removed 16 rows containing missing values or values outside the scale range
## (`geom_line()`).

ggplot(dataID,aes(year,SE.XPD.TOTL.GB.ZS)) +geom_line()
## Warning: Removed 49 rows containing missing values or values outside the scale range
## (`geom_line()`).

## Rgresyon

model <- lm(SE.PRM.UNER.MA ~ SE.XPD.TOTL.GB.ZS, data = dataID)
summary(model)
## 
## Call:
## lm(formula = SE.PRM.UNER.MA ~ SE.XPD.TOTL.GB.ZS, data = dataID)
## 
## Residuals:
##      49      54      55      57      58      59 
##  -71033 -167707 -107039  -99120  108144  336755 
## attr(,"label")
## [1] "Children out of school, primary, male"
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)
## (Intercept)        -134308     515111  -0.261    0.807
## SE.XPD.TOTL.GB.ZS    28178      31027   0.908    0.415
## 
## Residual standard error: 211900 on 4 degrees of freedom
##   (58 observations effacées parce que manquantes)
## Multiple R-squared:  0.1709, Adjusted R-squared:  -0.03632 
## F-statistic: 0.8247 on 1 and 4 DF,  p-value: 0.4152