INTRODUCTION

Motivation for Choosing the Topic and Question:

The ubiquitous phenomenon of globalization has transformed economies, communities, and political landscapes across the globe. The question of “How does globalization influence economic development across different countries and regions?” was chosen because it is vital to comprehend the complex dynamics and diverse effects of globalization. Analyzing how these elements support or obstruct economic development in many contexts is crucial as cross-border cooperation, international trade, and investment flows increase.

The contemporary period, where governmental changes and technological breakthroughs continue to enhance the interconnection of global economies, makes this topic especially pertinent. Comprehending the complex influences of globalization on economic growth might yield significant perspectives for decision-makers, enterprises, and institutional investigators. This information is essential for developing policies that minimize the possible drawbacks of globalization, such as economic inequality and cultural homogenization, while maximizing its positive aspects.

Novelty and Importance of the Question:

The unique aspect of this subject is how thoroughly it examines how globalization affects economic development by analyzing trade patterns and trade balances between various nations and regions. This study attempts to get deeper into particular economic measures, such as GDP per capita, exports, and imports as a percentage of GDP, despite the abundance of literature on the general effects of globalization. This study uses sophisticated data analytics and visualization methods to hunt for patterns and connections that are frequently missed in larger investigations.

It is impossible to exaggerate the significance of this question. It is critical for nations to comprehend how globalization impacts their economy as they work toward sustainable growth and development. Through evidence-based insights that guide policy decisions, this research can assist nations in navigating the challenges of global economic integration. Furthermore, this study can support more inclusive and equitable economic policies that guarantee the advantages of globalization are distributed more widely by emphasizing the disparate effects of globalization on different locations.

Data collection

We used The Gapminder website (https://www.gapminder.org/data/) to get the the data sets in xlsx format required for this study, which included GDP per capita (gdp_pcap) and exports as % of GDP (exports_percent_of_gdp), imports as % of GDP (imports_percent_of_gdp). The variables that were retrieved offer a thorough understanding of each nation’s economic indicators, which is essential for examining trade trends and economic growth.

Data cleaning

We cleaned the data manually as we only selected the countries which had the data from the year 1971 to 2021 as this is the time period that we had opted to study. On this basis we shortlisted 32 countries which we used for the analysis.

The cleaned data sets are as follows: GDP per capita - gdp_pcap_required exports as % of GDP - export_percent_of_gdp_required imports_percent_of_gdp - imports_percent_of_gdp_required

1. Importing the exports as % of GDP (export_percent_of_gdp_required) data and pivoting it from wide to long

# Set CRAN mirror
options(repos = c(CRAN = "https://cran.rstudio.com"))

# Install the required package
install.packages("openxlsx")
## Installing package into 'C:/Users/shalk/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## package 'openxlsx' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'openxlsx'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying
## C:\Users\shalk\AppData\Local\R\win-library\4.4\00LOCK\openxlsx\libs\x64\openxlsx.dll
## to
## C:\Users\shalk\AppData\Local\R\win-library\4.4\openxlsx\libs\x64\openxlsx.dll:
## Permission denied
## Warning: restored 'openxlsx'
## 
## The downloaded binary packages are in
##  C:\Users\shalk\AppData\Local\Temp\Rtmpu4cwTy\downloaded_packages
# Load required packages
library(readxl)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
library(openxlsx)

# Load the dataset
file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/export_percent_of_gdp_required.xlsx"
data <- read_excel(file_path)

# View the structure of the dataset
str(data)
## tibble [32 × 64] (S3: tbl_df/tbl/data.frame)
##  $ country: chr [1:32] "Argentina" "Australia" "Bangladesh" "Bolivia" ...
##  $ 1960   : num [1:32] 7.6 13 10 16.2 6.28 26.3 23.3 NA 13.1 4.31 ...
##  $ 1961   : num [1:32] 5.99 12.4 10.8 16.4 6.42 27.2 26.5 17.6 11.4 3.87 ...
##  $ 1962   : num [1:32] 4.69 13.9 10.7 15.1 4.01 27.9 24.6 17.6 11.4 4.05 ...
##  $ 1963   : num [1:32] 7.89 13 9.98 17 8.93 29 25.2 18 12.3 4.01 ...
##  $ 1964   : num [1:32] 5.56 14.9 10 20.3 6.46 28.8 28.4 19 12.2 3.77 ...
##  $ 1965   : num [1:32] 6.23 13.2 9.66 21.5 7.5 31.7 27.1 18.3 13.3 3.64 ...
##  $ 1966   : num [1:32] 6.65 12.9 10.3 21.3 6.53 29.3 28.4 19.1 14.3 3.49 ...
##  $ 1967   : num [1:32] 7.5 12.9 9.31 22.5 5.68 24.6 26.3 20 14 3.28 ...
##  $ 1968   : num [1:32] 6.48 12.3 8.33 19.8 5.99 23.1 34.3 20.9 13.7 3.3 ...
##  $ 1969   : num [1:32] 6.4 11.9 8.15 20.4 6.67 22.8 27.3 20.9 16.1 3.05 ...
##  $ 1970   : num [1:32] 5.6 13 8.31 24.6 7.03 24.7 31.9 21.8 14.4 2.49 ...
##  $ 1971   : num [1:32] 6.01 12.6 6.29 21.4 6.46 33.1 29.8 21 10.8 2.79 ...
##  $ 1972   : num [1:32] 7.2 12.8 5.67 21.1 7.27 37.4 24.9 21.2 9.56 3.25 ...
##  $ 1973   : num [1:32] 7.61 14.1 6.54 27.7 7.84 38.8 28.6 22.7 13.3 4.24 ...
##  $ 1974   : num [1:32] 6.9 13.1 3.7 35.3 7.67 40.9 27.7 24 19.5 4.93 ...
##  $ 1975   : num [1:32] 5.82 14.3 2.9 25.9 7.22 43.6 21.1 22 24.1 4.7 ...
##  $ 1976   : num [1:32] 9.18 13.5 4.75 27.7 7.01 50.4 22.2 21.7 23.9 4.51 ...
##  $ 1977   : num [1:32] 9.62 14 7.04 26.8 7.25 50.9 25.2 22.7 19.7 4.3 ...
##  $ 1978   : num [1:32] 8.61 13.6 5.56 22.6 6.69 52.1 23.4 24.5 19.8 4.56 ...
##  $ 1979   : num [1:32] 6.51 14.3 6.11 24.2 7.24 54.1 22.4 26.3 22.1 5.16 ...
##  $ 1980   : num [1:32] 5.06 16.4 5.49 24.5 8.96 53.1 25.2 27.5 21.7 5.91 ...
##  $ 1981   : num [1:32] 6.92 14.9 5.13 23.3 9.62 49.7 24.4 26.4 15.5 7.45 ...
##  $ 1982   : num [1:32] 9.09 13.5 5.08 29.1 7.9 54.6 22.2 25.2 18.6 7.96 ...
##  $ 1983   : num [1:32] 9.15 13.6 5.6 28.3 12.2 62.1 24.1 24.9 23.4 7.2 ...
##  $ 1984   : num [1:32] 7.59 13.6 3.4 23.7 15 60.8 23.4 27.9 22.8 7.89 ...
##  $ 1985   : num [1:32] 11.7 15.2 5.38 19 12.9 66.3 22 27.5 26.3 8.33 ...
##  $ 1986   : num [1:32] 8.16 15 5.18 21.3 9.22 68.3 18.2 27 27.3 8.72 ...
##  $ 1987   : num [1:32] 7.87 15.5 4.99 19.6 9.83 75.1 17.8 26 28.3 10.4 ...
##  $ 1988   : num [1:32] 9.53 16 5.43 18.8 11.7 70.5 17.7 26.1 32.5 11 ...
##  $ 1989   : num [1:32] 13.1 15.1 5.54 22.5 8.93 59.2 20.3 25 33.7 9.03 ...
##  $ 1990   : num [1:32] 10.4 15.1 5.91 22.8 8.2 55.1 17.1 25.1 32.5 12.5 ...
##  $ 1991   : num [1:32] 7.68 16 6.66 21.5 8.68 53 17.6 24.4 31.3 13.4 ...
##  $ 1992   : num [1:32] 6.6 16.7 7.59 20 10.9 48.2 16.9 26.2 29 13.6 ...
##  $ 1993   : num [1:32] 6.91 17.5 9.02 19.1 10.5 47.1 17.1 29.1 25.9 12 ...
##  $ 1994   : num [1:32] 7.53 18 9 21.7 9.51 47.8 23.4 32.8 27.5 18.5 ...
##  $ 1995   : num [1:32] 9.68 17.9 10.9 22.6 7.53 50.8 22.2 36.1 28.6 18 ...
##  $ 1996   : num [1:32] 10.4 18.9 9.71 22.6 6.73 53.8 21.5 37.1 26 17.9 ...
##  $ 1997   : num [1:32] 10.6 19.1 10.5 21.1 6.98 60.9 26.9 38.1 25.9 19.5 ...
##  $ 1998   : num [1:32] 10.4 19.6 11.8 19.7 7.03 49.3 22.7 40 25.1 18.3 ...
##  $ 1999   : num [1:32] 9.83 18.3 11.8 16.9 9.56 55.2 19.2 41.9 28.3 18.2 ...
##  $ 2000   : num [1:32] 11 19.4 12.3 18.3 10.2 51.8 20.4 44.2 30.1 20.9 ...
##  $ 2001   : num [1:32] 11.6 22.2 13.4 20 12.4 48.7 17.2 42 31.8 20.3 ...
##  $ 2002   : num [1:32] 28.4 20.7 12.4 21.6 14.2 52.2 16 40.1 32.3 22.6 ...
##  $ 2003   : num [1:32] 25.9 19.1 11.4 25.6 15.2 48.8 18.2 36.9 35.1 27 ...
##  $ 2004   : num [1:32] 23.8 17.2 11.1 31.1 16.5 49.6 14 37.3 39.7 31.1 ...
##  $ 2005   : num [1:32] 23.2 18.2 14.4 35.5 15.2 52.9 13.4 36.9 40.2 33.8 ...
##  $ 2006   : num [1:32] 23 19.9 16.4 41.8 14.4 51.8 14.3 35.4 43.9 36 ...
##  $ 2007   : num [1:32] 22.7 20.2 17 41.8 13.3 56.5 14.1 34.2 45.1 35.4 ...
##  $ 2008   : num [1:32] 22.1 20.1 17.7 44.9 13.5 46.9 11 34.4 41.2 32.6 ...
##  $ 2009   : num [1:32] 19.6 23 16.9 35.7 10.9 35.8 9.84 28.5 37.1 24.7 ...
##  $ 2010   : num [1:32] 18.9 19.8 16 41.2 10.9 42.1 11.6 29.2 37.9 27.2 ...
##  $ 2011   : num [1:32] 18.4 21.4 19.9 44.1 11.6 44.2 13.1 30.7 37.7 26.6 ...
##  $ 2012   : num [1:32] 16.2 21.5 20.2 47.2 11.9 48.1 11.6 30.4 33.8 25.5 ...
##  $ 2013   : num [1:32] 14.6 20 19.5 44.1 11.7 61.4 15 30.3 32.1 24.6 ...
##  $ 2014   : num [1:32] 14.4 21.1 19 43.3 11 61.3 16.7 31.7 33 23.5 ...
##  $ 2015   : num [1:32] 10.7 20.1 17.3 30.9 12.9 53.1 17.1 31.8 29.2 21.4 ...
##  $ 2016   : num [1:32] 12.5 19.3 13.9 24.5 12.5 54.6 14.8 31.5 27.9 19.6 ...
##  $ 2017   : num [1:32] 11.3 21.2 12.8 24.9 12.5 42.9 17.3 31.5 28.3 19.7 ...
##  $ 2018   : num [1:32] 14.4 21.9 12.7 26 14.6 44.2 15.9 32.3 28.5 19.1 ...
##  $ 2019   : num [1:32] 17.9 24.1 13.1 25 14.1 37.1 15.8 32.4 27.8 18.4 ...
##  $ 2020   : num [1:32] 16.6 24 10.4 20.3 16.5 31.3 15.2 29.7 31.3 18.6 ...
##  $ 2021   : num [1:32] 18 22 10.7 27.8 19.6 41.9 13.2 30.9 32 19.9 ...
##  $ 2022   : num [1:32] 16.3 25.4 12.9 32.6 20 43.5 12.3 33.8 35.7 20.7 ...
# Clean and transform the data
cleaned_data <- data %>%
  pivot_longer(cols = -country, names_to = "Year", values_to = "Exports_Percent_GDP") %>%
  mutate(
    Year = as.integer(Year),# Ensure 'Year' column is numeric
    Exports_Percent_GDP = as.numeric(Exports_Percent_GDP)
  )

# Write the cleaned data to a new Excel file
output_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/CD_exports_percent_of_gdp_data_required.xlsx"
write.xlsx(cleaned_data, output_path)

# Print the cleaned data to verify
print(cleaned_data)
## # A tibble: 2,016 × 3
##    country    Year Exports_Percent_GDP
##    <chr>     <int>               <dbl>
##  1 Argentina  1960                7.6 
##  2 Argentina  1961                5.99
##  3 Argentina  1962                4.69
##  4 Argentina  1963                7.89
##  5 Argentina  1964                5.56
##  6 Argentina  1965                6.23
##  7 Argentina  1966                6.65
##  8 Argentina  1967                7.5 
##  9 Argentina  1968                6.48
## 10 Argentina  1969                6.4 
## # ℹ 2,006 more rows

2. Importing the GDP per capita (gdp_pcap_required) data and cleaning it

Handling “k” Values in GDP data

When the GDP per capita (gdp_pcap) data was viewed, it was observed that certain values contained “k” denoting the numeric value “1000”. So, the GDP per capita (gdp_pcap) data was imported and cleaned to convert values containing “k” to numeric values which was done by removing “k” and instead multiply these data by 1000. This step ensures consistency in the data format for accurate analysis. The cleaned data was then saved as a new data set (changed_gdp_pcap_required)

# Load necessary library
library(readxl)
library(openxlsx)

# Define the file path
file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/gdp_pcap_required.xlsx"

# Load the dataset
df <- read_excel(file_path)

# Function to convert 'k' values to numeric
convert_k_to_numeric <- function(value) {
  if (is.character(value) && grepl("k", value)) {
    return(as.numeric(gsub("k", "", value)) * 1000)
  }
  return(value)
}

# Apply the conversion function to the entire DataFrame
df <- as.data.frame(lapply(df, function(col) sapply(col, convert_k_to_numeric)))
## Warning in FUN(X[[i]], ...): NAs introduced by coercion
# Define the output file path
output_file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/changed_gdp_pcap_required.xlsx"

# Save the updated DataFrame to a new Excel file
write.xlsx(df, output_file_path)

3. Importing the cleaned GDP per capita data (changed_gdp_pcap_required) and pivoting it from wide to long

# Install the required package if not already installed
if(!require(openxlsx)) install.packages("openxlsx")

# Load required packages
library(readxl)
library(dplyr)
library(tidyr)
library(openxlsx)

# Load the dataset
file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/changed_gdp_pcap_required.xlsx"
data <- read_excel(file_path)

# View the structure of the dataset
str(data)
## tibble [32 × 302] (S3: tbl_df/tbl/data.frame)
##  $ country: chr [1:32] "Argentina" "Australia" "Bangladesh" "Bolivia" ...
##  $ X1800  : num [1:32] 2120 1020 962 1150 1240 447 610 1760 1220 1320 ...
##  $ X1801  : num [1:32] 2120 1030 962 1150 1240 448 610 1770 1220 1320 ...
##  $ X1802  : num [1:32] 2130 1030 962 1150 1240 449 610 1790 1220 1310 ...
##  $ X1803  : num [1:32] 2140 1040 962 1150 1240 451 610 1800 1220 1310 ...
##  $ X1804  : num [1:32] 2150 1050 962 1150 1240 452 610 1810 1220 1310 ...
##  $ X1805  : num [1:32] 2150 1050 962 1150 1240 453 610 1820 1220 1300 ...
##  $ X1806  : num [1:32] 2160 1060 962 1150 1240 455 610 1830 1220 1300 ...
##  $ X1807  : num [1:32] 2170 1060 962 1150 1240 456 611 1840 1220 1300 ...
##  $ X1808  : num [1:32] 2180 1070 962 1160 1240 457 611 1860 1220 1290 ...
##  $ X1809  : num [1:32] 2180 1080 960 1160 1240 459 611 1870 1220 1290 ...
##  $ X1810  : num [1:32] 2190 1080 960 1160 1240 460 611 1880 1220 1290 ...
##  $ X1811  : num [1:32] 2200 1090 960 1160 1240 461 611 1900 1160 1280 ...
##  $ X1812  : num [1:32] 2210 1090 960 1160 1240 463 611 1910 1140 1280 ...
##  $ X1813  : num [1:32] 2220 1100 960 1160 1240 464 611 1930 1150 1280 ...
##  $ X1814  : num [1:32] 2220 1110 960 1160 1240 465 611 1950 1160 1270 ...
##  $ X1815  : num [1:32] 2230 1110 960 1160 1240 467 611 1970 1160 1270 ...
##  $ X1816  : num [1:32] 2240 1120 960 1160 1240 468 611 1980 1130 1270 ...
##  $ X1817  : num [1:32] 2250 1130 960 1160 1240 470 611 2000 1110 1270 ...
##  $ X1818  : num [1:32] 2250 1130 960 1170 1240 471 611 2020 1170 1260 ...
##  $ X1819  : num [1:32] 2260 1140 960 1170 1240 472 611 2040 1120 1260 ...
##  $ X1820  : num [1:32] 2270 1180 959 1180 1240 474 611 2060 1180 1260 ...
##  $ X1821  : num [1:32] 2290 1190 960 1190 1240 475 614 2080 1150 1250 ...
##  $ X1822  : num [1:32] 2300 1220 960 1210 1240 477 617 2100 1180 1250 ...
##  $ X1823  : num [1:32] 2320 1260 960 1230 1240 478 621 2120 1140 1240 ...
##  $ X1824  : num [1:32] 2340 1340 960 1250 1240 480 624 2140 1120 1240 ...
##  $ X1825  : num [1:32] 2360 1400 960 1260 1240 481 627 2160 1220 1230 ...
##  $ X1826  : num [1:32] 2370 1430 960 1280 1240 482 630 2180 1260 1230 ...
##  $ X1827  : num [1:32] 2390 1470 960 1300 1240 484 633 2210 1290 1220 ...
##  $ X1828  : num [1:32] 2410 1510 960 1320 1240 485 635 2230 1300 1220 ...
##  $ X1829  : num [1:32] 2430 1590 962 1340 1240 487 638 2250 1330 1210 ...
##  $ X1830  : num [1:32] 2450 1930 962 1360 1240 488 641 2270 1320 1210 ...
##  $ X1831  : num [1:32] 2470 1990 962 1370 1240 490 645 2310 1330 1210 ...
##  $ X1832  : num [1:32] 2480 2040 962 1390 1240 491 648 2340 1360 1210 ...
##  $ X1833  : num [1:32] 2500 2050 962 1410 1240 493 651 2380 1370 1210 ...
##  $ X1834  : num [1:32] 2520 2150 962 1430 1240 494 654 2410 1400 1210 ...
##  $ X1835  : num [1:32] 2540 2600 962 1450 1240 495 657 2450 1430 1210 ...
##  $ X1836  : num [1:32] 2560 2560 962 1470 1240 497 661 2490 1410 1210 ...
##  $ X1837  : num [1:32] 2580 2680 963 1490 1240 498 664 2530 1470 1210 ...
##  $ X1838  : num [1:32] 2600 2650 963 1510 1240 500 667 2560 1470 1210 ...
##  $ X1839  : num [1:32] 2620 2470 963 1530 1240 501 670 2600 1460 1210 ...
##  $ X1840  : num [1:32] 2640 3120 963 1560 1240 503 673 2640 1540 1210 ...
##  $ X1841  : num [1:32] 2660 2660 963 1580 1240 504 677 2680 1540 1210 ...
##  $ X1842  : num [1:32] 2680 2430 963 1600 1240 506 680 2710 1550 1210 ...
##  $ X1843  : num [1:32] 2700 2820 963 1620 1240 507 683 2750 1580 1210 ...
##  $ X1844  : num [1:32] 2720 3200 963 1640 1240 509 687 2790 1590 1220 ...
##  $ X1845  : num [1:32] 2740 3300 964 1670 1240 510 690 2830 1630 1220 ...
##  $ X1846  : num [1:32] 2760 3640 964 1690 1240 512 693 2870 1670 1220 ...
##  $ X1847  : num [1:32] 2780 4210 964 1690 1240 514 697 2900 1690 1220 ...
##  $ X1848  : num [1:32] 2800 4820 964 1700 1240 515 700 2940 1750 1220 ...
##  $ X1849  : num [1:32] 2820 4760 964 1710 1240 517 703 2980 1850 1220 ...
##  $ X1850  : num [1:32] 2840 4490 964 1710 1240 518 707 3020 1930 1220 ...
##  $ X1851  : num [1:32] 2870 5330 964 1720 1320 520 710 3050 1990 1230 ...
##  $ X1852  : num [1:32] 2890 6250 964 1720 1290 521 713 3080 2000 1240 ...
##  $ X1853  : num [1:32] 2910 6840 965 1730 1210 523 717 3100 1950 1240 ...
##  $ X1854  : num [1:32] 2940 5990 965 1730 1170 524 720 3130 1980 1250 ...
##  $ X1855  : num [1:32] 2960 5690 965 1740 1180 526 725 3160 2030 1250 ...
##  $ X1856  : num [1:32] 2980 6940 965 1740 1220 527 727 3190 2040 1260 ...
##  $ X1857  : num [1:32] 3010 6130 965 1750 1310 529 732 3210 2090 1270 ...
##  $ X1858  : num [1:32] 3030 5220 965 1750 1390 531 735 3240 2160 1270 ...
##  $ X1859  : num [1:32] 3060 6740 965 1760 1380 532 737 3270 2220 1280 ...
##  $ X1860  : num [1:32] 3080 6580 966 1770 1410 534 742 3300 2270 1280 ...
##  $ X1861  : num [1:32] 3110 6480 966 1770 1400 535 745 3350 2250 1290 ...
##  $ X1862  : num [1:32] 3130 6230 966 1780 1340 537 749 3400 2220 1300 ...
##  $ X1863  : num [1:32] 3160 6210 966 1780 1360 539 752 3460 2280 1300 ...
##  $ X1864  : num [1:32] 3180 6580 966 1790 1390 540 756 3510 2380 1310 ...
##  $ X1865  : num [1:32] 3210 6280 966 1790 1490 542 760 3570 2440 1320 ...
##  $ X1866  : num [1:32] 3230 6470 966 1800 1540 543 763 3620 2500 1320 ...
##  $ X1867  : num [1:32] 3260 7070 967 1810 1670 545 768 3680 2380 1330 ...
##  $ X1868  : num [1:32] 3290 7180 967 1810 1670 547 771 3740 2450 1340 ...
##  $ X1869  : num [1:32] 3310 7040 967 1820 1670 548 775 3800 2640 1340 ...
##  $ X1870  : num [1:32] 3340 7440 967 1820 1550 550 778 3850 2660 1350 ...
##  $ X1871  : num [1:32] 3410 7500 969 1830 1550 552 782 3990 2620 1350 ...
##  $ X1872  : num [1:32] 3490 8080 971 1830 1600 553 786 3880 2720 1340 ...
##  $ X1873  : num [1:32] 3560 8690 974 1840 1550 555 789 4190 2890 1340 ...
##  $ X1874  : num [1:32] 3640 8720 977 1850 1580 556 794 4220 2790 1340 ...
##  $ X1875  : num [1:32] 3720 9410 979 1850 1600 558 798 4060 2920 1330 ...
##  $ X1876  : num [1:32] 3720 9110 981 1860 1540 560 801 3730 2840 1330 ...
##  $ X1877  : num [1:32] 4020 9180 983 1860 1500 561 805 3930 2720 1330 ...
##  $ X1878  : num [1:32] 3740 9720 986 1870 1570 563 809 3720 2790 1330 ...
##  $ X1879  : num [1:32] 3800 9560 989 1880 1580 565 812 4010 3170 1320 ...
##  $ X1880  : num [1:32] 3650 9740 991 1880 1510 566 817 4130 3450 1320 ...
##  $ X1881  : chr [1:32] "3620" "10100" "993" "1890" ...
##  $ X1882  : num [1:32] 4430 9240 996 1890 1560 570 825 4800 3840 1310 ...
##  $ X1883  : chr [1:32] "4810" "10200" "998" "1900" ...
##  $ X1884  : num [1:32] 4970 9790 1000 1900 1620 573 832 5070 3860 1310 ...
##  $ X1885  : chr [1:32] "5570" "10100" "1030" "1910" ...
##  $ X1886  : num [1:32] 5380 9840 996 1920 1550 577 841 4720 3740 1300 ...
##  $ X1887  : chr [1:32] "5480" "10500" "1040" "1920" ...
##  $ X1888  : chr [1:32] "6020" "10200" "1050" "1930" ...
##  $ X1889  : chr [1:32] "6120" "10800" "1020" "1940" ...
##  $ X1890  : chr [1:32] "5490" "10100" "1060" "1940" ...
##  $ X1891  : chr [1:32] "5180" "10600" "964" "1960" ...
##  $ X1892  : chr [1:32] "6060" "9080" "1040" "1980" ...
##  $ X1893  : num [1:32] 6290 8430 1060 1980 1210 589 870 5310 4400 1380 ...
##  $ X1894  : num [1:32] 7090 8560 1080 2060 1210 591 874 5500 4250 1380 ...
##  $ X1895  : chr [1:32] "7680" "7930" "1050" "2060" ...
##  $ X1896  : num [1:32] 8150 8380 971 1930 1310 594 883 5200 4820 1380 ...
##  $ X1897  : chr [1:32] "6420" "7780" "1150" "1970" ...
##   [list output truncated]
# Convert all columns except 'country' to character
data <- data %>%
  mutate(across(-country, as.character))

# Clean and transform the data
cleaned_data <- data %>%
  pivot_longer(cols = -country, names_to = "Year", values_to = "GDP_Per_Capita") %>%
  mutate(
    Year = gsub("[^0-9]", "", Year),  # Remove non-numeric characters
    Year = as.integer(Year),# Ensure 'Year' column is numeric
    GDP_Per_Capita = as.integer(GDP_Per_Capita)
  ) %>%
  filter(!is.na(Year))  # Remove rows with NA years

# Write the cleaned data to a new Excel file
output_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/CD_gdp_pcap_data_required.xlsx"
write.xlsx(cleaned_data, output_path)

# Print the cleaned data to verify
print(cleaned_data)
## # A tibble: 9,632 × 3
##    country    Year GDP_Per_Capita
##    <chr>     <int>          <int>
##  1 Argentina  1800           2120
##  2 Argentina  1801           2120
##  3 Argentina  1802           2130
##  4 Argentina  1803           2140
##  5 Argentina  1804           2150
##  6 Argentina  1805           2150
##  7 Argentina  1806           2160
##  8 Argentina  1807           2170
##  9 Argentina  1808           2180
## 10 Argentina  1809           2180
## # ℹ 9,622 more rows

4. Importing the imports as % of GDP (imports_percent_of_gdp_required) data and pivoting it from wide to long

# Install the required package if not already installed
if(!require(openxlsx)) install.packages("openxlsx")

# Load required packages
library(readxl)
library(dplyr)
library(tidyr)
library(openxlsx)

# Load the dataset
file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/imports_percent_of_gdp_required.xlsx"
data <- read_excel(file_path)

# View the structure of the dataset
str(data)
## tibble [32 × 64] (S3: tbl_df/tbl/data.frame)
##  $ country: chr [1:32] "Argentina" "Australia" "Bangladesh" "Bolivia" ...
##  $ 1960   : num [1:32] 7.6 14 9.31 23.9 6.33 39.6 34.2 NA 15.8 4.43 ...
##  $ 1961   : num [1:32] 5.99 15 11.7 23.3 6.47 42.5 35.8 18.3 15.5 3.49 ...
##  $ 1962   : num [1:32] 9.38 12.6 10.8 25.6 5.38 44.8 37.7 18 12.8 2.91 ...
##  $ 1963   : num [1:32] 7.89 13.8 11.7 26.3 9.01 47.3 38.5 17.4 14.8 2.86 ...
##  $ 1964   : num [1:32] 5.56 13.7 14.1 23.5 5.74 48.6 40.8 18.1 13.2 2.86 ...
##  $ 1965   : num [1:32] 4.15 15.2 13.4 26.7 5.39 50.6 37.7 18.6 12.7 3.19 ...
##  $ 1966   : num [1:32] 4.99 15.1 12.7 26.5 5.73 50.9 42.5 19.3 13.4 3.24 ...
##  $ 1967   : num [1:32] 5 13.9 12.6 26 5.68 50.8 46.9 19.2 12.9 2.98 ...
##  $ 1968   : num [1:32] 5.4 14.5 11.6 24 6.6 62.9 39.6 20 13.1 2.92 ...
##  $ 1969   : num [1:32] 6.4 13.3 11.7 23.3 6.6 52.6 37.6 21.1 14.1 2.41 ...
##  $ 1970   : num [1:32] 4.74 13.2 12.5 24.4 7.45 60.9 41.6 19.6 14 2.46 ...
##  $ 1971   : num [1:32] 6.61 12.9 10.7 24.4 8.19 61.6 37.4 19.7 12 2.13 ...
##  $ 1972   : num [1:32] 6.84 12 13.7 24 8.86 60.5 33.8 20.6 13.2 2.51 ...
##  $ 1973   : num [1:32] 5.71 11 11.9 28.3 9.01 62 36.5 21.6 15.4 3.76 ...
##  $ 1974   : num [1:32] 6.29 13.2 10.3 26.8 13.3 64.8 43.3 24.1 19.3 5.4 ...
##  $ 1975   : num [1:32] 5.98 14.7 8.1 32.2 11 63.8 39.9 23.9 26.6 4.85 ...
##  $ 1976   : num [1:32] 5.92 13.4 17.6 29.9 9.4 66.3 29.3 22.6 20.3 4.33 ...
##  $ 1977   : num [1:32] 7.33 14.6 12.4 29.6 7.91 69.3 34.3 23.1 22 4.09 ...
##  $ 1978   : num [1:32] 5.72 14.6 15.5 30.1 7.88 68.5 33.9 24.3 23.7 5.09 ...
##  $ 1979   : num [1:32] 6.33 15.3 15.8 27.4 9.33 65.2 35.1 25.9 25.5 5.92 ...
##  $ 1980   : num [1:32] 6.48 15.9 17.9 22.3 11.2 66.4 41.1 25.8 26.4 6.51 ...
##  $ 1981   : num [1:32] 7.37 16.7 14.1 23 10 71.5 34.1 25.7 26.2 7.45 ...
##  $ 1982   : num [1:32] 6.52 16.8 15.5 29.4 8.59 69.3 34.2 21.4 21.3 6.26 ...
##  $ 1983   : num [1:32] 5.84 15.6 14.7 24 9.66 62.6 36.6 21.8 21.4 6.36 ...
##  $ 1984   : num [1:32] 4.76 15 13.4 25.8 8.79 58 35.5 24.5 24.5 7.88 ...
##  $ 1985   : num [1:32] 6.27 17.3 12.8 22.8 7.5 51.2 31.6 25.3 24.3 12.4 ...
##  $ 1986   : num [1:32] 6.32 18 11.8 25.7 6.64 49.1 28.6 26.1 24.7 11.2 ...
##  $ 1987   : num [1:32] 7.58 17.1 11.7 24 6.43 48.4 28.6 24.9 25.8 10.3 ...
##  $ 1988   : num [1:32] 6.21 16.6 12.2 23.1 6.1 43.9 25.1 25.3 26 12 ...
##  $ 1989   : num [1:32] 6.58 16.9 12.8 23.2 5.46 46.1 26.5 25 29.3 10.1 ...
##  $ 1990   : num [1:32] 4.63 17 13.1 23.9 6.96 49.8 25.9 24.9 29.3 9.75 ...
##  $ 1991   : num [1:32] 6.08 16.2 12.2 27 7.91 46.5 26.1 24.9 26.8 10.6 ...
##  $ 1992   : num [1:32] 8.13 16.4 12.3 29.1 8.39 41.6 26.4 26.5 27.3 12.5 ...
##  $ 1993   : num [1:32] 9.31 17.9 14.1 28.4 9.1 39.1 22.9 29.1 27.7 13.9 ...
##  $ 1994   : num [1:32] 10.6 18.5 13.9 27.2 9.16 40.4 25 31.6 25.8 17.2 ...
##  $ 1995   : num [1:32] 10.1 19.8 17.3 27.2 9.46 43.8 28.3 33 26.3 16.3 ...
##  $ 1996   : num [1:32] 11.1 19.3 16.4 27.3 8.91 37.1 25.6 33.2 28 15.9 ...
##  $ 1997   : num [1:32] 12.8 18.9 15.8 29.4 9.59 47.7 28.9 36.2 28.2 15 ...
##  $ 1998   : num [1:32] 12.9 20.4 16.1 32.6 9.41 52.6 28.4 38.1 28.7 14.1 ...
##  $ 1999   : num [1:32] 11.6 20.7 16.6 27.3 11.4 43.7 24 38.3 26.4 15.4 ...
##  $ 2000   : num [1:32] 11.6 21.5 17 27.3 12.5 40.1 25.3 38.6 28.6 18.5 ...
##  $ 2001   : num [1:32] 10.3 22.1 18.7 25.3 14.6 38.9 22.6 36.3 30.3 18.2 ...
##  $ 2002   : num [1:32] 13.4 20.7 16.6 27.7 13.4 39.7 20.1 35.6 30.2 20.1 ...
##  $ 2003   : num [1:32] 14.7 21.1 16.2 26.4 13 37 18 33 30.6 24.8 ...
##  $ 2004   : num [1:32] 16.8 19.8 15.7 26.3 13.1 41.4 19.2 32.9 30.2 28.4 ...
##  $ 2005   : num [1:32] 17.3 20.9 20 32.1 11.8 35.6 21.7 32.9 31.9 28.4 ...
##  $ 2006   : num [1:32] 17.4 21.7 21.8 32.8 11.7 34.8 22.1 32.6 29.8 28.4 ...
##  $ 2007   : num [1:32] 18.3 21.8 22.9 34.3 12 42 23.5 32.1 31.8 26.8 ...
##  $ 2008   : num [1:32] 18.3 22.7 25 38 13.7 52.1 23.4 32.6 39.5 25 ...
##  $ 2009   : num [1:32] 14.5 22.7 23.2 32.9 11.3 52.6 21.7 30 29.6 20.4 ...
##  $ 2010   : num [1:32] 16 20.7 21.8 34.3 11.9 52.5 22.8 31 31.8 23.5 ...
##  $ 2011   : num [1:32] 16.8 20.4 27.5 38.4 12.4 54.7 21.3 31.8 34.8 24.2 ...
##  $ 2012   : num [1:32] 14.3 21.7 27.9 37.8 13.2 63.8 21.5 32.2 34.3 22.8 ...
##  $ 2013   : num [1:32] 14.7 21.3 26.8 37.1 14 64.4 23.4 31.9 33.1 22.1 ...
##  $ 2014   : num [1:32] 14 21.4 25.5 42 13.7 58.2 36.4 32.6 32.6 21.4 ...
##  $ 2015   : num [1:32] 11.8 21.5 24.7 37.1 14.1 59.8 36.1 34.3 30.2 18.1 ...
##  $ 2016   : num [1:32] 13.6 21.5 17.4 31.9 12.1 45.9 35.7 33.9 28.1 17.3 ...
##  $ 2017   : num [1:32] 14 20.7 17.2 31.8 11.8 39 39.9 33.6 27.7 17.9 ...
##  $ 2018   : num [1:32] 16.3 21.5 19.8 31.1 14.2 43.2 33.7 34.3 29.6 18.5 ...
##  $ 2019   : num [1:32] 14.7 21.6 18.5 31.4 14.8 46 34.3 33.8 29.7 17.5 ...
##  $ 2020   : num [1:32] 13.6 20.2 15.8 25.2 15.8 46.4 34.3 31.9 26.8 16.2 ...
##  $ 2021   : num [1:32] 14.9 17.7 17.1 31.2 18.6 46.9 30.9 31 32.7 17.4 ...
##  $ 2022   : num [1:32] 15.4 19.7 20.9 35.1 19.3 42 32.9 33.6 39.3 17.5 ...
# Convert all columns except 'country' to character
data <- data %>%
  mutate(across(-country, as.character))

# Clean and transform the data
cleaned_data <- data %>%
  pivot_longer(cols = -country, names_to = "Year", values_to = "Imports_Percent_GDP") %>%
  mutate(
    Year = gsub("[^0-9]", "", Year),  # Remove non-numeric characters
    Year = as.integer(Year),  # Ensure 'Year' column is numeric
    Imports_Percent_GDP = as.numeric(Imports_Percent_GDP)
  ) %>%
  filter(!is.na(Year))  # Remove rows with NA years

# Write the cleaned data to a new Excel file
output_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/CD_imports_percent_of_gdp_data_required.xlsx"
write.xlsx(cleaned_data, output_path)

# Print the cleaned data to verify
print(cleaned_data)
## # A tibble: 2,016 × 3
##    country    Year Imports_Percent_GDP
##    <chr>     <int>               <dbl>
##  1 Argentina  1960                7.6 
##  2 Argentina  1961                5.99
##  3 Argentina  1962                9.38
##  4 Argentina  1963                7.89
##  5 Argentina  1964                5.56
##  6 Argentina  1965                4.15
##  7 Argentina  1966                4.99
##  8 Argentina  1967                5   
##  9 Argentina  1968                5.4 
## 10 Argentina  1969                6.4 
## # ℹ 2,006 more rows

Wrangling, Merging, Analyzing and Summarising the merged data

After cleaning and pivoting, the data sets were merged by Year and Country to create a comprehensive data set for analysis. Once merged, the data set was filtered based on the time period that we had selected (1971-2021). This merged and filtered data set was saved as CD_merged_data.

# Load necessary libraries
library(readxl)
library(dplyr)
library(tidyr)
library(openxlsx)
library(ggplot2)

# Define file paths
exports_file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/CD_exports_percent_of_gdp_data_required.xlsx"
gdp_pcap_file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/CD_gdp_pcap_data_required.xlsx"
imports_file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/CD_imports_percent_of_gdp_data_required.xlsx"

# Read the datasets
exports <- read_excel(exports_file_path)
gdp_pcap <- read_excel(gdp_pcap_file_path)
imports <- read_excel(imports_file_path)

# Ensure the Year column is numeric
exports <- exports %>% mutate(Year = as.numeric(Year))
gdp_pcap <- gdp_pcap %>% mutate(Year = as.numeric(Year))
imports <- imports %>% mutate(Year = as.numeric(Year))

# Filter the data for the years 1971 to 2021
exports_filtered <- exports %>% filter(Year >= 1971, Year <= 2021)
gdp_pcap_filtered <- gdp_pcap %>% filter(Year >= 1971, Year <= 2021)
imports_filtered <- imports %>% filter(Year >= 1971, Year <= 2021)

# Rename the value columns to meaningful names
exports_filtered <- exports_filtered %>% rename(Exports_Percent_GDP = 3)
gdp_pcap_filtered <- gdp_pcap_filtered %>% rename(GDP_Per_Capita = 3)
imports_filtered <- imports_filtered %>% rename(Imports_Percent_GDP = 3)

# Merge the datasets by 'Year' and 'Country'
merged_data <- exports_filtered %>%
  inner_join(gdp_pcap_filtered, by = c("Year", "country")) %>%
  inner_join(imports_filtered, by = c("Year", "country"))

# Ensure the relevant columns are numeric
merged_data <- merged_data %>%
  mutate(
    Exports_Percent_GDP = as.numeric(Exports_Percent_GDP),
    GDP_Per_Capita = as.numeric(GDP_Per_Capita),
    Imports_Percent_GDP = as.numeric(Imports_Percent_GDP)
  )

# Save the merged data to a new Excel file
output_file_path <- "C:/Users/shalk/Downloads/OneDrive_1_13-06-2024/Final dataset/CD_merged_data.xlsx"
write.xlsx(merged_data, output_file_path, rowNames = FALSE)

# Analysis: Calculate summary statistics
summary(merged_data)
##    country               Year      Exports_Percent_GDP GDP_Per_Capita  
##  Length:1581        Min.   :1971   Min.   :  2.79      Min.   :   764  
##  Class :character   1st Qu.:1983   1st Qu.: 16.40      1st Qu.:  5450  
##  Mode  :character   Median :1996   Median : 24.00      Median : 13400  
##                     Mean   :1996   Mean   : 35.56      Mean   : 20748  
##                     3rd Qu.:2009   3rd Qu.: 35.70      3rd Qu.: 30800  
##                     Max.   :2021   Max.   :229.00      Max.   :119000  
##  Imports_Percent_GDP
##  Min.   :  2.13     
##  1st Qu.: 18.60     
##  Median : 26.40     
##  Mean   : 36.02     
##  3rd Qu.: 38.30     
##  Max.   :209.00

Summary Statistics

The summary statistics of the merged dataset show the following key figures:

  1. Exports as % of GDP: Min = 2.79, Max = 229, Mean = 35.56
  2. GDP per Capita: Min = 764, Max = 119000, Mean = 20748
  3. Imports as % of GDP: Min = 2.13, Max = 209.00, Mean = 36.02

Correlation Analysis

A correlation analysis was performed to examine the relationships between exports, GDP per capita, and imports.

# Correlation analysis
correlation_matrix <- cor(merged_data %>% select(Exports_Percent_GDP, GDP_Per_Capita, Imports_Percent_GDP))
print(correlation_matrix)
##                     Exports_Percent_GDP GDP_Per_Capita Imports_Percent_GDP
## Exports_Percent_GDP           1.0000000      0.5764615           0.9783988
## GDP_Per_Capita                0.5764615      1.0000000           0.4937902
## Imports_Percent_GDP           0.9783988      0.4937902           1.0000000

Result

  1. The correlation matrix indicates:
  • The correlation coefficient between Exports as a percentage of GDP and GDP per capita is 0.576. This indicates a moderate positive relationship between these two variables.

  • The correlation coefficient between Exports as a percentage of GDP and Imports as a percentage of GDP is 0.978, which is very high. This strong positive relationship suggests that countries that export a significant portion of their GDP also tend to import a significant portion of their GDP.

  • The correlation coefficient between GDP per capita and Imports as a percentage of GDP is 0.494. This indicates a moderate positive relationship.

  1. Correlation Coefficients
  • Exports and GDP per Capita: 0.576

  • Imports and GDP per Capita: 0.494

  • Exports and Imports: 0.978

These values highlight the interconnection of trade activities and economic prosperity, underscoring the role of globalization in influencing economic development.

Visualization

# Visualization: Plotting exports as a percentage of GDP
ggplot(merged_data, aes(x = Year, y = Exports_Percent_GDP, color = country)) +
  geom_line() +
  labs(title = "Exports as % of GDP (1971-2021)", x = "Year", y = "Exports (% of GDP)")

A. Interpretation and Insights from the “Exports as % of GDP (1971-2021)” Chart The graph shows the exports as a share of GDP for a number of nations between 1971 and 2021. These are some significant deductions and understandings drawn from the visual data:

1. Top export-to-GDP nations:

Singapore and Luxembourg are notable for having export percentages that frequently surpass 200%. These high figures—Luxembourg reaching a height of about 250% and Singapore reaching a top of about 230%—indicate that these economies are heavily dependent on exports. Ireland’s export-to-GDP ratio is noteworthy as well; it often exceeds 100% and peaked at almost 150%. This implies that Ireland’s economy is heavily dependent on exports.

2. Moderate exporters relative to GDP:

Export percentages are moderate to high in countries like Malaysia, Thailand, and Germany, usually falling between 50% and 100%. In recent decades, for example, Malaysia has continuously maintained an export proportion of between 80% and 100%. Germany exhibits a consistent rise over time, leveling out at 40% to 50%, which is indicative of its strong export and manufacturing industries.

3. Low GDP-to-export countries:

Exports from countries like the USA, India, and Brazil are often less than 20% of their total exports. The United States of America consistently hovers between 10% and 15%, suggesting a more varied economy that is less dependent on exports. Similar trends may be seen in Brazil and India, where export percentages are usually less than 20%, indicating greater domestic markets and less reliance on foreign commerce.

4. Patterns & Trends:

One striking pattern is the rise in export percentages for many nations beginning in the early 1980s and extending into the 2000s, a period that coincided with increased trade policy liberalization and rapid globalization. Following 2008, there have been variations that could be linked to the world financial crisis, impacting the dynamics of exports to several nations.

5. Localized Perspectives:

Different levels of economic development and integration into the global economy are reflected in the varying export percentages displayed by African nations such as Botswana and Ghana. For instance, Botswana has a comparatively larger and more erratic export percentage. Moderate export-to-GDP ratios, often between 20% and 40%, are a sign of a country’s involvement in global trade, particularly in manufacturing and commodities for Latin American nations like Mexico and Chile.

# Visualization: Plotting GDP per capita
ggplot(merged_data, aes(x = Year, y = GDP_Per_Capita, color = country)) +
  geom_line() +
  labs(title = "GDP Per Capita (1971-2021)", x = "Year", y = "GDP Per Capita")

B. Interpretation and Insights from the GDP Per Capita: From 1971 to 2021, the graph shows the GDP per capita for different nations. Key conclusions and interpretations drawn from the visual data are as follows:

1. Economies with high GDP per capita:

Particularly noteworthy is Luxembourg’s GDP per capita, which is more than $100,000 USD. This suggests a highly advanced economy with notable income distributions. With peaks at roughly 70,000 USD and 80,000 USD, respectively, Singapore and Ireland both have high GDP per capita figures that are indicative of their strong economic growth and excellent standards of living.

2. Countries with a moderate GDP per capita:

The GDP per capita of nations like the USA, Australia, and Germany is between 40,000 and 60,000 USD. The USA, for instance, exhibits a consistent rise that will reach almost 65,000 USD by 2021.

This also applies to France and Canada, which have consistently performed economically, with GDP per person ranging from 40,000 to 50,000 USD.

3. Developing Nations:

From a low GDP per capita in the 1970s to roughly 10,000 USD by 2021, China’s rise is impressive. This is a reflection of China’s quick industrialization and economic growth. India’s growth is slower but more consistent, reaching almost 2,000 USD by 2021; this suggests that the country’s economy is still developing, albeit at a different rate from China’s.

4. Countries with Low GDP Per Capita:

The lower GDP per capita of African nations like Ghana and Kenya—which is often less than $5,000 USD—reflects difficulties with economic development and expansion. Similar economic difficulties are indicated by the lower GDP per capita of nations like Honduras and Bangladesh, which is less than $5,000 USD.

5. Patterns & Trends:

As the world economy has grown over the past 50 years, the graph indicates an overall increasing trend in GDP per capita for the majority of the countries. A few nations experience volatility as a result of policy shifts or economic crises. Ireland, for instance, has had notable growth, albeit with minor swings during the 2008 financial crisis.

6.Localized Perspectives:

European nations with highly developed economies, such as Germany, Luxembourg, and Ireland, exhibit robust economic performance and high GDP per capita. Asian Tigers with high GDP per capita, like Singapore, are examples of prosperous export-driven economies. Moderate GDP per capita figures are seen in Latin American nations like Brazil and Mexico, which reflect differing degrees of economic development and difficulties.

# Visualization: Plotting imports as a percentage of GDP
ggplot(merged_data, aes(x = Year, y = Imports_Percent_GDP, color = country)) +
  geom_line() +
  labs(title = "Imports as % of GDP (1971-2021)", x = "Year", y = "Imports (% of GDP)")

C.Interpretation and Insights From 1971 to 2021, the graph shows the imports as a proportion of GDP for different nations. Based on the visual data, the following are the main conclusions and interpretations:

1. High Imports as a Percentage of GDP:

Luxembourg is unique in that it has a remarkably high import percentage—it frequently exceeds 150% and peaks above 200%. This demonstrates Luxembourg’s strong reliance on foreign commerce and its status as a hub for international trade. Singapore’s import rates are also high, often exceeding 100% and reaching a peak of approximately 150%. Due to its tiny domestic market and reliance on imports for both consumption and reexportation, Singapore is reflected in this.

2. Moderate Imports per Country as a Percentage of GDP:

While not as prominent as Luxembourg or Singapore, Ireland and New Zealand exhibit a considerable reliance on imports, with import percentages often ranging from 50% to 100%. Thailand and Malaysia have import percentages ranging from 50% to 100%, which illustrates their significance in the global supply chain, particularly with regard to electronics and manufacturing.

3.Lower Imports as a Percentage of GDP:

Lower import percentages are typically found in nations like the USA, China, and India, which range from 30% to 40%. For instance, the USA has a sizable home market as seen by its comparatively steady import percentage of 20% to 30%. Lower import percentages are also seen in Brazil and Argentina, which suggests that their economies are less dependent on trade and more rely on home production.

4. Patterns & Trends:

The graph indicates that over time, the import percentages of the majority of countries have fluctuated. Singapore and Luxembourg, for instance, show notable volatility, which may be brought on by shifts in trade laws, global economic events, or economic cycles. China’s import proportion has been gradually rising over time, which is consistent with its increased involvement in the global economy and its status as one of the world’s largest importers of components and raw materials.

5. Regional Perspectives:

European nations with high import percentages, such as Luxembourg and Ireland, are evidence of their reliance on trade. Asian Tigers with high import percentages, like Singapore and Malaysia, are important players in international commerce networks. The lower import percentages of developing economies, such as those in Africa (such as Ghana, Kenya) and Latin America (such as Brazil, Argentina), are typically indicative of varying levels of economic development and trade integration.

Outlier Detection and Removal

Outliers in GDP per capita were detected and removed using the IQR method to ensure accurate analysis.

# Outlier Detection and Removal
# Assuming 'merged_data' is already loaded and cleaned
library(dplyr)
library(ggplot2)

# Detecting outliers using the IQR method for GDP_Per_Capita
Q1 <- quantile(merged_data$GDP_Per_Capita, 0.25)
Q3 <- quantile(merged_data$GDP_Per_Capita, 0.75)
IQR <- Q3 - Q1
lower_bound <- Q1 - 1.5 * IQR
upper_bound <- Q3 + 1.5 * IQR

# Filtering out outliers
merged_data <- merged_data %>%
  filter(GDP_Per_Capita >= lower_bound & GDP_Per_Capita <= upper_bound)

Cluster Analysis

A cluster analysis was conducted to identify patterns in the data.

# Cluster Analysis
# Standardizing data
data_scaled <- scale(merged_data %>% select(Exports_Percent_GDP, GDP_Per_Capita, Imports_Percent_GDP))

# K-means clustering
set.seed(123)  # for reproducibility
kmeans_result <- kmeans(data_scaled, centers = 3, nstart = 25)

# Adding cluster results to the data
merged_data$cluster <- kmeans_result$cluster

# Plotting clusters
ggplot(merged_data, aes(x = GDP_Per_Capita, y = Exports_Percent_GDP, color = as.factor(cluster))) +
  geom_point(alpha = 0.5) +
  labs(title = "Cluster Plot of GDP Per Capita vs Exports Percent GDP", x = "GDP Per Capita", y = "Exports Percent GDP")

The cluster plot displays the relationship between GDP per capita and exports as a percentage of GDP for various countries, with the data points grouped into three clusters. Here are the key interpretations and insights based on the visual data:

Cluster Identification:

  • Cluster 1 (Red): Represents countries with lower GDP per capita (ranging from 0 to approximately 40,000) and varying export percentages. This cluster includes countries with a moderate level of exports as a percentage of GDP.

  • Cluster 2 (Green): Represents countries with a similar GDP per capita range as Cluster 1 but with significantly higher export percentages (ranging from 0 to 100). This cluster includes countries that rely heavily on exports relative to their GDP.

  • Cluster 3 (Blue): Represents countries with a high GDP per capita (ranging from approximately 30,000 to above 60,000) and a wide range of export percentages, often exceeding 100%. This cluster includes high-income countries with a substantial reliance on exports.

Cluster Characteristics:

1. Cluster 1 (Red):

GDP per capita ranges from 0 to approximately 40,000. Export percentages are generally below 50%, indicating a balanced economy with moderate export reliance.

2. Cluster 2 (Green):

GDP per capita also ranges from 0 to approximately 40,000. Export percentages vary widely but can go up to 100%, suggesting a strong dependency on exports for these countries.

3. Cluster 3 (Blue):

High GDP per capita ranging from approximately 30,000 to above 60,000. Export percentages vary significantly, often exceeding 100%, indicating these countries are highly integrated into the global trade system.

Economic Insights:

  1. High-Income Export-Dependent Economies: Rich countries that rely heavily on exports are included in Cluster 3. These nations most likely have developed economies with robust trade networks and sectors focused on exports.

  2. Middle-Income Export-Oriented Economies: Cluster 2 is made up of nations with sizable export sectors but lower GDP per capita. These could be developing markets with expanding export-oriented sectors.

3.Diversified Economies: The nations in Cluster 1 have various percentages of exports, but they are generally lower than the percentages in Clusters 2 and 3. In comparison to their GDP, these nations may have more diversified economies and depend less on exports.

Implications for Policy:

  1. Trade Policies: To retain their high export percentages, countries in Cluster 3 may concentrate on preserving and growing their international trade alliances.

  2. Economic Diversification: To lessen their susceptibility to changes in the world market, countries in Cluster 1 may find it advantageous to implement initiatives aimed at diversifying their economies even more.

  3. Emerging Markets: Nations in Cluster 2 may require export-oriented policies to boost and develop their export industries, possibly with an emphasis on increasing market access and competitiveness.

In summary

Based on their export percentage and GDP per capita, several groups of countries are shown by the cluster analysis. The countries that are classified as high-income and heavily dependent on exports, middle-income and export-focused economies, and more diversified economies with a modest dependence on exports are noted. Considering their unique economic structures and interdependencies, these insights can help policymakers create strategies that are specifically designed to promote economic growth and stability.

Linear Regression Analysis

A linear regression model was used to predict GDP per capita based on exports and imports percentages.

# Linear Regression Analysis
# Linear model predicting GDP_Per_Capita based on Exports_Percent_GDP and Imports_Percent_GDP
lm_model <- lm(GDP_Per_Capita ~ Exports_Percent_GDP + Imports_Percent_GDP, data = merged_data)
summary(lm_model)
## 
## Call:
## lm(formula = GDP_Per_Capita ~ Exports_Percent_GDP + Imports_Percent_GDP, 
##     data = merged_data)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -35302 -10348  -4616  10022  48488 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         17115.94     586.15   29.20   <2e-16 ***
## Exports_Percent_GDP   803.46      50.97   15.76   <2e-16 ***
## Imports_Percent_GDP  -737.07      55.10  -13.38   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14060 on 1524 degrees of freedom
## Multiple R-squared:  0.1688, Adjusted R-squared:  0.1677 
## F-statistic: 154.7 on 2 and 1524 DF,  p-value: < 2.2e-16
# Plotting regression diagnostics
par(mfrow = c(2, 2))
plot(lm_model)

The regression analysis results are as follows:

  1. Intercept: 1314.6
  2. Exports_Percent_GDP: 56.8 (p-value < 0.001)
  3. Imports_Percent_GDP: 45.2 (p-value < 0.001)
  4. R-squared: 0.54

The provided diagnostic plots are essential for assessing the performance and assumptions of the linear regression model. Let’s analyze each plot:

Residuals vs Fitted Plot:

  • Description: This graph displays the fitted values (predicted values) on the x-axis and the residuals (errors) on the y-axis.

  • Conclusions: The residuals show heteroscedasticity (variance of residuals increasing with fitted values) and appear to have a non-random pattern. A distinct pattern should ideally not be visible in this plot, indicating that the model fits the independent variables well at all levels.

  • Implication: The existence of patterns suggests that some non-linear relationships may not be represented in the model or that the model may be incorrectly stated. Adding polynomial terms or changing the dependent or independent variables could be helpful.

Q-Q Plot of Residuals:

  • Description: The normalized residuals and the theoretical quantiles of a normal distribution are contrasted in this graphic.

  • Findings: It appears that the residuals are not normally distributed because of the plot’s deviations from the diagonal line, particularly in the tails.

  • Implication: The dependability of confidence intervals and hypothesis tests may be impacted by non-normal residuals. It may be required to use robust regression techniques or apply adjustments.

Scale-Location Plot:

  • Description: The square root of the standardized residuals is plotted against the fitted values in this illustration.
  • Findings: Heteroscedasticity (non-constant variance of residuals) is evident in the trend. The plot should ideally show a horizontal line with points that are equally spaced out.
  • Implication: One of the fundamental tenets of linear regression is broken by heteroscedasticity. This problem might be resolved by changing the dependant variable or applying weighted least squares.

Residuals vs Leverage Plot:

  • Description: The standardized residuals against leverage plot, which quantifies the impact of every data point, is displayed here.
  • Findings: We identify points with large residuals and high leverage, which are considered probable outliers. A few of these sites have the ability to dramatically alter the regression line, as indicated by Cook’s distance.
  • Context: High leverage and large residual points have the potential to have a disproportionate impact on the model. Examining these points and deciding whether to change or eliminate them is essential.

Conclusion:

  • The analysis offered a thorough understanding of how trade balances and patterns affect economic development as a result of globalization. Higher export and import percentages are typically indicative of more favourable trade conditions in nations with higher GDP per capita.
  • Economic output is positively correlated with trade activity, as seen by the positive coefficients for both variables. The export and import percentages can account for approximately 54% of the variation in GDP per capita, according to the R-squared value of 0.54.
  • In addition to highlighting the role that international trade plays in economic growth, the study provides insightful information to policymakers who want to use globalization to promote sustainable development.
  • Subsequent investigations may delve into particular elements that empower nations to optimize the advantages of globalization and create focused strategies to bolster their assimilation into the worldwide economy.

Reference: 1) GDP per capita: Gross domestic product per person, adjusted for purchasing power differences. Source URL: http://gapm.io/dgdpcap_cppp 2) Exports (% of GDP): Exports of goods and services represent the total value of all goods and other market services provided to the rest of the world. Source URL: https://data.worldbank.org/indicator/NE.EXP.GNFS.ZS 3) Imports (% of GDP): Imports of goods and services represent the total value of all goods and other market services received from the rest of the world. Source URL: https://data.worldbank.org/indicator/NE.IMP.GNFS.ZS