1. Introduction

1.1. Background

This study explores economic patterns among advanced economies using unsupervised learning techniques. The analysis is particularly relevant in the context of ongoing debates about economic convergence and divergence among developed nations, especially following the global financial crisis and the COVID-19 pandemic.

1.2. Theoretical Framework

The analysis is grounded in several key theoretical frameworks:

  1. Varieties of Capitalism Theory (Hall & Soskice, 2001):
  • Categorizes economies into Liberal Market Economies (LMEs) and Coordinated Market Economies (CMEs)

  • Emphasizes institutional differences in:

    • Skill formation systems
    • Corporate governance
    • Inter-firm relations
    • Employee relations
  • Demonstrates how different institutional arrangements shape economic performance and innovation strategies

  1. Economic Convergence Theory:
  • Examines the potential for economies to become more similar over time

  • Distinguishes between:

    • Conditional convergence (converging under specific institutional conditions)
    • Absolute convergence (unconditional economic similarity)
  • Explores barriers to convergence, including:

    • Institutional path dependencies
    • Structural economic differences
    • Policy divergences
  1. Fiscal Policy Theory:
  • Investigates the relationship between government intervention and economic outcomes

  • Key focus areas:

    • Optimal government size
    • Taxation and public spending efficiency
    • Fiscal sustainability and debt dynamics

1.3. Methodological Limitations and Considerations

Data Limitations

  • Relies on IMF World Economic Outlook database, which may have:
    • Potential reporting biases
    • Inconsistent data collection methodologies across countries
    • Limited coverage of informal economic activities

Methodological Constraints

  • Principal Component Analysis (PCA) and Clustering techniques assume:
    • Linear relationships between variables
    • Comparability of economic indicators across different institutional contexts
    • Stability of economic structures over the observed period

1.3. Objectives

The main objectives of this study are to:

  1. Identify underlying patterns in economic performance across advanced economies

  2. Assess the relationship between government involvement and economic outcomes

  3. Evaluate the existence of distinct economic models among advanced economies

  4. Provide evidence-based insights for policy development

1.4. Data and Methodology

Data Sources

  • Primary data: World Economic Outlook (WEO) database
  • Collection period: October 2024 release
  • Data retrieval process:
    • Download complete database from IMF website
    • Validate data integrity
    • Apply strict inclusion criteria for advanced economies

Key Economic Indicators

Indicators were selected based on: - Theoretical relevance - Data availability - Representation of key economic dimensions - Minimization of multicollinearity

The following indicators were selected:

  1. Growth and Development:
  • GDP growth rate (NGDP_RPCH)
  • GDP per capita (NGDPRPPPPC)
  1. Price Stability:
  • Inflation rate (PCPIPCH)
  • End of period inflation (PCPIEPCH)
  1. Government Role:
  • Government revenue (GGR_NGDP)
  • Government expenditure (GGX_NGDP)
  • Government net lending/borrowing (GGXCNL_NGDP)
  • Government gross debt (GGXWDG_NGDP)
  1. Economic Structure:
  • Total investment (NID_NGDP)
  • Unemployment rate (LUR)

Country Selection

  • IMF classification of advanced economies
  • Exclusion criteria:
    • Insufficient data points
    • Significant structural breaks
    • Incomplete economic reporting

2. Data Preparation and Quality Analysis

The data preparation process involved several key steps to clean, filter, and reshape the economic data for the subsequent analysis. This included loading the required libraries, inspecting the initial data, selecting the relevant indicators and countries, handling missing values, transforming the data format, and scaling the numeric variables. These preparatory steps ensured the dataset was in a suitable format for performing the principal component analysis and clustering algorithms.

2.1. Load Libraries

The first step in the data preparation process was to load the required R packages and libraries for the analysis. This included libraries for data manipulation, visualization, and the specific statistical techniques used in the study, such as Principal Component Analysis (PCA) and clustering algorithms.

The code block below shows how the necessary packages were installed and loaded, if they were not already available in the R environment:

# Install and load required packages
required_packages <- c(
    "tidyverse", "factoextra", "cluster", "corrplot", "ggrepel", "readxl",
    "car", "robustbase", "gridExtra", "dendextend", "clValid", "reshape2",
    "viridis", "scales", "knitr", "kableExtra"
)

# Install missing packages
for(pkg in required_packages) {
    if (!require(pkg, character.only = TRUE)) {
        install.packages(pkg)
        library(pkg, character.only = TRUE)
    }
}

2.2. Load and Inspect Data

The analysis began by loading the data from the Excel file containing the economic indicators for various countries. This file, named “WEOOct2024all.xlsx”, was sourced from the World Economic Outlook (WEO) database provided by the International Monetary Fund (IMF).

The initial dimensions of the dataset were printed to provide an overview of the data:

# Load data from Excel file
data <- read_xlsx("C:\\Users\\NUC\\Desktop\\USL\\WEOOct2024all.xlsx")
print("Initial data dimensions:")
## [1] "Initial data dimensions:"
print(dim(data))
## [1] 1287   15

The dataset contained 1,287 rows and 15 columns, representing a comprehensive set of economic indicators across multiple countries and years.

2.3. Filter and Reshape Data

To prepare the dataset for analysis, six key preprocessing steps were implemented:

  1. Indicator Selection: Ten critical economic indicators were chosen, encompassing growth (GDP growth, GDP per capita), stability (inflation), fiscal measures (government revenue, expenditure, debt), and structural factors (unemployment, investment). These indicators provide a comprehensive view of economic performance while maintaining analytical tractability.

  2. Country Filtering: Analysis focused on 39 advanced economies as classified by the IMF, ensuring comparability of economic structures and data quality standards.

  3. Missing Value Handling: Missing values (“n/a”, “–”) were converted to numeric NAs and handled through mean aggregation over 2015-2023. Countries with insufficient data were excluded to maintain analytical integrity.

  4. Data Reshaping: The dataset was transformed from long to wide format, with countries as rows and indicators as columns, facilitating cross-sectional analysis.

  5. Variance Filtering: Variables with near-zero variance were removed to ensure all indicators contributed meaningful information to the analysis.

  6. Standardization: Variables were scaled to zero mean and unit variance, ensuring equal contribution to the multivariate analyses and enabling meaningful comparisons across different measurement scales.

# Define the indicators
indicators <- c(
    "NGDP_RPCH",      # GDP growth rate
    "NGDPRPPPPC",     # GDP per capita, constant prices
    "PCPIPCH",        # Inflation rate
    "PCPIEPCH",       # End of period inflation
    "NID_NGDP",       # Total investment
    "LUR",            # Unemployment rate
    "GGR_NGDP",       # Government revenue
    "GGX_NGDP",       # Government expenditure
    "GGXCNL_NGDP",    # Government net lending/borrowing
    "GGXWDG_NGDP"     # Government gross debt
)

# Define advanced economies
advanced_economies <- c(
    "Australia", "Austria", "Belgium", "Canada", "Cyprus", "Czech Republic", 
    "Denmark", "Estonia", "Finland", "France", "Germany", "Greece", 
    "Hong Kong SAR", "Iceland", "Ireland", "Israel", "Italy", "Japan", 
    "Korea", "Latvia", "Lithuania", "Luxembourg", "Macao SAR", "Malta", 
    "Netherlands", "New Zealand", "Norway", "Portugal", "Puerto Rico", 
    "San Marino", "Singapore", "Slovak Republic", "Slovenia", "Spain", 
    "Sweden", "Switzerland", "Taiwan Province of China", "United Kingdom", 
    "United States"
)

# Load and process data
data <- read_xlsx("WEOOct2024all.xlsx")

# Process the data with explicit NA handling and numeric conversion
processed_data <- data %>%
    filter(Country %in% advanced_economies,
           `WEO Subject Code` %in% indicators) %>%
    select(Country, `WEO Subject Code`, `2015`:`2023`) %>%
    mutate(across(matches("^\\d{4}$"), 
                 ~as.numeric(ifelse(. %in% c("n/a", "--"), NA, .)))) %>%
    group_by(Country, `WEO Subject Code`) %>%
    summarise(
        mean_value = mean(c_across(matches("^\\d{4}$")), na.rm = TRUE),
        .groups = 'drop'
    ) %>%
    filter(!is.na(mean_value))

# Create wide format with explicit numeric conversion
wide_data <- processed_data %>%
    pivot_wider(
        names_from = `WEO Subject Code`,
        values_from = mean_value
    ) %>%
    drop_na()

# Ensure numeric data for scaling
numeric_data <- wide_data %>% 
    select(-Country) %>%
    mutate(across(everything(), as.numeric))

# Now scale the data
scaled_data <- scale(numeric_data)
rownames(scaled_data) <- wide_data$Country

The resulting dataset had dimensions of 38 countries by 10 economic indicators, with no missing values and only non-zero variance columns retained for the analysis.

2.4. Data Quality Analysis

# Process data with quality checks
processed_data <- data %>%
    filter(Country %in% advanced_economies,
           `WEO Subject Code` %in% indicators) %>%
    select(Country, `WEO Subject Code`, `2015`:`2023`)

# Missing value analysis
missing_analysis <- processed_data %>%
    gather(Year, Value, -Country, -`WEO Subject Code`) %>%
    group_by(`WEO Subject Code`, Year) %>%
    summarise(
        Missing = sum(Value %in% c("n/a", "--")),
        Missing_Pct = Missing / n() * 100,
        .groups = 'drop'
    )

# Visualize missing data
ggplot(missing_analysis, 
       aes(x = Year, y = `WEO Subject Code`, fill = Missing_Pct)) +
    geom_tile() +
    scale_fill_viridis() +
    theme_minimal() +
    labs(title = "Missing Data Heatmap",
         fill = "% Missing")

# Handle missing values
clean_data <- processed_data %>%
    mutate(across(matches("^\\d{4}$"), 
                 ~as.numeric(ifelse(. %in% c("n/a", "--"), NA, .))))

The heatmap visualization shows remarkably complete data coverage across all economic indicators from 2015 to 2023. The consistent dark green coloring indicates minimal missing values, suggesting high data quality and reliability across the selected advanced economies. This completeness strengthens the validity of our subsequent analyses.

2.4. Outlier Analysis

# Calculate z-scores for numeric variables
outlier_analysis <- numeric_data %>%
    mutate(across(everything(), scale)) %>%
    gather(Variable, Z_Score) %>%
    filter(abs(Z_Score) > 3)

# Visualize outliers
ggplot(outlier_analysis, 
       aes(x = Variable, y = Z_Score)) +
    geom_point() +
    theme_minimal() +
    theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
    labs(title = "Outlier Detection using Z-Scores",
         y = "Standardized Value")

Z-score based outlier analysis identified a few notable outliers across different variables:

  • Government-related indicators (GGXCNL_NGDP, GGXWDG_NGDP) show the highest standardized values

  • Unemployment rate (LUR) and GDP metrics (NGDP_RPCH, NGDPRPPPPC) also exhibit some outlying observations

  • These outliers were retained for analysis as they represent genuine economic variations rather than data errors.

2.4. Correlation Analysis

# First create the processed data frame
processed_data <- data %>%
    filter(Country %in% advanced_economies,
           `WEO Subject Code` %in% indicators) %>%
    select(Country, `WEO Subject Code`, `2015`:`2023`) %>%
    mutate(across(matches("^\\d{4}$"), 
                 ~as.numeric(ifelse(. %in% c("n/a", "--"), NA, .))))

# Create wide format data
wide_data <- processed_data %>%
    group_by(Country, `WEO Subject Code`) %>%
    summarise(
        mean_value = mean(c_across(matches("^\\d{4}$")), na.rm = TRUE),
        .groups = 'drop'
    ) %>%
    pivot_wider(
        names_from = `WEO Subject Code`,
        values_from = mean_value
    ) %>%
    drop_na()

# Create numeric data for PCA
numeric_data <- wide_data %>% 
    select(-Country) %>%
    mutate(across(everything(), as.numeric))

# Scale the data
scaled_data <- scale(numeric_data)
rownames(scaled_data) <- wide_data$Country

# Correlation analysis
correlation_matrix <- cor(numeric_data, use = "complete.obs")
corrplot(correlation_matrix, 
         method = "color",
         type = "upper",
         order = "hclust",
         addCoef.col = "black",
         number.cex = 0.7,
         tl.col = "black",
         tl.srt = 45)

# VIF analysis
vif_data <- lm(scale(NGDP_RPCH) ~ ., data = as.data.frame(numeric_data))
vif_results <- vif(vif_data)
print(vif_results)
##     GGR_NGDP  GGXCNL_NGDP  GGXWDG_NGDP     GGX_NGDP          LUR   NGDPRPPPPC 
## 5.123705e+09 3.281048e+08 1.710672e+00 5.087479e+09 2.075006e+00 1.578762e+00 
##     NID_NGDP     PCPIEPCH      PCPIPCH 
## 1.314139e+00 9.249751e+01 9.560172e+01

The correlation analysis revealed several significant relationships:

  • Strong positive correlation (0.97) between government revenue (GGR_NGDP) and expenditure (GGX_NGDP)

  • Notable negative correlation between unemployment (LUR) and GDP per capita (NGDPRPPPPC)

  • Limited correlation between inflation measures and other indicators, suggesting their independent variation

  • These patterns align with economic theory and support the validity of our indicator selection.

3. Impact of COVID-19

3.1. Pre vs. Post COVID Analysis

# Split data into periods
period_comparison <- clean_data %>%
    gather(Year, Value, -Country, -`WEO Subject Code`) %>%
    mutate(
        Period = case_when(
            Year %in% c("2015","2016","2017","2018","2019") ~ "Pre-COVID",
            Year %in% c("2020","2021") ~ "During-COVID",
            Year %in% c("2022","2023") ~ "Post-COVID"
        )
    ) %>%
    group_by(Country, `WEO Subject Code`, Period) %>%
    summarise(
        Mean_Value = mean(Value, na.rm = TRUE),
        SD_Value = sd(Value, na.rm = TRUE),
        .groups = 'drop'
    )

# Visualize period differences
ggplot(period_comparison, 
       aes(x = Period, y = Mean_Value, fill = Period)) +
    geom_boxplot() +
    facet_wrap(~`WEO Subject Code`, scales = "free_y") +
    theme_minimal() +
    theme(axis.text.x = element_text(angle = 45)) +
    labs(title = "Economic Indicators Across COVID-19 Periods")

The boxplot comparison across COVID-19 periods shows clear structural breaks:

  • Sharp increases in government expenditure during COVID

  • Significant volatility in GDP growth rates

  • Notable inflation spikes in the post-COVID period

  • Varying recovery patterns across different economic indicators

These findings suggest high data quality and reinforce the importance of accounting for COVID-19’s impact in our subsequent analyses.

4. Principal Component Analysis (PCA)

PCA was performed to reduce the dimensionality of the dataset.

# Perform PCA
pca_result <- prcomp(scaled_data)

# Create scree plot
fviz_eig(pca_result, 
         addlabels = TRUE, 
         ylim = c(0, 60),
         main = "Scree Plot: Variance Explained by Principal Components")

The scree plot provides an overview of the variance explained by each principal component. This visualization is a crucial step in determining the appropriate number of components to retain for the subsequent analysis.

The plot shows that the first two principal components explain approximately 53% of the total variance in the data. This indicates that a significant portion of the economic variation across the advanced economies can be captured by focusing on these top two components.

The steep decline in the percentage of variance explained after the first few components suggests that the data can be effectively reduced to a lower-dimensional subspace without losing too much of the original information. Selecting the number of components based on the 80% cumulative variance threshold is a common approach, which would lead to retaining the first four principal components in this case.

Interpreting the loadings and relative importance of the individual economic indicators on these principal components will provide valuable insights into the key drivers of variation among the advanced economies.

# Calculate explained variance
var_explained <- pca_result$sdev^2 / sum(pca_result$sdev^2)
cum_var_explained <- cumsum(var_explained)

# Find number of components needed for 80% variance
n_components <- which(cum_var_explained >= 0.8)[1]

print("Variance explained by principal components:")
## [1] "Variance explained by principal components:"
print(data.frame(
    Component = paste0("PC", 1:length(var_explained)),
    Variance = var_explained,
    Cumulative = cum_var_explained
))
##    Component     Variance Cumulative
## 1        PC1 2.995187e-01  0.2995187
## 2        PC2 2.314588e-01  0.5309775
## 3        PC3 1.420141e-01  0.6729916
## 4        PC4 1.122281e-01  0.7852198
## 5        PC5 7.422317e-02  0.8594430
## 6        PC6 5.975949e-02  0.9192024
## 7        PC7 4.784764e-02  0.9670501
## 8        PC8 3.243893e-02  0.9994890
## 9        PC9 5.109882e-04  1.0000000
## 10      PC10 9.405536e-12  1.0000000
# Extract PC scores for clustering
pc_scores <- as.data.frame(pca_result$x[, 1:n_components])

The analysis of the scree plot revealed that the first four principal components collectively explain approximately 79% of the total variance in the data. Retaining the first four principal components aligns with the general recommendation of explaining at least 80% of the total variance, which is a commonly used threshold. This dimensionality reduction step will allow the subsequent clustering analysis to focus on the most influential economic dimensions while minimizing the loss of information.

The principal component scores for these first four components were extracted and stored in the pc_scores data frame, ready to be used as input for the clustering algorithms.

3.1. Interpret Principal Components

# Create loadings visualization
loadings_df <- as.data.frame(pca_result$rotation[, 1:n_components])
loadings_df$Variable <- rownames(pca_result$rotation)

# Plot loadings for PC1 and PC2
p1 <- ggplot(loadings_df, aes(PC1, reorder(Variable, PC1))) +
    geom_bar(stat = "identity") +
    theme_minimal() +
    labs(title = "PC1 Loadings",
         x = "Loading Value",
         y = "Variable")

p2 <- ggplot(loadings_df, aes(PC2, reorder(Variable, PC2))) +
    geom_bar(stat = "identity") +
    theme_minimal() +
    labs(title = "PC2 Loadings",
         x = "Loading Value",
         y = "Variable")

print(p1)

print(p2)

The principal component loadings, as visualized in Image 1 and Image 2, provide insights into the key economic dimensions driving the variation among the advanced economies.

PC1 Loadings

The first principal component (PC1) is heavily influenced by government-related indicators, such as:

  • GGX_NGDP (Government Expenditure as % of GDP)
  • GGR_NGDP (Government Revenue as % of GDP)
  • GGXWDG_NGDP (Government Gross Debt as % of GDP)

This suggests that the first principal component captures the economic variation associated with the size and role of the government sector within these advanced economies.

PC2 Loadings

The second principal component (PC2) is more closely aligned with indicators related to economic growth and productivity, such as:

  • NGDPRPPPPC (GDP per capita, constant prices)
  • NGDP_RPCH (GDP Growth Rate)
  • NID_NGDP (Total Investment as % of GDP)

This indicates that the second component represents the economic performance and investment dynamics of the advanced economies.

The contrast between the government-focused PC1 and the growth/productivity-focused PC2 highlights the multidimensional nature of economic development and the potential trade-offs or complementarities between these aspects.

Examining the relative loading values for each indicator on these principal components provides a clear understanding of the key drivers of economic variation across the advanced economies. This insight will be crucial for interpreting the clustering results in the subsequent analysis.

4. Clustering Analysis

To determine the appropriate number of clusters for the analysis, two common methods were employed:

# Determine optimal number of clusters
set.seed(123)

# Elbow method
p1 <- fviz_nbclust(pc_scores, kmeans, method = "wss") +
    ggtitle("Elbow Method")

print(p1)

The Elbow Method, shown above plots the total within-cluster sum of squares (WCSS) against the number of clusters. The “elbow” in the plot, where the rate of decrease in WCSS starts to diminish, is typically used to identify the optimal number of clusters.

In the Elbow Method plot, the curve shows a clear elbow around 4 clusters, indicating that a 4-cluster solution may be appropriate for this dataset. This aligns with the general guideline of selecting the number of clusters where the marginal gain in explanatory power starts to level off, as adding more clusters beyond this point would provide diminishing returns.

The Elbow Method provides a data-driven and intuitive approach to determining the appropriate number of clusters, based on the explanatory power captured by the clustering solution. This initial assessment, along with the results from the Silhouette Method, will be used to guide the selection of the final number of clusters for the advanced economies.

# Silhouette method
p2 <- fviz_nbclust(pc_scores, kmeans, method = "silhouette") +
    ggtitle("Silhouette Method")

print(p2)

The Silhouette Method calculates a silhouette score for each observation, which measures how well an observation fits within its assigned cluster compared to other clusters. The average silhouette score across all observations provides an overall evaluation of the clustering solution.

The Silhouette Method plot shows the average silhouette width for different numbers of clusters. A higher silhouette score indicates a better clustering structure, with values close to 1 representing a strong cluster assignment, and values near 0 or negative indicating poorly defined or overlapping clusters.

The plot reveals a peak in the average silhouette width around 4 clusters, further supporting the selection of a 4-cluster solution for the advanced economies. This aligns with the insights from the Elbow Method, providing additional confidence in the choice of the optimal number of clusters.

The combination of the Elbow Method and Silhouette Method analyses offers a robust, data-driven approach to determining the appropriate number of clusters to use in the subsequent clustering algorithms. The consistent indication of a 4-cluster structure suggests that this level of granularity effectively captures the underlying economic patterns among the advanced economies.

4.2 K-means Clustering

# Perform k-means clustering
k <- 4 # Based on optimal number of clusters
set.seed(123)

# Create pc_scores from PCA result (make sure this happens after PCA)
pc_scores <- as.data.frame(pca_result$x[, 1:n_components])

# Perform kmeans clustering
kmeans_result <- kmeans(pc_scores, centers = k, nstart = 25)

# Add cluster assignments to original data
# Use all numeric columns instead of valid_columns
results_df <- data.frame(
    Country = wide_data$Country,
    Cluster = as.factor(kmeans_result$cluster),
    wide_data[, colnames(numeric_data)]  # Using numeric_data columns instead of valid_columns
)

# Visualize clusters with fixed color settings
fviz_cluster(kmeans_result, 
             data = pc_scores,
             labelsize = 8,
             repel = TRUE,
             ggtheme = theme_minimal(),
             palette = "jco",         # Use a predefined color palette
             main = "K-means Clustering Results") +
  theme(legend.position = "right")

The K-means clustering algorithm was applied to the principal component scores to group the advanced economies into distinct clusters based on their economic similarities and differences. The optimal number of clusters was determined to be 4, as supported by the Elbow Method and Silhouette Method analyses.

The resulting cluster assignments are visualized in the PCA biplot (Image 7). Each country is represented by a point, and the points are colored based on their cluster membership.

The clustering results reveal several interesting insights:

  1. Cluster 1 (Blue): This cluster includes countries like Greece, Spain, and Portugal, which are characterized by lower GDP growth, higher government involvement, and moderate levels of inflation and unemployment.

  2. Cluster 2 (Yellow): The countries in this cluster, such as Puerto Rico, Macao SAR, and Singapore, exhibit higher GDP growth, lower government revenue and expenditure, and more moderate economic indicators overall.

  3. Cluster 3 (Grey): This cluster contains the majority of the advanced economies, including Australia, Austria, and Canada. These countries demonstrate a more balanced economic profile, with moderate levels across the key indicators.

  4. Cluster 4 (Red): The countries in this cluster, comprising Denmark, Luxembourg, and Norway, stand out with higher GDP per capita, lower government debt, and larger government surpluses.

The clear separation of the clusters in the PCA biplot suggests that the K-means algorithm has effectively grouped the advanced economies based on their underlying economic characteristics and performance. This data-driven clustering approach provides a nuanced understanding of the economic diversity within the set of advanced economies.

4.2 Hierarchial Clustering

Hierarchical clustering was performed to validate the results from k-means clustering. The dendrogram below shows the clustering structure.

# Hierarchical clustering
dist_matrix <- dist(pc_scores, method = "euclidean")
hc_result <- hclust(dist_matrix, method = "ward.D2")

# Plot dendrogram with explicit color settings
fviz_dend(hc_result, 
          k = k,
          cex = 0.7,
          k_colors = "jco",          # Use predefined color palette
          rect = TRUE,
          rect_fill = TRUE,
          rect_border = "jco",
          main = "Hierarchical Clustering Dendrogram")

The hierarchical clustering dendrogram provides a visual representation of the clustering structure among the advanced economies. This complementary analysis to the K-means clustering helps validate the grouping of countries based on their economic similarities.

The dendrogram depicts the progressive merging of countries and clusters, with the height of the branches indicating the degree of dissimilarity between them. Countries that are more similar in their economic profiles are joined together at lower heights, while those with greater differences are merged at higher levels.

Examining the dendrogram, we can observe the following:

  1. The dendrogram supports the selection of 4 distinct clusters, as the clear separation between the main branches aligns with the 4-cluster solution identified through the Elbow Method and Silhouette Method.

  2. The clustering at the lower levels of the dendrogram suggests the presence of subclusters within the broader 4-cluster structure. For example, we can see that Spain, Greece, and Portugal form a tighter subcluster within the first main cluster.

  3. The relative heights of the merging points indicate the degree of dissimilarity between the clusters. The large vertical distance between the first cluster and the other clusters suggests that this group of countries has the most distinct economic characteristics compared to the rest.

  4. The dendrogram also highlights potential outliers or unique cases, such as Norway, Luxembourg, and Denmark, which merge at a relatively higher level, indicating they have more distinctive economic profiles compared to the majority of the advanced economies.

The hierarchical clustering dendrogram complements the insights from the K-means clustering, providing a more granular view of the economic relationships and the hierarchical structure within the set of advanced economies. This analysis strengthens the understanding of the underlying economic patterns and the degree of similarity or dissimilarity among the countries.

# Add cluster assignments to original data
results_df <- data.frame(
    Country = wide_data$Country,
    Cluster = as.factor(kmeans_result$cluster),
    wide_data[, colnames(numeric_data)]  # Using numeric_data columns instead of valid_columns
)

# Calculate cluster characteristics
cluster_summary <- results_df %>%
    group_by(Cluster) %>%
    summarise(
        across(-Country, mean),
        n = n(),
        Countries = paste(Country, collapse = ", ")
    ) %>%
    arrange(Cluster)

print("Cluster Characteristics:")
## [1] "Cluster Characteristics:"
print(cluster_summary)
## # A tibble: 4 × 13
##   Cluster GGR_NGDP GGXCNL_NGDP GGXWDG_NGDP GGX_NGDP   LUR NGDPRPPPPC NGDP_RPCH
##   <fct>      <dbl>       <dbl>       <dbl>    <dbl> <dbl>      <dbl>     <dbl>
## 1 1           45.1       -3.18       133.      48.3 10.1      46071.      1.75
## 2 2           25.0       -1.42        47.0     26.4  4.46     71144.      3.11
## 3 3           41.3       -2.27        64.3     43.5  5.74     54017.      2.20
## 4 4           50.9        3.76        32.7     47.2  4.53     96818.      2.01
## # ℹ 5 more variables: NID_NGDP <dbl>, PCPIEPCH <dbl>, PCPIPCH <dbl>, n <int>,
## #   Countries <chr>
# Create cluster profile visualization
cluster_profiles <- cluster_summary %>%
    select(-n, -Countries) %>%
    pivot_longer(-Cluster, names_to = "Variable", values_to = "Value")

# Plot cluster profiles with explicit color settings
ggplot(cluster_profiles, 
       aes(x = Variable, y = Value, 
           color = Cluster, group = Cluster)) +
    geom_line() +
    geom_point() +
    scale_color_brewer(palette = "Set2") +  # Use a ColorBrewer palette
    theme_minimal() +
    theme(
        axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "right"
    ) +
    labs(title = "Cluster Profiles",
         y = "Standardized Value",
         x = "Economic Indicator")

The cluster profile visualization provides a deeper look into the economic characteristics of each cluster identified through the clustering analysis.

Cluster 1 (Blue): This cluster, which includes countries like Cyprus, Finland, and France, is characterized by higher government revenue and expenditure, lower GDP growth, and moderate inflation and unemployment rates.

Cluster 2 (Orange): The countries in this cluster, such as Ireland, Israel, and Korea, exhibit higher GDP growth, lower government involvement, and more moderate levels of inflation and unemployment.

Cluster 3 (Grey): This cluster, which contains a majority of the advanced economies, including Australia, Austria, and Canada, demonstrates a more balanced economic profile, with moderate values across the key indicators.

Cluster 4 (Red): The countries in this cluster, comprising Denmark, Luxembourg, and Norway, stand out with higher GDP per capita, lower government debt, and larger government surpluses.

The distinct profiles of these clusters highlight the diversity in economic structures and policy approaches among the advanced economies. Some countries prioritize a larger government role, while others focus more on private sector-led growth. The clustering analysis has effectively captured these differences, providing a nuanced understanding of the economic patterns within this group of nations.

Analyzing the economic indicators in this manner, along with the insights from the principal component analysis and the hierarchical clustering, offers a comprehensive view of the multifaceted economic characteristics that define the advanced economies and their potential policy trade-offs and convergence paths.

5. Combined Analysis: PCA and Clustering

5.1. Combined Analysis: PCA and Clustering

fviz_pca_biplot(pca_result,
                # Individual points (countries)
                col.ind = factor(kmeans_result$cluster),
                palette = "jco",
                # Variable arrows
                col.var = "black",
                # Labels
                label.ind = TRUE,
                label.var = TRUE,
                # Repulsion
                repel = TRUE,
                # Add cluster ellipses
                addEllipses = TRUE,
                # Title
                title = "PCA Biplot with Cluster Assignments",
                ggtheme = theme_minimal())

# Create detailed cluster profiles
detailed_profiles <- results_df %>%
    group_by(Cluster) %>%
    summarise(
        across(-Country, list(
            mean = mean,
            sd = sd
        )),
        n_countries = n(),
        countries = paste(Country, collapse = ", ")
    )

print("Detailed Cluster Profiles:")
## [1] "Detailed Cluster Profiles:"
print(detailed_profiles)
## # A tibble: 4 × 23
##   Cluster GGR_NGDP_mean GGR_NGDP_sd GGXCNL_NGDP_mean GGXCNL_NGDP_sd
##   <fct>           <dbl>       <dbl>            <dbl>          <dbl>
## 1 1                45.1        6.73            -3.18           1.75
## 2 2                25.0        6.85            -1.42           2.38
## 3 3                41.3        5.85            -2.27           1.77
## 4 4                50.9        6.58             3.76           4.39
## # ℹ 18 more variables: GGXWDG_NGDP_mean <dbl>, GGXWDG_NGDP_sd <dbl>,
## #   GGX_NGDP_mean <dbl>, GGX_NGDP_sd <dbl>, LUR_mean <dbl>, LUR_sd <dbl>,
## #   NGDPRPPPPC_mean <dbl>, NGDPRPPPPC_sd <dbl>, NGDP_RPCH_mean <dbl>,
## #   NGDP_RPCH_sd <dbl>, NID_NGDP_mean <dbl>, NID_NGDP_sd <dbl>,
## #   PCPIEPCH_mean <dbl>, PCPIEPCH_sd <dbl>, PCPIPCH_mean <dbl>,
## #   PCPIPCH_sd <dbl>, n_countries <int>, countries <chr>

The PCA biplot with cluster assignments (Image 10) provides a comprehensive visualization of the relationship between the principal components and the grouping of countries based on the K-means clustering analysis.

The clear separation of the clusters in the biplot indicates that the principal components effectively capture the underlying economic dimensions that drive the similarities and differences among the advanced economies. Each cluster occupies a distinct region of the biplot, demonstrating the effectiveness of the clustering approach in identifying distinct economic patterns.

Some key observations from the combined PCA and clustering analysis:

Cluster 1 (Blue): The countries in this cluster, such as Greece and Spain, are positioned on the left side of the biplot, suggesting they have lower values on the first principal component, which is associated with government-related indicators.

Cluster 2 (Yellow): The countries in this cluster, including Taiwan Province of China and Singapore, are located in the upper-right quadrant, indicating higher values on the second principal component, which is more closely aligned with economic growth and productivity measures.

Cluster 3 (Grey): The majority of the advanced economies, like Austria and Canada, are grouped in the center of the biplot, reflecting their more balanced economic profiles across the principal components.

Cluster 4 (Red): The countries in this cluster, such as Denmark and Norway, are situated on the right side of the biplot, suggesting they have higher values on the first principal component, corresponding to their strong fiscal positions and lower government debt levels.

The PCA biplot with cluster assignments provides a powerful visualization that integrates the dimensionality reduction and clustering techniques, offering a comprehensive understanding of the economic patterns and the relative positioning of the advanced economies. This combined analysis highlights the interplay between the underlying economic drivers and the resulting grouping of countries based on their multidimensional economic characteristics.

5.2. Interpret Clusters

# Summary statistics for each cluster
cluster_summary <- results_df %>%
  group_by(Cluster) %>%
  summarise(across(colnames(numeric_data), 
                  list(
                    mean = ~mean(., na.rm = TRUE),
                    sd = ~sd(., na.rm = TRUE)
                  )), 
            n = n(),
            countries = paste(Country, collapse = ", ")) %>%
  arrange(Cluster)

# Print summary with formatting
print("Cluster Summary Statistics:")
## [1] "Cluster Summary Statistics:"
print(cluster_summary, width = Inf)
## # A tibble: 4 × 23
##   Cluster GGR_NGDP_mean GGR_NGDP_sd GGXCNL_NGDP_mean GGXCNL_NGDP_sd
##   <fct>           <dbl>       <dbl>            <dbl>          <dbl>
## 1 1                45.1        6.73            -3.18           1.75
## 2 2                25.0        6.85            -1.42           2.38
## 3 3                41.3        5.85            -2.27           1.77
## 4 4                50.9        6.58             3.76           4.39
##   GGXWDG_NGDP_mean GGXWDG_NGDP_sd GGX_NGDP_mean GGX_NGDP_sd LUR_mean LUR_sd
##              <dbl>          <dbl>         <dbl>       <dbl>    <dbl>  <dbl>
## 1            133.           55.8           48.3        6.96    10.1    4.80
## 2             47.0          34.7           26.4        7.63     4.46   2.11
## 3             64.3          28.7           43.5        5.23     5.74   1.33
## 4             32.7           8.83          47.2        3.61     4.53   1.04
##   NGDPRPPPPC_mean NGDPRPPPPC_sd NGDP_RPCH_mean NGDP_RPCH_sd NID_NGDP_mean
##             <dbl>         <dbl>          <dbl>        <dbl>         <dbl>
## 1          46071.         7939.           1.75        1.25           20.7
## 2          71144.        26325.           3.11        2.52           23.2
## 3          54017.        11508.           2.20        0.714          22.8
## 4          96818.        34898.           2.01        0.452          22.6
##   NID_NGDP_sd PCPIEPCH_mean PCPIEPCH_sd PCPIPCH_mean PCPIPCH_sd     n
##         <dbl>         <dbl>       <dbl>        <dbl>      <dbl> <int>
## 1        3.55          1.87       0.424         1.77      0.446     8
## 2        5.82          1.69       0.478         1.60      0.478    11
## 3        2.34          3.37       0.747         3.24      0.758    16
## 4        4.45          2.59       0.687         2.44      0.665     3
##   countries                                                                     
##   <chr>                                                                         
## 1 Cyprus, Finland, France, Greece, Italy, Japan, Portugal, Spain                
## 2 Hong Kong SAR, Ireland, Israel, Korea, Macao SAR, Malta, Puerto Rico, San Mar…
## 3 Australia, Austria, Belgium, Canada, Estonia, Germany, Iceland, Latvia, Lithu…
## 4 Denmark, Luxembourg, Norway
# Create a more focused summary for key indicators
key_indicators_summary <- results_df %>%
  group_by(Cluster) %>%
  summarise(
    `GDP Growth (%)` = mean(NGDP_RPCH, na.rm = TRUE),
    `Inflation (%)` = mean(PCPIPCH, na.rm = TRUE),
    `Unemployment (%)` = mean(LUR, na.rm = TRUE),
    `Govt Revenue (% GDP)` = mean(GGR_NGDP, na.rm = TRUE),
    `Govt Expenditure (% GDP)` = mean(GGX_NGDP, na.rm = TRUE),
    `Countries` = n(),
    .groups = 'drop'
  ) %>%
  arrange(Cluster)

print("\nKey Indicators by Cluster:")
## [1] "\nKey Indicators by Cluster:"
print(key_indicators_summary, digits = 2)
## # A tibble: 4 × 7
##   Cluster `GDP Growth (%)` `Inflation (%)` `Unemployment (%)`
##   <fct>              <dbl>           <dbl>              <dbl>
## 1 1                   1.75            1.77              10.1 
## 2 2                   3.11            1.60               4.46
## 3 3                   2.20            3.24               5.74
## 4 4                   2.01            2.44               4.53
## # ℹ 3 more variables: `Govt Revenue (% GDP)` <dbl>,
## #   `Govt Expenditure (% GDP)` <dbl>, Countries <int>

The cluster summary table provides a comprehensive overview of the key economic characteristics for each of the four clusters identified through the clustering analysis. Let’s dive deeper into the insights:

Cluster 1 (45.1% Government Revenue, 10.1% Unemployment):

This cluster is marked by the highest government revenue and expenditure levels among the advanced economies. However, it also has the lowest GDP growth rate, indicating a potential trade-off between the size of the government sector and economic dynamism. The high government involvement is further reflected in the cluster’s elevated government debt levels. Despite the strong government presence, the cluster exhibits moderate inflation and investment levels.

Cluster 2 (25.0% Government Revenue, 4.46% Unemployment):

Countries in this cluster exhibit the lowest government revenue and expenditure as a percentage of GDP, along with the lowest unemployment rates. They also demonstrate the highest GDP growth rates, suggesting a more private sector-driven economic model. This cluster’s profile reflects a focus on economic competitiveness and growth-oriented policies.

Cluster 3 (41.3% Government Revenue, 5.74% Unemployment):

This cluster represents the majority of the advanced economies and displays a more balanced economic profile. Government involvement, GDP growth, inflation, and unemployment levels are all moderate compared to the other clusters. This cluster likely encompasses countries that have found a middle ground between government intervention and market-driven economic forces.

Cluster 4 (50.9% Government Revenue, 4.53% Unemployment):

The countries in this cluster, such as Denmark, Luxembourg, and Norway, stand out with the highest GDP per capita and the lowest government debt levels. They also have the largest government surpluses, indicating strong fiscal positions and the ability to maintain sustainable public finances. This cluster’s economic characteristics suggest a focus on social welfare and economic stability, potentially at the expense of higher GDP growth rates.

The diversity of economic structures and policy approaches captured by these clusters highlights the multifaceted nature of economic development among advanced economies. Understanding these differences is crucial for informing policy decisions and identifying potential areas of convergence or divergence within this group of nations.

5.3 Detailed Results Interpretation

5.3.1. Economic Pattern Analysis

The analysis reveals four distinct economic models among advanced economies, each with unique characteristics:

Liberal Market Model (Cluster 2)

The liberal market economies are characterized by minimal government involvement, with average government revenue at 25.0% of GDP. These economies demonstrate consistently higher growth rates and strong private sector participation in economic activity. Countries like Singapore, Ireland, and Hong Kong SAR exemplify this model, showing that market-driven approaches can effectively achieve economic dynamism while maintaining relatively low unemployment rates of around 4.46%.

Social Democratic Model (Cluster 4)

The social democratic economies maintain high government revenue, averaging 50.9% of GDP, while delivering efficient public services. Despite the substantial public sector presence, these economies maintain remarkably low unemployment rates of 4.53%. Countries such as Denmark, Norway, and Luxembourg demonstrate that high government involvement, when properly structured, can coexist with strong economic performance. This model effectively combines social protection with economic efficiency.

Mixed Economy Model (Cluster 3)

The mixed economy approach represents a balanced model with moderate government involvement (41.3% of GDP). These economies, including Germany, Canada, and Australia, maintain stable performance across all economic indicators. This cluster demonstrates that a middle path between state intervention and market forces can produce consistent economic outcomes while avoiding extreme fluctuations in key indicators.

Mediterranean Model (Cluster 1)

The Mediterranean economies show high government involvement (45.1% of GDP) coupled with structural challenges. These economies experience higher unemployment rates (10.1%) and generally lower growth rates compared to other clusters. Countries like Greece, Spain, and Italy illustrate the potential challenges of maintaining high levels of social protection without corresponding institutional efficiency.

5.3.2 Policy Implications

Fiscal Policy

The analysis demonstrates that various fiscal models can achieve economic success when properly aligned with their institutional frameworks. The size of government appears less crucial than the efficiency of public spending and its alignment with economic objectives. This finding suggests that policymakers should focus on developing context-specific fiscal approaches rather than adhering to predetermined optimal government sizes.

Labor Market Policy

Successful economic models across clusters demonstrate the importance of combining labor market flexibility with social security. The data shows that high government involvement does not necessarily impede employment outcomes, as evidenced by the low unemployment rates in Cluster 4 countries. Effective labor market policies appear to be more important than the absolute level of government intervention.

Growth Strategy

The analysis reveals multiple pathways to economic success, with each cluster achieving stability through different combinations of policies. The key to success appears to lie in aligning economic policies with institutional capabilities and ensuring coherence across different policy domains. This finding challenges the notion of a single optimal economic model.

5.3.3 COVID-19 Impact Assessment

The analysis of economic performance across the pre-COVID, during-COVID, and post-COVID periods reveals significant variations in resilience and recovery patterns across different economic models. The data shows that government revenue (GGR_NGDP) increased across all clusters during the pandemic, with the most substantial increases observed in Cluster 1 economies. This trend reflects the widespread adoption of expansionary fiscal policies in response to the crisis.

Unemployment patterns during the COVID-19 period demonstrate the effectiveness of different labor market institutions. Cluster 4 economies maintained relatively stable unemployment rates throughout the crisis, suggesting that their robust social protection systems and labor market institutions effectively buffered the economic shock. In contrast, Cluster 1 economies experienced more significant unemployment fluctuations, indicating less resilient labor market structures.

Investment behavior (NID_NGDP) showed marked differences across clusters during the crisis period. Cluster 2 economies maintained relatively higher investment levels throughout the pandemic, suggesting that market-oriented economies were able to adapt more quickly to changing economic conditions. The recovery trajectories also varied significantly, with Cluster 2 and 4 economies showing faster returns to pre-pandemic investment levels.

5.4 Future Considerations

Convergence and Divergence Patterns

Despite increasing global economic integration, the analysis reveals persistent differences in economic models among advanced economies. The clustering results suggest that economic convergence remains limited, with distinct approaches to economic management continuing to yield different but successful outcomes. This finding challenges the assumption that globalization necessarily leads to the homogenization of economic systems.

Institutional Path Dependence

The stability of cluster memberships over time indicates strong institutional path dependence in economic development. Countries tend to maintain their characteristic approaches to economic management even in the face of external shocks. This persistence suggests that successful reform strategies must account for existing institutional frameworks rather than attempting wholesale transplantation of models from other clusters.

Policy Evolution Opportunities

The analysis identifies several opportunities for policy learning across clusters. For instance, Cluster 1 economies might benefit from adopting certain institutional features from Cluster 4 that enable high government involvement without sacrificing economic dynamism. Similarly, Cluster 2 economies might enhance their social protection systems while maintaining their market orientation by studying specific aspects of Cluster 3’s balanced approach.

Adaptation to Future Challenges

The varying responses to the COVID-19 crisis suggest different levels of preparedness for future economic shocks. The analysis indicates that economies with robust institutional frameworks, regardless of their cluster, demonstrated greater resilience. This finding has important implications for policy design in an era of increasing global uncertainty and rapid technological change.

5.4 Reform Considerations

The analysis suggests that successful economic reforms require careful consideration of three key factors:

The existing institutional framework and its compatibility with proposed changes must be carefully evaluated. The data shows that successful economies in each cluster have achieved coherence between their institutions and economic policies.

The sequencing of reforms appears crucial, as indicated by the different recovery patterns from the COVID-19 shock. Gradual adaptation of existing models may be more effective than radical systemic changes.

The complementarity between different policy areas needs to be maintained. The analysis reveals that successful economies in each cluster have achieved synergies between their fiscal, labor market, and social policies.

6. Discussion and Implications

6.1 Principal Component Analysis Insights

The PCA reveals critical dimensions of economic variation among advanced economies. The dimensionality reduction demonstrates that a small number of principal components can capture the majority of variance in economic indicators, suggesting that economic performance is driven by a few fundamental underlying factors.

The loadings of different economic indicators on the principal components provide insights into the structural relationships between various metrics. This offers a nuanced understanding of the interdependencies within these economies, with implications for economic policy and institutional frameworks.

6.2 Clustering Analysis Implications

The clustering analysis offers a data-driven perspective on economic convergence and divergence among advanced economies. The formation of distinct clusters suggests that while these economies share some characteristics, there are significant structural differences in their economic configurations.

The clustering results can be interpreted in the context of potential similarities in economic management approaches, reflecting underlying institutional frameworks, regulatory environments, and economic philosophies. This can inform comparative studies on policy regime convergence and the drivers of economic clustering.

6.3 Methodological Contributions

The study demonstrates the effectiveness of combining PCA and clustering techniques to analyze complex economic data. This approach provides a data-driven classification of economies, the ability to identify non-linear relationships, and a visual representation of economic patterns that may be obscured by traditional analytical methods.

7. Recommendations for Further Research

Building on the insights from this analysis, several directions for future research can be explored:

Temporal Dynamics:

Extend the analysis to include time-series techniques to understand how economic clusters evolve over time and capture changing economic relationships.

Alternative Dimensionality Reduction:

Explore non-linear dimensionality reduction methods, such as t-SNE or UMAP, to validate the findings and potentially uncover more complex economic relationships.

Expanded Indicator Set:

Incorporate additional economic metrics, such as research and development expenditure, innovation indices, digital economy measures, and green economy indicators, to capture a more comprehensive view of economic performance.

Expanded Country Coverage:

Broaden the analysis to include emerging market economies and developing countries, enabling comparative studies across different economic groupings.

Advanced Analytical Approaches:

Implement supervised learning techniques to predict economic cluster membership, use ensemble clustering methods to improve robustness, and develop predictive models for economic performance based on cluster characteristics.

Policy-Oriented Research:

Analyze policy convergence within economic clusters, investigate the causal mechanisms behind cluster formation, and study how different clusters respond to global economic shocks.

These research directions can further enhance the understanding of economic patterns, inform policy decisions, and contribute to the broader literature on comparative economics and economic complexity.

8. Conclusion

This study provides a comprehensive, data-driven exploration of economic patterns among advanced economies. By leveraging unsupervised learning techniques, we have uncovered intricate relationships between economic indicators and developed a nuanced understanding of economic diversity.

The insights from this analysis can inform policy recommendations and guide future research directions, ultimately contributing to a more informed and evidence-based approach to economic policymaking and comparative economic analysis.

9. References