World_Bank_Indicators

Author

Thierry Norman

library(tidyverse)
library(stringr)
library(scales)
library(jsonlite)

# Load dataset
Global_Development_Indicators <- read_csv("R-DATA/project_1_Global_Development_Indicators.csv")

# World Bank country list from its API: aggregates have the region "Aggregates"
wb_countries <- fromJSON("https://api.worldbank.org/v2/country?format=json&per_page=400")
country_meta <- tibble(
  `Country Code` = wb_countries[[2]]$id,
  Region         = trimws(wb_countries[[2]]$region$value),
  IncomeGroup    = trimws(wb_countries[[2]]$incomeLevel$value)
)

real_countries <- country_meta %>%
  filter(Region != "Aggregates")

# Clean data: convert ".." to NA and numeric conversion
base_clean <- Global_Development_Indicators %>%
  mutate(across(starts_with("19") | starts_with("20"), ~ifelse(.x == "..", NA, as.numeric(.x))))

# Extract and reshape indicators
gdp_data <- base_clean %>%
  filter(`Series Name` == "GDP (current US$)") %>%
  select(`Country Name`, `Country Code`, starts_with("20")) %>%
  pivot_longer(cols = starts_with("20"), names_to = "Year", values_to = "GDP_total") %>%
  mutate(Year = as.numeric(str_extract(Year, "\\d{4}"))) %>%
  filter(!is.na(GDP_total))

pop_data <- base_clean %>%
  filter(`Series Name` == "Population, total") %>%
  select(`Country Name`, `Country Code`, starts_with("20")) %>%
  pivot_longer(cols = starts_with("20"), names_to = "Year", values_to = "Population") %>%
  mutate(Year = as.numeric(str_extract(Year, "\\d{4}"))) %>%
  filter(!is.na(Population))

internet_data <- base_clean %>%
  filter(`Series Name` == "Individuals using the Internet (% of population)") %>%
  select(`Country Name`, `Country Code`, starts_with("20")) %>%
  pivot_longer(cols = starts_with("20"), names_to = "Year", values_to = "Internet_users_pct") %>%
  mutate(Year = as.numeric(str_extract(Year, "\\d{4}"))) %>%
  filter(!is.na(Internet_users_pct))

education_data <- base_clean %>%
  filter(`Series Name` == "Adolescents out of school (% of lower secondary school age)") %>%
  select(`Country Name`, `Country Code`, starts_with("20")) %>%
  pivot_longer(cols = starts_with("20"), names_to = "Year", values_to = "Out_of_school_pct") %>%
  mutate(Year = as.numeric(str_extract(Year, "\\d{4}"))) %>%
  filter(!is.na(Out_of_school_pct))

# Combine datasets before any country filtering
combined <- gdp_data %>%
  left_join(pop_data, by = c("Country Name", "Country Code", "Year")) %>%
  mutate(GDP_per_capita = GDP_total / Population) %>%
  left_join(internet_data, by = c("Country Name", "Country Code", "Year")) %>%
  left_join(education_data, by = c("Country Name", "Country Code", "Year")) %>%
  filter(Year >= 2000)

# Keep only real economies by joining on country code (replaces the old name-based filter)
analysis_data <- combined %>%
  inner_join(real_countries, by = "Country Code") %>%
  select(`Country Name`, `Country Code`, Region, IncomeGroup, Year,
         GDP_per_capita, Internet_users_pct, Out_of_school_pct)

complete_countries <- analysis_data %>%
  filter(!is.na(GDP_per_capita), !is.na(Internet_users_pct)) %>%
  distinct(`Country Name`)

glimpse(analysis_data)
Rows: 1,148
Columns: 8
$ `Country Name`     <chr> "Afghanistan", "Afghanistan", "Afghanistan", "Afgha…
$ `Country Code`     <chr> "AFG", "AFG", "AFG", "AFG", "AFG", "AFG", "AFG", "A…
$ Region             <chr> "Middle East, North Africa, Afghanistan & Pakistan"…
$ IncomeGroup        <chr> "Low income", "Low income", "Low income", "Low inco…
$ Year               <dbl> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 200…
$ GDP_per_capita     <dbl> 180.1884, 142.9034, 182.1740, 199.6432, 221.8305, 2…
$ Internet_users_pct <dbl> NA, 0.004722568, 0.004561395, 0.087891253, 0.105809…
$ Out_of_school_pct  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…

1 Introduction

This project explores global development indicators from 2000 onwards.
We are particularly interested in understanding the relationship between economic development, digital access, and education across countries.

The main objectives of this analysis are:

  • Examine trends in GDP per capita and internet usage over time.
  • Understand how economic prosperity correlates with digital connectivity.
  • Identify countries that deviate from expected patterns, highlighting potential development gaps.
  • Provide insights into the evolution of key development indicators over the last two decades.

1.1 Data Cleaning and Preparation

The dataset was obtained from the World Bank Global Development Indicators service.

Steps undertaken for data preparation:

  • Converted all non-numeric entries to NA and converted years to numeric format.

  • Filtered for the indicators of interest: GDP, population, internet usage, and adolescents out of school.

  • Calculated GDP per capita using GDP and population data.

  • Filtered to include data from the year 2000 onward.

  • Excluded aggregates (e.g., World, East Asia & Pacific, OECD members) by keeping only economies in the World Bank’s country list (from its API), joined on country code.

Outcome:

  • The final dataset covers 48 countries from 2000 to 2023 (1148 country-years).

  • 48 countries have both GDP per capita and internet usage for at least one year.

  • GDP per capita is available for 100% of country-years and internet usage for 88.4%. Out-of-school data is far sparser (46.7%), so it is only used in the final check in section 4.

1.2 Data Quality Check: Country Filter

An earlier version of this analysis removed aggregates by matching words in country names. This check compares that approach with the metadata join used above.

Real countries the name filter removed: 1 
[1] "United Arab Emirates"

Kept by the name filter but not in the World Bank country list: 0 
character(0)

Insight: Matching on names is fragile: “Arab” also matches the United Arab Emirates. Joining on the World Bank’s country codes removes aggregates without dropping real countries.

2 Exploratory Data Analysis

2.0.1 3.1 Summary Statistics

[1] "Summary Statistics:"
 GDP_per_capita     Internet_users_pct 
 Min.   :   110.5   Min.   :4.561e-03  
 1st Qu.:  1405.5   1st Qu.:8.000e+00  
 Median :  6750.5   Median :3.550e+01  
 Mean   : 19644.5   Mean   :4.091e+01  
 3rd Qu.: 35832.2   3rd Qu.:7.325e+01  
 Max.   :240862.2   Max.   :1.000e+02  
                    NA's   :133        
[1] "Detailed Statistics:"
# A tibble: 1 × 14
  GDP_mean GDP_median GDP_sd GDP_min GDP_max Internet_mean Internet_median
     <dbl>      <dbl>  <dbl>   <dbl>   <dbl>         <dbl>           <dbl>
1   19645.      6750. 29077.    110. 240862.          40.9            35.5
# ℹ 7 more variables: Internet_sd <dbl>, Internet_min <dbl>,
#   Internet_max <dbl>, total_observations <int>, gdp_available <int>,
#   internet_available <int>, both_available <int>

Insight: GDP per capita is skewed with a few very high-income countries. Internet usage shows a wide spread with gradual global adoption.

2.0.2 3.2 Data Availability by Year

[1] "Data Availability by Year:"
# A tibble: 24 × 5
    Year countries gdp_available internet_available both_available
   <dbl>     <int>         <int>              <int>          <int>
 1  2000        48            48                 45             45
 2  2001        48            48                 47             47
 3  2002        48            48                 48             48
 4  2003        48            48                 47             47
 5  2004        48            48                 47             47
 6  2005        48            48                 45             45
 7  2006        48            48                 44             44
 8  2007        48            48                 47             47
 9  2008        48            48                 46             46
10  2009        48            48                 45             45
# ℹ 14 more rows

Insight: Data availability improves after 2005, allowing reliable comparisons across countries.

2.0.3 3.3 Correlation Analysis

Correlation between GDP per capita and Internet usage: 0.648 
Correlation between log GDP per capita and Internet usage: 0.838 

Insight: The correlation is 0.648 on raw GDP per capita and 0.838 on log GDP per capita. The log version matches the log-scale charts below, so it better describes the relationship they show.

2.0.4 3.4 Visualizations

2.0.4.1 3.4.1 GDP per Capita Distribution

Insight: Most countries cluster at lower GDP levels; a few countries are extreme high-income outliers.

2.0.4.2 3.4.2 Internet Usage Distribution

Insight: Internet usage varies widely; adoption has increased over time, especially in developing countries.

2.0.4.3 3.4.3 GDP vs Internet Usage Scatter Plot

`geom_smooth()` using formula = 'y ~ x'

Insight: Positive trend confirms richer countries generally have higher internet penetration, with some notable outliers.

2.0.4.4 3.4.4 Time Series Analysis of Global Internet Usage

Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.

Insight: Internet usage has steadily increased globally, reflecting digital adoption trends across nations.

2.0.4.5 3.4.5 Internet Access by World Bank Income Group

Insight: Higher income groups consistently have higher internet usage; some low-income countries outperform expectations. Income groups are the World Bank’s current classification, applied to every year.

2.0.4.6 3.5 Outlier Analysis

[1] "Countries with High GDP but Low Internet Usage:"
# A tibble: 52 × 4
   `Country Name`        Year GDP_per_capita Internet_users_pct
   <chr>                <dbl>          <dbl>              <dbl>
 1 Monaco                2003        111310.               49.5
 2 Monaco                2002         90152.               48.0
 3 Monaco                2001         82410.               46.6
 4 Monaco                2000         81764.               42.2
 5 San Marino            2011         55815.               49.6
 6 United Arab Emirates  2005         42191.               40  
 7 Italy                 2008         40945.               44.5
 8 Japan                 2000         39169.               30.0
 9 Italy                 2007         37871.               40.8
10 San Marino            2000         37474.               48.8
# ℹ 42 more rows
[1] "Countries with Low GDP but High Internet Usage:"
# A tibble: 25 × 4
   `Country Name`  Year GDP_per_capita Internet_users_pct
   <chr>          <dbl>          <dbl>              <dbl>
 1 Fiji            2021          4656.               87.7
 2 Fiji            2020          4816.               84.9
 3 Ukraine         2021          4556.               79.2
 4 Uzbekistan      2021          1993.               76.6
 5 Ukraine         2020          3543.               75.0
 6 Uzbekistan      2020          1759.               71.1
 7 Algeria         2021          4216.               70.8
 8 Uzbekistan      2019          1795.               70.4
 9 Ukraine         2019          3460.               70.1
10 Indonesia       2022          4788.               66.5
# ℹ 15 more rows

Insight: Outliers suggest countries with unique economic or technological circumstances; these may be of interest for further study. Thresholds are in current US dollars, so they are not adjusted for inflation.

2.0.4.8 3.7 Key Insights Summary


=== KEY INSIGHTS FROM EXPLORATORY ANALYSIS ===
1. Data Coverage: 1148 total observations
2. GDP-Internet Correlation: 0.648 (log GDP: 0.838 )
3. Countries with complete data: 48 
4. Year range: 2000 to 2023 
5. Average global internet usage has strong correlation with economic development

Summary:

  • Economic development strongly correlates with digital access.

  • Global internet adoption is steadily increasing.

  • Outliers and trends provide insight into countries that perform above or below expectations.

2.0.4.9 3.8 Internet Usage and Adolescents Out of School

Country-years with both values: 513 
Countries: 41 
Correlation between internet usage and out-of-school rate: -0.593 

3 Key Insights and Implications

  1. Economic and Digital Development: Wealthier countries generally have better internet access, confirming the strong correlation between GDP per capita and digital infrastructure.

  2. Global Trends: Internet adoption has increased globally, with notable improvements in developing regions over the last decade.

  3. Outliers: Some countries deviate from expected patterns, providing opportunities for targeted policy interventions or further research.

  4. Education and Development: Across 513 country-years with both values, the correlation between internet usage and the share of adolescents out of school is -0.593. Out-of-school data is sparse, so this is indicative only.

Limitations:

  • Missing data for some countries, especially in early years, may bias trends.

  • Indicators are national averages and may mask regional disparities.

  • GDP is in current US dollars, so comparisons over time are not inflation-adjusted.

  • Averages weight every country equally, regardless of population.

Future Research:

  • Examine subnational data to capture regional inequalities.

  • Explore causal relationships between GDP growth and digital adoption.

  • Investigate other indicators such as life expectancy, literacy, or healthcare access in conjunction with digital access.