Skip to content
Senghak Rou
All projects

Statistics & Econometrics · Jul 2024

Mapping country indicators with PCA

A first-year statistics study: PCA of nine socio-economic indicators for 167 countries, computed step by step (standardisation, covariance, eigendecomposition) and interpreted.

Status
Completed
Setting
Individual projectENSAE first-year coursework — Introduction to Statistics
My role
Individual report and R code.
Methods and tools
R · R Markdown · factoextra · SAS

Overview

The dataset contains nine indicators for 167 countries, including child mortality, exports, health spending, imports, income, inflation, life expectancy, fertility and GDP per capita. After standardising each variable, PCA diagonalises the correlation matrix Σ^=1n−1X⊤X\hat\Sigma = \tfrac{1}{n-1}X^{\top}X.

What the analysis verifies and finds

  • The total inertia of the standardised data equals the sum of the eigenvalues (=9= 9, the number of variables): a check that the decomposition was computed correctly.
  • The first component explains 45.95 % of the variance and the second 17.18 %, so their two-dimensional map retains 63.13% of standardised variation. Differences along the remaining axes are invisible on that map.
  • The projections of individual countries on the first plane are then interpreted together with the variable loadings.

Variance explained by each principal component

Eigenvalues of the correlation matrix as a share of the total inertia (9, the number of variables).

01020304050Share of total variance (%)PC1PC1: eigenvalue 4.136, 45.95% of the variance45.95%PC2PC2: eigenvalue 1.546, 17.18% of the variance17.18%PC3PC3: eigenvalue 1.17, 13% of the variance13.00%PC4PC4: eigenvalue 0.995, 11.05% of the variance11.05%PC5PC5: eigenvalue 0.661, 7.34% of the variance7.34%PC6PC6: eigenvalue 0.224, 2.48% of the variance2.48%PC7PC7: eigenvalue 0.113, 1.26% of the variance1.26%PC8PC8: eigenvalue 0.088, 0.98% of the variance0.98%PC9PC9: eigenvalue 0.067, 0.74% of the variance0.74%
Data table
ComponentEigenvalueVariance (%)Cumulative (%)
PC14.13645.9545.95
PC21.54617.1863.13
PC31.171376.14
PC40.99511.0587.19
PC50.6617.3494.53
PC60.2242.4897.02
PC70.1131.2698.28
PC80.0880.9899.26
PC90.0670.74100
Figure 1 · AnalysisThe first two components carry 63 % of the variance. PC3 and PC4 explain about as much as a single standardised variable (11.1 %), and the last five much less.Source: Computed at build time from Country-data.csv (repository commit 577c910): 167 countries, 9 standardised indicators.

What the first component measures

Contribution of each indicator to PC1 (squared loading, %), with the sign of its loading.

  • Positive loading (+)
  • Negative loading (−)
05101520Contribution to PC1 (%)Life expectancy (+)Life expectancy: loading 0.426, contribution 18.1%18.1%Child mortality (−)Child mortality: loading -0.42, contribution 17.6%17.6%Fertility rate (−)Fertility rate: loading -0.404, contribution 16.3%16.3%Net income per person (+)Net income per person: loading 0.398, contribution 15.9%15.9%GDP per capita (+)GDP per capita: loading 0.393, contribution 15.4%15.4%Exports (% GDP) (+)Exports (% GDP): loading 0.284, contribution 8.1%8.1%Inflation (−)Inflation: loading -0.193, contribution 3.7%3.7%Imports (% GDP) (+)Imports (% GDP): loading 0.161, contribution 2.6%2.6%Health spending (% GDP) (+)Health spending (% GDP): loading 0.151, contribution 2.3%2.3%
Data table
IndicatorLoading on PC1Contribution (%)
Life expectancy0.42618.1
Child mortality-0.4217.6
Fertility rate-0.40416.3
Net income per person0.39815.9
GDP per capita0.39315.4
Exports (% GDP)0.2848.1
Inflation-0.1933.7
Imports (% GDP)0.1612.6
Health spending (% GDP)0.1512.3
Figure 2 · AnalysisLife expectancy, income and GDP per capita load positively; child mortality and fertility load negatively, with similar weight. PC1 is a development axis. Trade and inflation contribute less than the 11.1 % an equal share would give.Source: Computed at build time from Country-data.csv (repository commit 577c910): 167 countries, 9 standardised indicators.

The same repository holds a first-year descriptive-statistics study carried out in SAS.

Interpretation

The loadings describe which measured indicators vary together across these countries. The sign of a component can be reversed without changing the map. A country’s position therefore depends on the chosen axis orientation and the indicators included. The analysis offers a descriptive comparison of this sample.