library(WDI)
SE.ADT.1524.LT.ZS SL.TLF.TOTL.IN
data <- WDI(indicator= c("SE.ADT.1524.LT.ZS","SL.TLF.TOTL.IN"))
2005
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
data2005 <- data %>% filter(year==2005)
dataTR <- data %>% filter(country=="Turkiye")
library(ggplot2)
ggplot(dataTR, aes(year, SL.TLF.TOTL.IN)) + geom_line()
## Warning: Removed 31 rows containing missing values or values outside the scale range
## (`geom_line()`).
ggplot(dataTR, aes(year, SE.ADT.1524.LT.ZS)) + geom_line()
## Warning: Removed 19 rows containing missing values or values outside the scale range
## (`geom_line()`).
model <- lm(SL.TLF.TOTL.IN ~ SE.ADT.1524.LT.ZS, data = dataTR)
summary(model)
##
## Call:
## lm(formula = SL.TLF.TOTL.IN ~ SE.ADT.1524.LT.ZS, data = dataTR)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1467524 -1162009 176552 734572 2241757
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -199565559 21723133 -9.187 8.88e-07 ***
## SE.ADT.1524.LT.ZS 2307873 221094 10.438 2.25e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1231000 on 12 degrees of freedom
## (50 observations deleted due to missingness)
## Multiple R-squared: 0.9008, Adjusted R-squared: 0.8925
## F-statistic: 109 on 1 and 12 DF, p-value: 2.248e-07