Analisis Multivariat (PCA dan FA)

Fridania Nisa Calita(208)

Indah F. Salsabillah. R. Wadjo(210)

Link Dataset:HumanDevelopmentIndex.csv

Variabel Penelitian:

  • hdi

  • life_expectancy

  • pop_millions

  • expec_yr_school

  • mean_yr_school

  • gross_inc_percap

  • gender_development

  • gender_inequality

  • secondary_education_f

  • seats_in_parliament_f

  • labour_participation_f

  • labour_participation_m

  • co2_emission_tons

  • mat_footprint_percap_tons

library(psych)
library(vctrs)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:vctrs':
## 
##     data_frame
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(factoextra)
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(FactoMineR)
#import data
data <- read.csv("C:/Users/ASUS/Downloads/hdr_general.csv")
head(data)
##   X iso3     country hdicode hdi_rank_2022 gii_rank_2022 year   hdi
## 1 1  AFG Afghanistan     Low           182           162 1990 0.284
## 2 2  AFG Afghanistan     Low           182           162 1991 0.292
## 3 3  AFG Afghanistan     Low           182           162 1992 0.299
## 4 4  AFG Afghanistan     Low           182           162 1993 0.307
## 5 5  AFG Afghanistan     Low           182           162 1994 0.300
## 6 6  AFG Afghanistan     Low           182           162 1995 0.318
##   life_expectancy pop_millions hdi_f hdi_m life_expec_f life_expec_m
## 1          45.967     10.69480    NA    NA       48.397       43.709
## 2          46.663     10.74517    NA    NA       49.144       44.353
## 3          47.596     12.05743    NA    NA       50.320       45.070
## 4          51.466     14.00376    NA    NA       52.739       50.216
## 5          51.495     15.45555    NA    NA       53.544       49.531
## 6          52.544     16.41891    NA    NA       54.087       51.039
##   expec_yr_school expec_yr_school_f expec_yr_school_m mean_yr_school
## 1        2.936460          2.117230          4.532768      0.8719620
## 2        3.228456          2.246242          4.768261      0.9152675
## 3        3.520452          2.383115          5.015989      0.9585729
## 4        3.812448          2.528328          5.276587      1.0018784
## 5        4.104445          2.682390          5.550723      1.0451839
## 6        4.396441          2.845840          5.839102      1.0884894
##   mean_yr_school_f mean_yr_school_m gross_inc_percap gross_inc_percap_f
## 1        0.2016592         1.493952         3115.670                 NA
## 2        0.2189443         1.578809         2817.305                 NA
## 3        0.2362294         1.663665         2474.682                 NA
## 4        0.2535145         1.748522         1723.020                 NA
## 5        0.2707995         1.833378         1202.010                 NA
## 6        0.2880846         1.918235         1477.062                 NA
##   gross_inc_percap_m gender_development gender_inequality
## 1                 NA                 NA                NA
## 2                 NA                 NA                NA
## 3                 NA                 NA                NA
## 4                 NA                 NA                NA
## 5                 NA                 NA                NA
## 6                 NA                 NA                NA
##   secondary_education_f_. secondary_education_m_. seats_in_parliament_f_.
## 1                1.107733                7.899011                      NA
## 2                1.221396                8.137953                      NA
## 3                1.335059                8.376896                      NA
## 4                1.448722                8.615838                      NA
## 5                1.562385                8.854780                      NA
## 6                1.676049                9.093722                      NA
##   seats_in_parliament_m_. labour_participation_f_. labour_participation_m_.
## 1                      NA                       NA                       NA
## 2                      NA                       NA                       NA
## 3                      NA                       NA                       NA
## 4                      NA                       NA                       NA
## 5                      NA                       NA                       NA
## 6                      NA                       NA                       NA
##   co2_emission_tons mat_footprint_percap_tons
## 1        0.18927897                    2.1809
## 2        0.17815451                    2.5264
## 3        0.12292003                    2.6421
## 4        0.10617863                    2.3022
## 5        0.09406327                    1.8948
## 6        0.08632119                    2.1968
str(data)
## 'data.frame':    6798 obs. of  33 variables:
##  $ X                        : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ iso3                     : chr  "AFG" "AFG" "AFG" "AFG" ...
##  $ country                  : chr  "Afghanistan" "Afghanistan" "Afghanistan" "Afghanistan" ...
##  $ hdicode                  : chr  "Low" "Low" "Low" "Low" ...
##  $ hdi_rank_2022            : int  182 182 182 182 182 182 182 182 182 182 ...
##  $ gii_rank_2022            : int  162 162 162 162 162 162 162 162 162 162 ...
##  $ year                     : int  1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 ...
##  $ hdi                      : num  0.284 0.292 0.299 0.307 0.3 0.318 0.326 0.33 0.329 0.337 ...
##  $ life_expectancy          : num  46 46.7 47.6 51.5 51.5 ...
##  $ pop_millions             : num  10.7 10.7 12.1 14 15.5 ...
##  $ hdi_f                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hdi_m                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ life_expec_f             : num  48.4 49.1 50.3 52.7 53.5 ...
##  $ life_expec_m             : num  43.7 44.4 45.1 50.2 49.5 ...
##  $ expec_yr_school          : num  2.94 3.23 3.52 3.81 4.1 ...
##  $ expec_yr_school_f        : num  2.12 2.25 2.38 2.53 2.68 ...
##  $ expec_yr_school_m        : num  4.53 4.77 5.02 5.28 5.55 ...
##  $ mean_yr_school           : num  0.872 0.915 0.959 1.002 1.045 ...
##  $ mean_yr_school_f         : num  0.202 0.219 0.236 0.254 0.271 ...
##  $ mean_yr_school_m         : num  1.49 1.58 1.66 1.75 1.83 ...
##  $ gross_inc_percap         : num  3116 2817 2475 1723 1202 ...
##  $ gross_inc_percap_f       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gross_inc_percap_m       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gender_development       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gender_inequality        : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ secondary_education_f_.  : num  1.11 1.22 1.34 1.45 1.56 ...
##  $ secondary_education_m_.  : num  7.9 8.14 8.38 8.62 8.85 ...
##  $ seats_in_parliament_f_.  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ seats_in_parliament_m_.  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ labour_participation_f_. : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ labour_participation_m_. : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ co2_emission_tons        : num  0.1893 0.1782 0.1229 0.1062 0.0941 ...
##  $ mat_footprint_percap_tons: num  2.18 2.53 2.64 2.3 1.89 ...
# memilih data numerik
data_selected <- data[, c(
  "hdi",
  "life_expectancy",
  "pop_millions",
  "hdi_f",
  "hdi_m",
  "life_expec_f",
  "life_expec_m",
  "expec_yr_school",
  "expec_yr_school_f",
  "expec_yr_school_m",
  "mean_yr_school",
  "mean_yr_school_f",
  "mean_yr_school_m",
  "gross_inc_percap",
  "gross_inc_percap_f",
  "gross_inc_percap_m",
  "gender_development",
  "gender_inequality",
  "secondary_education_f_.",
  "secondary_education_m_.",
  "seats_in_parliament_f_.",
  "seats_in_parliament_m_.",
  "labour_participation_f_.",
  "labour_participation_m_.",
  "co2_emission_tons",
  "mat_footprint_percap_tons"
)]
#pre-processing
#cek missing value
colSums(is.na(data_selected))
##                       hdi           life_expectancy              pop_millions 
##                       627                         0                         0 
##                     hdi_f                     hdi_m              life_expec_f 
##                      1784                      1784                         0 
##              life_expec_m           expec_yr_school         expec_yr_school_f 
##                         0                       248                       528 
##         expec_yr_school_m            mean_yr_school          mean_yr_school_f 
##                       528                       544                       634 
##          mean_yr_school_m          gross_inc_percap        gross_inc_percap_f 
##                       634                       139                      1506 
##        gross_inc_percap_m        gender_development         gender_inequality 
##                      1506                      1784                      2087 
##   secondary_education_f_.   secondary_education_m_.   seats_in_parliament_f_. 
##                       981                       981                       529 
##   seats_in_parliament_m_.  labour_participation_f_.  labour_participation_m_. 
##                       529                      1488                      1488 
##         co2_emission_tons mat_footprint_percap_tons 
##                        85                      1454
#menangani missing value
data_selected<- na.omit(data_selected)
colSums(is.na(data_selected))
##                       hdi           life_expectancy              pop_millions 
##                         0                         0                         0 
##                     hdi_f                     hdi_m              life_expec_f 
##                         0                         0                         0 
##              life_expec_m           expec_yr_school         expec_yr_school_f 
##                         0                         0                         0 
##         expec_yr_school_m            mean_yr_school          mean_yr_school_f 
##                         0                         0                         0 
##          mean_yr_school_m          gross_inc_percap        gross_inc_percap_f 
##                         0                         0                         0 
##        gross_inc_percap_m        gender_development         gender_inequality 
##                         0                         0                         0 
##   secondary_education_f_.   secondary_education_m_.   seats_in_parliament_f_. 
##                         0                         0                         0 
##   seats_in_parliament_m_.  labour_participation_f_.  labour_participation_m_. 
##                         0                         0                         0 
##         co2_emission_tons mat_footprint_percap_tons 
##                         0                         0
dim(data_selected)
## [1] 4148   26
#asumsi
#korelasi
cor(data_selected)
##                                   hdi life_expectancy pop_millions       hdi_f
## hdi                        1.00000000      0.91948736  -0.05754446  0.99106436
## life_expectancy            0.91948736      1.00000000  -0.02908129  0.89561263
## pop_millions              -0.05754446     -0.02908129   1.00000000 -0.06625480
## hdi_f                      0.99106436      0.89561263  -0.06625480  1.00000000
## hdi_m                      0.99597957      0.92483275  -0.04675895  0.97657742
## life_expec_f               0.92292312      0.99335926  -0.03517194  0.90481206
## life_expec_m               0.89959270      0.99186646  -0.01997010  0.86951785
## expec_yr_school            0.91518828      0.80403731  -0.08728305  0.91779961
## expec_yr_school_f          0.92187538      0.81495664  -0.09244302  0.93262408
## expec_yr_school_m          0.88663661      0.77283809  -0.08278937  0.87941651
## mean_yr_school             0.90337546      0.73836314  -0.08400010  0.91016272
## mean_yr_school_f           0.90628738      0.74317732  -0.09296520  0.92040756
## mean_yr_school_m           0.88271838      0.71840605  -0.07359930  0.88158661
## gross_inc_percap           0.78866189      0.70616201  -0.08914788  0.77465651
## gross_inc_percap_f         0.80886787      0.70814419  -0.08819953  0.80682243
## gross_inc_percap_m         0.78544696      0.70982637  -0.08577737  0.76508601
## gender_development         0.69205035      0.56250517  -0.08485821  0.77732378
## gender_inequality         -0.87937283     -0.80591638   0.10408636 -0.89280647
## secondary_education_f_.    0.84137970      0.68188673  -0.04703002  0.85285752
## secondary_education_m_.    0.80494515      0.64551538  -0.01402896  0.80476977
## seats_in_parliament_f_.    0.28901327      0.25384684  -0.02201620  0.31365010
## seats_in_parliament_m_.   -0.28901327     -0.25384684   0.02201620 -0.31365010
## labour_participation_f_.  -0.06713688     -0.17861747  -0.06440056  0.02329269
## labour_participation_m_.  -0.21973893     -0.13353021   0.09969434 -0.21482697
## co2_emission_tons          0.62961171      0.54088424  -0.03982968  0.61837906
## mat_footprint_percap_tons  0.69295787      0.63451490  -0.06544618  0.68385483
##                                 hdi_m life_expec_f life_expec_m expec_yr_school
## hdi                        0.99597957   0.92292312    0.8995927      0.91518828
## life_expectancy            0.92483275   0.99335926    0.9918665      0.80403731
## pop_millions              -0.04675895  -0.03517194   -0.0199701     -0.08728305
## hdi_f                      0.97657742   0.90481206    0.8695179      0.91779961
## hdi_m                      1.00000000   0.92279066    0.9107192      0.90695471
## life_expec_f               0.92279066   1.00000000    0.9709327      0.80956330
## life_expec_m               0.91071918   0.97093272    1.0000000      0.78160027
## expec_yr_school            0.90695471   0.80956330    0.7816003      1.00000000
## expec_yr_school_f          0.90619546   0.82192660    0.7918268      0.99014800
## expec_yr_school_m          0.88781055   0.77596409    0.7526188      0.98662195
## mean_yr_school             0.89049270   0.75569821    0.7039993      0.82111253
## mean_yr_school_f           0.88654734   0.76241976    0.7073803      0.82334146
## mean_yr_school_m           0.87822264   0.73264335    0.6870370      0.80234565
## gross_inc_percap           0.79149241   0.68012585    0.7247718      0.66314471
## gross_inc_percap_f         0.80778660   0.68563356    0.7185741      0.71793819
## gross_inc_percap_m         0.79151487   0.68380438    0.7287766      0.65309646
## gender_development         0.63029571   0.60248077    0.5088927      0.68508750
## gender_inequality         -0.86860536  -0.81138737   -0.7810412     -0.84649949
## secondary_education_f_.    0.82389389   0.70282862    0.6453310      0.75556337
## secondary_education_m_.    0.79902958   0.66463331    0.6105103      0.72424759
## seats_in_parliament_f_.    0.27668121   0.23894780    0.2588106      0.41031638
## seats_in_parliament_m_.   -0.27668121  -0.23894780   -0.2588106     -0.41031638
## labour_participation_f_.  -0.10947718  -0.17365949   -0.1872240      0.04650433
## labour_participation_m_.  -0.22197093  -0.14856188   -0.1090662     -0.25146824
## co2_emission_tons          0.62655117   0.53016493    0.5499566      0.50977498
## mat_footprint_percap_tons  0.69270054   0.61386446    0.6512203      0.58771075
##                           expec_yr_school_f expec_yr_school_m mean_yr_school
## hdi                              0.92187538        0.88663661     0.90337546
## life_expectancy                  0.81495664        0.77283809     0.73836314
## pop_millions                    -0.09244302       -0.08278937    -0.08400010
## hdi_f                            0.93262408        0.87941651     0.91016272
## hdi_m                            0.90619546        0.88781055     0.89049270
## life_expec_f                     0.82192660        0.77596409     0.75569821
## life_expec_m                     0.79182678        0.75261880     0.70399926
## expec_yr_school                  0.99014800        0.98662195     0.82111253
## expec_yr_school_f                1.00000000        0.95581583     0.82924901
## expec_yr_school_m                0.95581583        1.00000000     0.79211524
## mean_yr_school                   0.82924901        0.79211524     1.00000000
## mean_yr_school_f                 0.83941617        0.78540916     0.99305926
## mean_yr_school_m                 0.80143666        0.78438851     0.98955591
## gross_inc_percap                 0.67144895        0.64757686     0.64741686
## gross_inc_percap_f               0.71825743        0.70487720     0.70253805
## gross_inc_percap_m               0.65921800        0.63984202     0.63279004
## gender_development               0.73967621        0.60224984     0.69598454
## gender_inequality               -0.84827243       -0.82344221    -0.83206178
## secondary_education_f_.          0.76802306        0.72274225     0.95229296
## secondary_education_m_.          0.72329465        0.70721970     0.93416250
## seats_in_parliament_f_.          0.41081113        0.39749732     0.28789088
## seats_in_parliament_m_.         -0.41081113       -0.39749732    -0.28789088
## labour_participation_f_.         0.05250900        0.03875490     0.05737468
## labour_participation_m_.        -0.23642484       -0.25308072    -0.27106570
## co2_emission_tons                0.53156911        0.48664462     0.52030236
## mat_footprint_percap_tons        0.60447039        0.56590594     0.54228505
##                           mean_yr_school_f mean_yr_school_m gross_inc_percap
## hdi                             0.90628738       0.88271838       0.78866189
## life_expectancy                 0.74317732       0.71840605       0.70616201
## pop_millions                   -0.09296520      -0.07359930      -0.08914788
## hdi_f                           0.92040756       0.88158661       0.77465651
## hdi_m                           0.88654734       0.87822264       0.79149241
## life_expec_f                    0.76241976       0.73264335       0.68012585
## life_expec_m                    0.70738032       0.68703700       0.72477180
## expec_yr_school                 0.82334146       0.80234565       0.66314471
## expec_yr_school_f               0.83941617       0.80143666       0.67144895
## expec_yr_school_m               0.78540916       0.78438851       0.64757686
## mean_yr_school                  0.99305926       0.98955591       0.64741686
## mean_yr_school_f                1.00000000       0.96647821       0.65568895
## mean_yr_school_m                0.96647821       1.00000000       0.63152190
## gross_inc_percap                0.65568895       0.63152190       1.00000000
## gross_inc_percap_f              0.70520029       0.68945771       0.95130215
## gross_inc_percap_m              0.63957458       0.61831262       0.99478791
## gender_development              0.74083330       0.63240889       0.45744703
## gender_inequality              -0.82863702      -0.82044672      -0.68571797
## secondary_education_f_.         0.95518632       0.93141912       0.59890368
## secondary_education_m_.         0.91260138       0.94315760       0.55796463
## seats_in_parliament_f_.         0.29206287       0.27600419       0.21931511
## seats_in_parliament_m_.        -0.29206287      -0.27600419      -0.21931511
## labour_participation_f_.        0.06881491       0.05046666       0.03654048
## labour_participation_m_.       -0.24952245      -0.28922271      -0.04256320
## co2_emission_tons               0.53643542       0.50017379       0.80797912
## mat_footprint_percap_tons       0.55846299       0.52342929       0.85907100
##                           gross_inc_percap_f gross_inc_percap_m
## hdi                               0.80886787         0.78544696
## life_expectancy                   0.70814419         0.70982637
## pop_millions                     -0.08819953        -0.08577737
## hdi_f                             0.80682243         0.76508601
## hdi_m                             0.80778660         0.79151487
## life_expec_f                      0.68563356         0.68380438
## life_expec_m                      0.71857412         0.72877664
## expec_yr_school                   0.71793819         0.65309646
## expec_yr_school_f                 0.71825743         0.65921800
## expec_yr_school_m                 0.70487720         0.63984202
## mean_yr_school                    0.70253805         0.63279004
## mean_yr_school_f                  0.70520029         0.63957458
## mean_yr_school_m                  0.68945771         0.61831262
## gross_inc_percap                  0.95130215         0.99478791
## gross_inc_percap_f                1.00000000         0.92578165
## gross_inc_percap_m                0.92578165         1.00000000
## gender_development                0.51047624         0.43118573
## gender_inequality                -0.77417344        -0.66632244
## secondary_education_f_.           0.64837685         0.58248036
## secondary_education_m_.           0.61205724         0.54426299
## seats_in_parliament_f_.           0.33183671         0.18335943
## seats_in_parliament_m_.          -0.33183671        -0.18335943
## labour_participation_f_.          0.15770513        -0.01923348
## labour_participation_m_.         -0.10967281        -0.04667395
## co2_emission_tons                 0.67513289         0.82008375
## mat_footprint_percap_tons         0.77510994         0.85734281
##                           gender_development gender_inequality
## hdi                               0.69205035        -0.8793728
## life_expectancy                   0.56250517        -0.8059164
## pop_millions                     -0.08485821         0.1040864
## hdi_f                             0.77732378        -0.8928065
## hdi_m                             0.63029571        -0.8686054
## life_expec_f                      0.60248077        -0.8113874
## life_expec_m                      0.50889266        -0.7810412
## expec_yr_school                   0.68508750        -0.8464995
## expec_yr_school_f                 0.73967621        -0.8482724
## expec_yr_school_m                 0.60224984        -0.8234422
## mean_yr_school                    0.69598454        -0.8320618
## mean_yr_school_f                  0.74083330        -0.8286370
## mean_yr_school_m                  0.63240889        -0.8204467
## gross_inc_percap                  0.45744703        -0.6857180
## gross_inc_percap_f                0.51047624        -0.7741734
## gross_inc_percap_m                0.43118573        -0.6663224
## gender_development                1.00000000        -0.6822961
## gender_inequality                -0.68229610         1.0000000
## secondary_education_f_.           0.67382935        -0.7894176
## secondary_education_m_.           0.57803083        -0.7677738
## seats_in_parliament_f_.           0.30995544        -0.4691333
## seats_in_parliament_m_.          -0.30995544         0.4691333
## labour_participation_f_.          0.34525992        -0.1450750
## labour_participation_m_.         -0.14534366         0.2711740
## co2_emission_tons                 0.39221695        -0.4927096
## mat_footprint_percap_tons         0.43058441        -0.5763813
##                           secondary_education_f_. secondary_education_m_.
## hdi                                    0.84137970              0.80494515
## life_expectancy                        0.68188673              0.64551538
## pop_millions                          -0.04703002             -0.01402896
## hdi_f                                  0.85285752              0.80476977
## hdi_m                                  0.82389389              0.79902958
## life_expec_f                           0.70282862              0.66463331
## life_expec_m                           0.64533097              0.61051028
## expec_yr_school                        0.75556337              0.72424759
## expec_yr_school_f                      0.76802306              0.72329465
## expec_yr_school_m                      0.72274225              0.70721970
## mean_yr_school                         0.95229296              0.93416250
## mean_yr_school_f                       0.95518632              0.91260138
## mean_yr_school_m                       0.93141912              0.94315760
## gross_inc_percap                       0.59890368              0.55796463
## gross_inc_percap_f                     0.64837685              0.61205724
## gross_inc_percap_m                     0.58248036              0.54426299
## gender_development                     0.67382935              0.57803083
## gender_inequality                     -0.78941755             -0.76777379
## secondary_education_f_.                1.00000000              0.97097467
## secondary_education_m_.                0.97097467              1.00000000
## seats_in_parliament_f_.                0.23163475              0.19810752
## seats_in_parliament_m_.               -0.23163475             -0.19810752
## labour_participation_f_.               0.05938978              0.03849814
## labour_participation_m_.              -0.28023634             -0.31777722
## co2_emission_tons                      0.50824521              0.46709693
## mat_footprint_percap_tons              0.50378135              0.45864716
##                           seats_in_parliament_f_. seats_in_parliament_m_.
## hdi                                    0.28901327             -0.28901327
## life_expectancy                        0.25384684             -0.25384684
## pop_millions                          -0.02201620              0.02201620
## hdi_f                                  0.31365010             -0.31365010
## hdi_m                                  0.27668121             -0.27668121
## life_expec_f                           0.23894780             -0.23894780
## life_expec_m                           0.25881062             -0.25881062
## expec_yr_school                        0.41031638             -0.41031638
## expec_yr_school_f                      0.41081113             -0.41081113
## expec_yr_school_m                      0.39749732             -0.39749732
## mean_yr_school                         0.28789088             -0.28789088
## mean_yr_school_f                       0.29206287             -0.29206287
## mean_yr_school_m                       0.27600419             -0.27600419
## gross_inc_percap                       0.21931511             -0.21931511
## gross_inc_percap_f                     0.33183671             -0.33183671
## gross_inc_percap_m                     0.18335943             -0.18335943
## gender_development                     0.30995544             -0.30995544
## gender_inequality                     -0.46913333              0.46913333
## secondary_education_f_.                0.23163475             -0.23163475
## secondary_education_m_.                0.19810752             -0.19810752
## seats_in_parliament_f_.                1.00000000             -1.00000000
## seats_in_parliament_m_.               -1.00000000              1.00000000
## labour_participation_f_.               0.30858654             -0.30858654
## labour_participation_m_.              -0.02539630              0.02539630
## co2_emission_tons                      0.01412198             -0.01412198
## mat_footprint_percap_tons              0.10326557             -0.10326557
##                           labour_participation_f_. labour_participation_m_.
## hdi                                    -0.06713688              -0.21973893
## life_expectancy                        -0.17861747              -0.13353021
## pop_millions                           -0.06440056               0.09969434
## hdi_f                                   0.02329269              -0.21482697
## hdi_m                                  -0.10947718              -0.22197093
## life_expec_f                           -0.17365949              -0.14856188
## life_expec_m                           -0.18722397              -0.10906618
## expec_yr_school                         0.04650433              -0.25146824
## expec_yr_school_f                       0.05250900              -0.23642484
## expec_yr_school_m                       0.03875490              -0.25308072
## mean_yr_school                          0.05737468              -0.27106570
## mean_yr_school_f                        0.06881491              -0.24952245
## mean_yr_school_m                        0.05046666              -0.28922271
## gross_inc_percap                        0.03654048              -0.04256320
## gross_inc_percap_f                      0.15770513              -0.10967281
## gross_inc_percap_m                     -0.01923348              -0.04667395
## gender_development                      0.34525992              -0.14534366
## gender_inequality                      -0.14507499               0.27117401
## secondary_education_f_.                 0.05938978              -0.28023634
## secondary_education_m_.                 0.03849814              -0.31777722
## seats_in_parliament_f_.                 0.30858654              -0.02539630
## seats_in_parliament_m_.                -0.30858654               0.02539630
## labour_participation_f_.                1.00000000               0.34379991
## labour_participation_m_.                0.34379991               1.00000000
## co2_emission_tons                      -0.03568691               0.03144423
## mat_footprint_percap_tons               0.02855475               0.02549166
##                           co2_emission_tons mat_footprint_percap_tons
## hdi                              0.62961171                0.69295787
## life_expectancy                  0.54088424                0.63451490
## pop_millions                    -0.03982968               -0.06544618
## hdi_f                            0.61837906                0.68385483
## hdi_m                            0.62655117                0.69270054
## life_expec_f                     0.53016493                0.61386446
## life_expec_m                     0.54995656                0.65122029
## expec_yr_school                  0.50977498                0.58771075
## expec_yr_school_f                0.53156911                0.60447039
## expec_yr_school_m                0.48664462                0.56590594
## mean_yr_school                   0.52030236                0.54228505
## mean_yr_school_f                 0.53643542                0.55846299
## mean_yr_school_m                 0.50017379                0.52342929
## gross_inc_percap                 0.80797912                0.85907100
## gross_inc_percap_f               0.67513289                0.77510994
## gross_inc_percap_m               0.82008375                0.85734281
## gender_development               0.39221695                0.43058441
## gender_inequality               -0.49270963               -0.57638127
## secondary_education_f_.          0.50824521                0.50378135
## secondary_education_m_.          0.46709693                0.45864716
## seats_in_parliament_f_.          0.01412198                0.10326557
## seats_in_parliament_m_.         -0.01412198               -0.10326557
## labour_participation_f_.        -0.03568691                0.02855475
## labour_participation_m_.         0.03144423                0.02549166
## co2_emission_tons                1.00000000                0.83899965
## mat_footprint_percap_tons        0.83899965                1.00000000

korelasi yang sangat tinggi akan dihilangkan untuk menghindari redundan

# cek korelasi
cor_matrix <- cor(na.omit(data_selected))
cor_tri <- as.data.frame(as.table(cor_matrix))
high_cor <- subset(cor_tri, abs(Freq) > 0.90 & Freq < 1)
high_cor <- high_cor[order(-abs(high_cor$Freq)), ]
print(high_cor)
##                        Var1                    Var2       Freq
## 542 seats_in_parliament_m_. seats_in_parliament_f_. -1.0000000
## 567 seats_in_parliament_f_. seats_in_parliament_m_. -1.0000000
## 5                     hdi_m                     hdi  0.9959796
## 105                     hdi                   hdi_m  0.9959796
## 354      gross_inc_percap_m        gross_inc_percap  0.9947879
## 404        gross_inc_percap      gross_inc_percap_m  0.9947879
## 32             life_expec_f         life_expectancy  0.9933593
## 132         life_expectancy            life_expec_f  0.9933593
## 272        mean_yr_school_f          mean_yr_school  0.9930593
## 297          mean_yr_school        mean_yr_school_f  0.9930593
## 33             life_expec_m         life_expectancy  0.9918665
## 158         life_expectancy            life_expec_m  0.9918665
## 4                     hdi_f                     hdi  0.9910644
## 79                      hdi                   hdi_f  0.9910644
## 191       expec_yr_school_f         expec_yr_school  0.9901480
## 216         expec_yr_school       expec_yr_school_f  0.9901480
## 273        mean_yr_school_m          mean_yr_school  0.9895559
## 323          mean_yr_school        mean_yr_school_m  0.9895559
## 192       expec_yr_school_m         expec_yr_school  0.9866220
## 242         expec_yr_school       expec_yr_school_m  0.9866220
## 83                    hdi_m                   hdi_f  0.9765774
## 108                   hdi_f                   hdi_m  0.9765774
## 488 secondary_education_m_. secondary_education_f_.  0.9709747
## 513 secondary_education_f_. secondary_education_m_.  0.9709747
## 137            life_expec_m            life_expec_f  0.9709327
## 162            life_expec_f            life_expec_m  0.9709327
## 299        mean_yr_school_m        mean_yr_school_f  0.9664782
## 324        mean_yr_school_f        mean_yr_school_m  0.9664782
## 218       expec_yr_school_m       expec_yr_school_f  0.9558158
## 243       expec_yr_school_f       expec_yr_school_m  0.9558158
## 305 secondary_education_f_.        mean_yr_school_f  0.9551863
## 480        mean_yr_school_f secondary_education_f_.  0.9551863
## 279 secondary_education_f_.          mean_yr_school  0.9522930
## 479          mean_yr_school secondary_education_f_.  0.9522930
## 353      gross_inc_percap_f        gross_inc_percap  0.9513021
## 378        gross_inc_percap      gross_inc_percap_f  0.9513021
## 332 secondary_education_m_.        mean_yr_school_m  0.9431576
## 507        mean_yr_school_m secondary_education_m_.  0.9431576
## 280 secondary_education_m_.          mean_yr_school  0.9341625
## 505          mean_yr_school secondary_education_m_.  0.9341625
## 87        expec_yr_school_f                   hdi_f  0.9326241
## 212                   hdi_f       expec_yr_school_f  0.9326241
## 331 secondary_education_f_.        mean_yr_school_m  0.9314191
## 481        mean_yr_school_m secondary_education_f_.  0.9314191
## 380      gross_inc_percap_m      gross_inc_percap_f  0.9257817
## 405      gross_inc_percap_f      gross_inc_percap_m  0.9257817
## 31                    hdi_m         life_expectancy  0.9248327
## 106         life_expectancy                   hdi_m  0.9248327
## 6              life_expec_f                     hdi  0.9229231
## 131                     hdi            life_expec_f  0.9229231
## 110            life_expec_f                   hdi_m  0.9227907
## 135                   hdi_m            life_expec_f  0.9227907
## 9         expec_yr_school_f                     hdi  0.9218754
## 209                     hdi       expec_yr_school_f  0.9218754
## 90         mean_yr_school_f                   hdi_f  0.9204076
## 290                   hdi_f        mean_yr_school_f  0.9204076
## 2           life_expectancy                     hdi  0.9194874
## 27                      hdi         life_expectancy  0.9194874
## 86          expec_yr_school                   hdi_f  0.9177996
## 186                   hdi_f         expec_yr_school  0.9177996
## 8           expec_yr_school                     hdi  0.9151883
## 183                     hdi         expec_yr_school  0.9151883
## 306 secondary_education_m_.        mean_yr_school_f  0.9126014
## 506        mean_yr_school_f secondary_education_m_.  0.9126014
## 111            life_expec_m                   hdi_m  0.9107192
## 161                   hdi_m            life_expec_m  0.9107192
## 89           mean_yr_school                   hdi_f  0.9101627
## 264                   hdi_f          mean_yr_school  0.9101627
## 112         expec_yr_school                   hdi_m  0.9069547
## 187                   hdi_m         expec_yr_school  0.9069547
## 12         mean_yr_school_f                     hdi  0.9062874
## 287                     hdi        mean_yr_school_f  0.9062874
## 113       expec_yr_school_f                   hdi_m  0.9061955
## 213                   hdi_m       expec_yr_school_f  0.9061955
## 84             life_expec_f                   hdi_f  0.9048121
## 134                   hdi_f            life_expec_f  0.9048121
## 11           mean_yr_school                     hdi  0.9033755
## 261                     hdi          mean_yr_school  0.9033755

variabel yang dihilangkan dan dipakai

  • hdi_f & hdi_m (r=0.99)=hdi

  • life_expec_f & life_expec_m (r=0.99)=life_expectancy

  • expec_yr_school_f & expec_yr_school_m (r=0.98)=expec_yr_school

  • mean_yr_school_f & mean_yr_school_m (r=0.99)=mean_yr_school

  • gross_inc_percap_f & gross_inc_percap_m (r=0.99)=gross_inc_percap

  • seats_in_parliament_m_. korelasi -1.00(singular) dgn f= seats_in_parliament_f_.

  • secondary_education_m_. & secondary_education_f_% (r=0.97) = secondary_education_m_.

#jadi variabel yg dipilih adalah
data_hdr <- data_selected[, c(
  "hdi",                      
  "life_expectancy",         
  "pop_millions",            
  "expec_yr_school",          
  "mean_yr_school",       
  "gross_inc_percap",        
  "gender_development",       
  "gender_inequality",         
  "secondary_education_f_.",  
  "seats_in_parliament_f_.",   
  "labour_participation_f_.",  
  "labour_participation_m_.", 
  "co2_emission_tons",        
  "mat_footprint_percap_tons"
)]

#Asumsi

#MSA (mengecek kelayakan analisis faktor)
r <- cor(data_hdr)
KMO(r)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = r)
## Overall MSA =  0.79
## MSA for each item = 
##                       hdi           life_expectancy              pop_millions 
##                      0.73                      0.81                      0.30 
##           expec_yr_school            mean_yr_school          gross_inc_percap 
##                      0.81                      0.78                      0.79 
##        gender_development         gender_inequality   secondary_education_f_. 
##                      0.80                      0.90                      0.88 
##   seats_in_parliament_f_.  labour_participation_f_.  labour_participation_m_. 
##                      0.64                      0.23                      0.41 
##         co2_emission_tons mat_footprint_percap_tons 
##                      0.87                      0.91

Variabel dengan MSA < 0.5 kurang cocok untuk analisis faktor, jadi variabelnya dihapus

#DELETE MSA <0.5
hdr_final <- data_hdr[ , !colnames(data_hdr) %in% c(
  "pop_millions",
  "labour_participation_f_.",
  "labour_participation_m_."
)]

r <- cor(hdr_final)
KMO(r)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = r)
## Overall MSA =  0.84
## MSA for each item = 
##                       hdi           life_expectancy           expec_yr_school 
##                      0.76                      0.78                      0.84 
##            mean_yr_school          gross_inc_percap        gender_development 
##                      0.80                      0.84                      0.94 
##         gender_inequality   secondary_education_f_.   seats_in_parliament_f_. 
##                      0.95                      0.88                      0.63 
##         co2_emission_tons mat_footprint_percap_tons 
##                      0.90                      0.90

overall MSA = 0.84 sudah layak untuk analisis selanjutnya, semua variabel juga sudah memiliki nilai MSA > 0.5

#Bartlett Test (mengecek matriks korelasi bukan sama dengan matriks identita)
bartlett.test(hdr_final)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  hdr_final
## Bartlett's K-squared = 638071, df = 10, p-value < 2.2e-16
describe(hdr_final)
##                           vars    n     mean       sd   median  trimmed
## hdi                          1 4148     0.70     0.16     0.72     0.71
## life_expectancy              2 4148    70.84     8.31    72.52    71.57
## expec_yr_school              3 4148    12.81     3.14    12.84    12.87
## mean_yr_school               4 4148     8.28     3.20     8.49     8.40
## gross_inc_percap             5 4148 19393.57 19147.36 12226.80 16376.79
## gender_development           6 4148     0.93     0.08     0.96     0.94
## gender_inequality            7 4148     0.38     0.20     0.40     0.38
## secondary_education_f_.      8 4148    54.45    29.38    56.18    54.96
## seats_in_parliament_f_.      9 4148    18.55    11.19    16.96    17.63
## co2_emission_tons           10 4148     5.11     5.85     3.48     4.07
## mat_footprint_percap_tons   11 4148    13.93    12.40    10.16    12.10
##                                mad    min       max     range  skew kurtosis
## hdi                           0.18   0.25      0.97      0.72 -0.43    -0.71
## life_expectancy               7.97  39.97     84.82     44.85 -0.78     0.12
## expec_yr_school               3.15   2.71     23.25     20.53 -0.15    -0.03
## mean_yr_school                3.80   0.98     14.26     13.28 -0.27    -0.91
## gross_inc_percap          13553.52 450.07 109543.07 109093.01  1.47     2.13
## gender_development            0.05   0.38      1.06      0.67 -1.78     4.83
## gender_inequality             0.25   0.01      0.84      0.83 -0.02    -1.11
## secondary_education_f_.      38.65   0.94    100.00     99.06 -0.11    -1.26
## seats_in_parliament_f_.      11.13   0.01     57.55     57.54  0.71     0.03
## co2_emission_tons             4.17   0.02     58.75     58.73  2.42     9.25
## mat_footprint_percap_tons     9.18   1.18    140.82    139.63  2.66    15.61
##                               se
## hdi                         0.00
## life_expectancy             0.13
## expec_yr_school             0.05
## mean_yr_school              0.05
## gross_inc_percap          297.30
## gender_development          0.00
## gender_inequality           0.00
## secondary_education_f_.     0.46
## seats_in_parliament_f_.     0.17
## co2_emission_tons           0.09
## mat_footprint_percap_tons   0.19

karena p-value < 0.05 jadi variabel saling berkorelasi dan layak untuk dilakukan analisis

PRINCIPLE COMPONENT ANALYSIS (PCA)

standarisasi data agar semua variabel mempunyai bobot yang adil

# scale data
hdr_final <- scale(hdr_final)
# eigen value and vector
pc <- eigen(r)
V <- pc$vectors
print(pc$values)
##  [1] 7.38504608 1.37258268 0.80430973 0.46216674 0.35962025 0.16841333
##  [7] 0.14779811 0.12726566 0.12040905 0.04202165 0.01036672
# scree plot
pca_result <- prcomp(hdr_final, scale. = TRUE)
fviz_eig(pca_result,
         addlabels = TRUE,
         barfill = "skyblue",
         barcolor = "darkblue",
         linecolor = "red")
## Warning in geom_bar(stat = "identity", fill = barfill, color = barcolor, :
## Ignoring empty aesthetic: `width`.

berdasarkan scree plot, diperoleh komponen utama yang mampu menjelasakan 79.6% (67.1 + 12.5) dari total variasi data. Titik elbow terlihat pada komponen kedua sehingga dua komponen dianggap optimal untuk merepresentasikan struktur data

#pca final
pca_final <- principal(hdr_final,
                       nfactors = 2,
                       rotate = "none")
print(pca_final)
## Principal Components Analysis
## Call: principal(r = hdr_final, nfactors = 2, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                             PC1   PC2   h2    u2 com
## hdi                        0.98 -0.03 0.95 0.048 1.0
## life_expectancy            0.87  0.00 0.76 0.236 1.0
## expec_yr_school            0.90 -0.19 0.86 0.144 1.1
## mean_yr_school             0.91 -0.18 0.85 0.147 1.1
## gross_inc_percap           0.84  0.38 0.85 0.150 1.4
## gender_development         0.74 -0.28 0.62 0.377 1.3
## gender_inequality         -0.91  0.23 0.88 0.121 1.1
## secondary_education_f_.    0.86 -0.16 0.77 0.230 1.1
## seats_in_parliament_f_.    0.35 -0.61 0.50 0.503 1.6
## co2_emission_tons          0.71  0.59 0.85 0.146 1.9
## mat_footprint_percap_tons  0.76  0.52 0.86 0.141 1.8
## 
##                        PC1  PC2
## SS loadings           7.39 1.37
## Proportion Var        0.67 0.12
## Cumulative Var        0.67 0.80
## Proportion Explained  0.84 0.16
## Cumulative Proportion 0.84 1.00
## 
## Mean item complexity =  1.3
## Test of the hypothesis that 2 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.05 
##  with the empirical chi square  925.2  with prob <  2.7e-172 
## 
## Fit based upon off diagonal values = 1

dari langkah sebelumnya, diambil 2 komponen utama untuk melihat nilai loadings(seberapa kuat variabel berkontribusi pada komponen) tanpa rotate Hasilnya menunjukkan bahwa PC1 memiliki loading yang sangat tinggi dan positif pada variabel hdi(0.98), life_expectancy(0.90), mean_yr_school(0.90), gross_inc_percap (0.84) dan secondary_education_f_. (0.86). Selain itu, variabel gender_inequality memiliki loading negatif yang sangat kuat (-0.91). Hal ini menunjukkan bahwa PC1 merepresentasikan dimensi umum pembangunan manusia, di mana negara dengan nilai PC1 tinggi cenderung memiliki tingkat HDI, pendidikan, pendapatan, dan harapan hidup yang tinggi serta tingkat ketimpangan gender yang rendah. Dengan kontribusi varians sebesar 67%, komponen ini menjadi dimensi dominan yang menjelaskan sebagian besar variasi data.

Sementara itu, komponen kedua (PC2) memiliki loading yang relatif kuat pada variabel seats_in_parliament_f_. (-0.61), co2_emission_tons (0.59), dan mat_footprint_percap_tons (0.52). Pola ini menunjukkan bahwa PC2 menangkap dimensi yang berkaitan dengan aspek lingkungan dan representasi politik perempuan. Negara dengan skor PC2 tinggi cenderung memiliki tingkat emisi karbon dan jejak material yang lebih tinggi, sedangkan nilai negatif pada variabel kursi parlemen perempuan menunjukkan adanya perbedaan pola representasi gender dalam dimensi ini. Dengan kontribusi varians sebesar 12%, komponen kedua berfungsi sebagai dimensi tambahan yang memperkaya interpretasi struktur data.

# score PC principal
scores_PC <- hdr_final %*% V
head(scores_PC)
##        [,1]      [,2]     [,3]      [,4]       [,5]       [,6]        [,7]
## 19 4.820409 0.3811864 1.874095 -1.316852 -0.8720135 -0.3956788 -0.06671298
## 20 4.732681 0.3719780 1.861332 -1.336469 -0.8152681 -0.4571414 -0.06866947
## 21 4.653223 0.2971757 1.970147 -1.372376 -0.8140806 -0.5484094 -0.08867628
## 22 4.636245 0.3316894 1.986487 -1.544772 -0.8648386 -0.6598344 -0.09876374
## 23 4.708001 0.4373291 2.065834 -1.949400 -1.0656421 -0.8236464 -0.05866997
## 24 4.474388 0.2871471 1.968490 -1.708618 -0.8095074 -0.7891351 -0.06229521
##           [,8]       [,9]      [,10]      [,11]
## 19 -0.01694739 0.06639824 -0.2426626 0.05393108
## 20  0.03177982 0.05251613 -0.2359980 0.05996768
## 21  0.12219249 0.04662541 -0.2347400 0.06135983
## 22  0.16461154 0.03675218 -0.2463758 0.06277824
## 23  0.21158984 0.06154278 -0.2547494 0.08518873
## 24  0.17109034 0.02359551 -0.2691663 0.06909241

Skor komponen utama diperoleh dari perkalian data terstandarisasi dengan matriks eigenvector, yang menghasilkan nilai posisi setiap negara pada masing-masing komponen utama. Skor pada PC1 menunjukkan tingkat relatif pembangunan manusia suatu negara. Negara dengan skor PC1 tinggi dapat diinterpretasikan sebagai negara dengan tingkat pembangunan yang lebih baik, ditandai oleh nilai HDI, pendidikan, pendapatan, dan harapan hidup yang tinggi serta ketimpangan gender yang rendah. Sebaliknya, skor PC1 yang rendah menunjukkan karakteristik pembangunan yang relatif lebih rendah.

Sementara itu, skor pada PC2 merefleksikan posisi negara dalam dimensi lingkungan dan representasi gender. Negara dengan skor PC2 tinggi cenderung memiliki tingkat emisi karbon dan jejak material yang lebih besar, sedangkan skor PC2 yang rendah cenderung terkait dengan proporsi kursi parlemen perempuan yang lebih tinggi. Dengan demikian, skor komponen utama memungkinkan pemetaan negara ke dalam ruang dua dimensi yang lebih sederhana, sehingga memudahkan analisis lanjutan seperti pengelompokan, pemeringkatan, maupun visualisasi pola antarnegara.

#Biplot
fviz_pca_biplot(pca_result,
                geom.ind = "point",
                #col.ind = status.ipm,
                #palette = c("#FC4E07","#E7B800", "#00AFBB"),
                addEllipses = TRUE,
                #legend.title = "Kategori"
)

Grafik ini menggabungkan sebaran data (titik-titik hitam) dan arah variabel (panah biru)

# correlation circle
contrib_circle <- fviz_pca_var(pca_result, col.var = "contrib",
                               gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
                               repel = TRUE) +
  ggtitle("Kontribusi Variabel")
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## ℹ The deprecated feature was likely used in the factoextra package.
##   Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## ℹ The deprecated feature was likely used in the factoextra package.
##   Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
plot(contrib_circle)

- Grafik ini menunjukkan seberapa kuat setiap variabel berkontribusi terhadap dua dimensi utama

# variable contribution
contrib_v_PC1 <- fviz_contrib(pca_result, choice = "var", axes = 1, top = 5) + ggtitle("PC1")
plot(contrib_v_PC1)

Grafik batang ini mengurutkan variabel yang paling memengaruhi Dimensi 1

contrib_v_PC2 <- fviz_contrib(pca_result, choice = "var", axes = 2, top = 5) + ggtitle("PC2")
plot(contrib_v_PC2)

Grafik ini mengurutkan variabel yang paling memengaruhi Dimensi 2

FACTOR ANALYSIS (FA)

fa <- principal(hdr_final, nfactors = 2, rotate = "none")
fa
## Principal Components Analysis
## Call: principal(r = hdr_final, nfactors = 2, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                             PC1   PC2   h2    u2 com
## hdi                        0.98 -0.03 0.95 0.048 1.0
## life_expectancy            0.87  0.00 0.76 0.236 1.0
## expec_yr_school            0.90 -0.19 0.86 0.144 1.1
## mean_yr_school             0.91 -0.18 0.85 0.147 1.1
## gross_inc_percap           0.84  0.38 0.85 0.150 1.4
## gender_development         0.74 -0.28 0.62 0.377 1.3
## gender_inequality         -0.91  0.23 0.88 0.121 1.1
## secondary_education_f_.    0.86 -0.16 0.77 0.230 1.1
## seats_in_parliament_f_.    0.35 -0.61 0.50 0.503 1.6
## co2_emission_tons          0.71  0.59 0.85 0.146 1.9
## mat_footprint_percap_tons  0.76  0.52 0.86 0.141 1.8
## 
##                        PC1  PC2
## SS loadings           7.39 1.37
## Proportion Var        0.67 0.12
## Cumulative Var        0.67 0.80
## Proportion Explained  0.84 0.16
## Cumulative Proportion 0.84 1.00
## 
## Mean item complexity =  1.3
## Test of the hypothesis that 2 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.05 
##  with the empirical chi square  925.2  with prob <  2.7e-172 
## 
## Fit based upon off diagonal values = 1

Analisis pertama dilakukan dengan metode ekstraksi komponen utama tanpa rotasi untuk melihat struktur data yang masih asli. Dari tabel kontribusi varians, nilai Proportion Var menunjukkan bahwa Faktor 1 (PC1) sangat dominan karena mampu menjelaskan 67% variasi data, sedangkan Faktor 2 (PC2) hanya menjelaskan 12%. Jika digabungkan, kedua faktor ini sudah bisa mewakili 80% dari seluruh informasi yang ada pada variabel asli.

Meskipun kemampuan menjelaskannya cukup besar, struktur ini masih belum ideal. Hal ini karena hampir semua variabel memiliki nilai loading yang terkumpul di PC1 (terlihat dari sebagian besar nilai pada kolom PC1 berada di atas 0,7). Kondisi ini menunjukkan adanya satu faktor umum yang mencakup semua dimensi, sehingga peran masing-masing faktor belum terlihat secara jelas dan spesifik.

Untuk mengatasi ketidakseimbangan tersebut, dilakukan rotasi Varimax

fa <- principal(hdr_final, nfactors = 2, rotate = "varimax")
fa
## Principal Components Analysis
## Call: principal(r = hdr_final, nfactors = 2, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                             RC1   RC2   h2    u2 com
## hdi                        0.75  0.62 0.95 0.048 1.9
## life_expectancy            0.66  0.58 0.76 0.236 2.0
## expec_yr_school            0.81  0.46 0.86 0.144 1.6
## mean_yr_school             0.80  0.47 0.85 0.147 1.6
## gross_inc_percap           0.37  0.84 0.85 0.150 1.4
## gender_development         0.74  0.28 0.62 0.377 1.3
## gender_inequality         -0.83 -0.43 0.88 0.121 1.5
## secondary_education_f_.    0.75  0.45 0.77 0.230 1.6
## seats_in_parliament_f_.    0.67 -0.22 0.50 0.503 1.2
## co2_emission_tons          0.14  0.91 0.85 0.146 1.0
## mat_footprint_percap_tons  0.22  0.90 0.86 0.141 1.1
## 
##                        RC1  RC2
## SS loadings           4.74 4.02
## Proportion Var        0.43 0.37
## Cumulative Var        0.43 0.80
## Proportion Explained  0.54 0.46
## Cumulative Proportion 0.54 1.00
## 
## Mean item complexity =  1.5
## Test of the hypothesis that 2 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.05 
##  with the empirical chi square  925.2  with prob <  2.7e-172 
## 
## Fit based upon off diagonal values = 1

Setelah melakukan ekstraksi awal, analisis dilanjutkan dengan rotasi Varimax. Langkah ini bertujuan untuk memperjelas struktur data dengan membagi ulang varians supaya lebih seimbang antar faktor yang terbentuk. Hasilnya terlihat dari perubahan kontribusi varians, di mana RC1 sekarang menjelaskan 43,1% dan RC2 menjelaskan 36,5% variasi data. Meskipun pembagiannya berubah, total varians kumulatif yang dijelaskan tetap sekitar 79,6% (mendekati 80%). Artinya, model dua faktor ini masih sangat baik dalam mewakili informasi dari 11 variabel asli.

Dari tabel loading setelah rotasi, identitas masing-masing faktor menjadi lebih jelas - Faktor Pertama (RC1) didominasi oleh variabel yang berhubungan dengan kualitas sumber daya manusia dan kesetaraan, seperti rata-rata lama sekolah, harapan lama sekolah, serta indeks ketimpangan gender (dengan hubungan negatif). - Faktor Kedua (RC2) lebih menggambarkan variabel yang berkaitan dengan kekuatan ekonomi dan dampak lingkungan, seperti emisi CO2, jejak material, dan pendapatan per kapita.

Namun, pada struktur ini masih terdapat cross-loading, terutama pada variabel HDI dan Life Expectancy. Kedua variabel tersebut memiliki nilai loading yang cukup besar pada RC1 dan RC2. Ini berarti variabel tersebut memiliki karakter yang kompleks. Misalnya, Indeks Pembangunan Manusia (HDI) tidak hanya dipengaruhi oleh aspek pendidikan pada RC1, tetapi juga sangat berkaitan dengan kondisi ekonomi pada RC2. Adanya cross-loading ini tidak membuat model menjadi tidak valid, tetapi justru menunjukkan bahwa dalam kenyataannya, aspek sosial dan ekonomi memang saling berhubungan erat.

#Mengambil nilai loading

loads <- fa$loadings 
print(loads)
## 
## Loadings:
##                           RC1    RC2   
## hdi                        0.750  0.624
## life_expectancy            0.656  0.578
## expec_yr_school            0.806  0.455
## mean_yr_school             0.796  0.469
## gross_inc_percap           0.374  0.843
## gender_development         0.737  0.283
## gender_inequality         -0.835 -0.427
## secondary_education_f_.    0.753  0.451
## seats_in_parliament_f_.    0.669 -0.221
## co2_emission_tons          0.136  0.914
## mat_footprint_percap_tons  0.225  0.899
## 
##                  RC1   RC2
## SS loadings    4.740 4.018
## Proportion Var 0.431 0.365
## Cumulative Var 0.431 0.796

Tabel loadings adalah hasil utama dari analisis faktor yang menunjukkan seberapa kuat hubungan antara setiap variabel asli dengan faktor yang terbentuk (RC1 dan RC2). Nilai-nilai dalam tabel ini digunakan untuk melihat variabel mana yang paling berperan dalam membentuk setiap faktor.

Meskipun variabel seperti HDI dan Life Expectancy lebih dominan di RC1, keduanya juga memiliki nilai yang cukup tinggi di RC2 (di atas 0,5). Hal ini menunjukkan adanya hubungan antar dimensi, bahwa pembangunan manusia dan usia harapan hidup tidak hanya dipengaruhi faktor sosial dan pendidikan, tetapi juga sangat berkaitan dengan kondisi ekonomi.

Secara keseluruhan, kedua faktor memiliki nilai SS Loadings di atas 1 (4,74 dan 4,02). Ini membuktikan bahwa keduanya cukup kuat secara statistik dalam menyederhanakan struktur data tanpa menghilangkan banyak informasi penting.

# Membuat diagram faktor
fa.diagram(fa)

# scores FA
head(fa$scores)
##          RC1        RC2
## 19 -1.543220 -0.9331333
## 20 -1.513849 -0.9176017
## 21 -1.449616 -0.9459862
## 22 -1.464482 -0.9197967
## 23 -1.544053 -0.8698351
## 24 -1.394692 -0.9087399

Bagian ini menunjukkan hasil perubahan setiap observasi (setiap baris data) ke dalam dua faktor utama, yaitu RC1 dan RC2. Nilai skor menggambarkan posisi relatif masing-masing objek penelitian berdasarkan dua dimensi pembangunan yang sudah terbentuk.

Contohnya: Observasi Baris 19 (Skor RC1: -1,54 dan RC2: -0,93) memiliki nilai negatif pada kedua faktor. Hal ini berarti objek tersebut berada di bawah rata-rata, baik dalam aspek kualitas pembangunan manusia (RC1) maupun dalam aspek kapasitas ekonomi dan emisi (RC2).

library(ggplot2)
scores_df <- as.data.frame(fa$scores)

ggplot(scores_df, aes(x = RC1, y = RC2)) +
  geom_point(color = "steelblue", size = 2, alpha = 0.7) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "red") +
  geom_vline(xintercept = 0, linetype = "dashed", color = "red") + 
  labs(title = "Plot Skor Faktor: RC1 vs RC2",
       subtitle = "Visualisasi Posisi Observasi dalam Dimensi Pembangunan",
       x = "RC1 (Kesejahteraan Sosial & Pendidikan)",
       y = "RC2 (Kapasitas Ekonomi & Ekologi)") +
  theme_minimal()

Grafik ini menampilkan visualisasi Factor Scores, di mana setiap titik mewakili satu negara atau wilayah berdasarkan dua dimensi utama, yaitu RC1 (Kesejahteraan Sosial & Pendidikan) dan RC2 (Kapasitas Ekonomi & Ekologi).

Berdasarkan sebarannya, mayoritas titik terkonsentrasi di sekitar titik pusat (0,0), terutama pada area kiri-bawah hingga tengah-bawah. Hal ini menunjukkan bahwa sebagian besar negara memiliki kualitas SDM yang masih di bawah atau mendekati rata-rata serta kapasitas ekonomi dan tingkat emisi yang juga relatif rendah. Sehingga, kelompok yang paling banyak adalah kategori “Berkembang”. Sebaran di kuadran kanan-bawah(Ideal/Efisien) juga cukup terlihat yang menunjukkan adanya negara dengan kualitas SDM baik tetapi emisi dan kapasitas ekonominya tidak terlalu tinggi.

Sebaliknya, jumlah negara di kuadran kanan-atas (Maju/Konsumtif) tidak sebanyak kelompok berkembang. Sementara itu, kuadran kiri-atas(Tidak Seimbang) jarang dan cenderung berisi titik-titik yang menyebar atau pencilan. Secara umum, semakin ekstrem nilai RC2, jumlah negaranya semakin sedikit, sehingga titik-titik di bagian atas grafik tampak lebih jarang dibanding bagian bawah.