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
#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 ...
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
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
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 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
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"
)]
#MSA
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
#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
#Bartlett Test
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
# scale data
data_scaled <- scale(hdr_final)
#pca manual
pc <- eigen(r)
rownames(pc$vectors) <- rownames(r)
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
pc$vectors
## [,1] [,2] [,3] [,4]
## hdi -0.3588106 -0.026342299 -0.099112635 -0.214520802
## life_expectancy -0.3215638 -0.002359137 -0.031035414 -0.514956212
## expec_yr_school -0.3329991 -0.165394355 0.003610092 -0.152833835
## mean_yr_school -0.3336045 -0.151102804 -0.280392282 0.006786841
## gross_inc_percap -0.3087252 0.326400579 0.261504720 -0.036593056
## gender_development -0.2719385 -0.236622963 -0.204652929 0.730205709
## gender_inequality 0.3341612 0.199592995 -0.056989337 0.129942851
## secondary_education_f_. -0.3174139 -0.138679560 -0.356121103 0.076676362
## seats_in_parliament_f_. -0.1304642 -0.520082991 0.767538210 0.114838966
## co2_emission_tons -0.2604671 0.507187393 0.144229559 0.282825914
## mat_footprint_percap_tons -0.2813008 0.446979475 0.245613497 0.122124363
## [,5] [,6] [,7] [,8]
## hdi 0.10176330 -0.086794378 -0.02593679 0.14033684
## life_expectancy 0.41530653 0.190208867 -0.45329652 0.29698988
## expec_yr_school 0.19663972 -0.748417347 0.35100286 -0.14755550
## mean_yr_school -0.40092643 -0.007515755 0.06502009 0.18488829
## gross_inc_percap -0.09526446 0.332382271 0.26046467 0.05165906
## gender_development 0.50248312 0.145860465 -0.04669206 0.08153677
## gender_inequality -0.01104417 -0.356971488 -0.03823705 0.81270268
## secondary_education_f_. -0.52957950 0.085816119 -0.03970418 0.15192718
## seats_in_parliament_f_. -0.19428051 -0.029289318 -0.15187282 0.20858415
## co2_emission_tons -0.17209892 -0.345855365 -0.60677585 -0.23242777
## mat_footprint_percap_tons 0.09083807 0.095300650 0.44957330 0.21385006
## [,9] [,10] [,11]
## hdi -0.1202045821 0.241861586 0.83875872
## life_expectancy 0.1170519972 -0.122071959 -0.31544515
## expec_yr_school -0.1108126824 -0.193055115 -0.21228282
## mean_yr_school 0.0050177315 0.679586801 -0.35515754
## gross_inc_percap -0.7133041609 -0.120859184 -0.12228693
## gender_development -0.1052819805 -0.014057814 -0.03318053
## gender_inequality -0.1908412654 -0.048354594 -0.01044708
## secondary_education_f_. 0.1397358475 -0.638411794 0.08798893
## seats_in_parliament_f_. 0.0597372525 -0.001900085 0.03797702
## co2_emission_tons 0.0007886955 0.049628596 -0.01509840
## mat_footprint_percap_tons 0.6165567953 0.017718774 0.01417196
#menentukan jumlah kompenen (kaiser criterion)
sum(pc$values > 1)
## [1] 2
#scree plot (visualisasi eigenvalue, menentukan jml komponen)
plot(pc$values, type="b",
xlab="Komponen",
ylab="Eigenvalue",
main="Scree Plot")
abline(h=1, col="red")
# hitung proporsi varians dan varians kumulatif
proporsi <- pc$values / sum(pc$values)
kumulatif <- cumsum(proporsi)
hasil <- data.frame(
Eigenvalue = pc$values,
Proporsi = proporsi,
Kumulatif = kumulatif
)
print(hasil)
## Eigenvalue Proporsi Kumulatif
## 1 7.38504608 0.6713678259 0.6713678
## 2 1.37258268 0.1247802434 0.7961481
## 3 0.80430973 0.0731190663 0.8692671
## 4 0.46216674 0.0420151581 0.9112823
## 5 0.35962025 0.0326927501 0.9439750
## 6 0.16841333 0.0153103023 0.9592853
## 7 0.14779811 0.0134361920 0.9727215
## 8 0.12726566 0.0115696056 0.9842911
## 9 0.12040905 0.0109462776 0.9952374
## 10 0.04202165 0.0038201499 0.9990576
## 11 0.01036672 0.0009424288 1.0000000
#pca principal
#pca final
pca_final <- principal(data_hdr,
nfactors = 2,
rotate = "none")
print(pca_final)
## Principal Components Analysis
## Call: principal(r = data_hdr, nfactors = 2, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC1 PC2 h2 u2 com
## hdi 0.97 -0.08 0.956 0.044 1.0
## life_expectancy 0.87 -0.16 0.784 0.216 1.1
## pop_millions -0.10 -0.09 0.017 0.983 2.0
## expec_yr_school 0.91 0.09 0.832 0.168 1.0
## mean_yr_school 0.91 0.07 0.832 0.168 1.0
## gross_inc_percap 0.83 -0.21 0.740 0.260 1.1
## gender_development 0.74 0.37 0.685 0.315 1.5
## gender_inequality -0.91 -0.18 0.864 0.136 1.1
## secondary_education_f_. 0.87 0.05 0.753 0.247 1.0
## seats_in_parliament_f_. 0.36 0.63 0.529 0.471 1.6
## labour_participation_f_. 0.06 0.81 0.657 0.343 1.0
## labour_participation_m_. -0.22 0.21 0.092 0.908 2.0
## co2_emission_tons 0.70 -0.36 0.624 0.376 1.5
## mat_footprint_percap_tons 0.76 -0.28 0.655 0.345 1.3
##
## PC1 PC2
## SS loadings 7.44 1.58
## Proportion Var 0.53 0.11
## Cumulative Var 0.53 0.64
## Proportion Explained 0.82 0.18
## Cumulative Proportion 0.82 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.07
## with the empirical chi square 3384.11 with prob < 0
##
## Fit based upon off diagonal values = 0.98
#communalities
pca_final$communality
## hdi life_expectancy pop_millions
## 0.95624069 0.78354595 0.01667213
## expec_yr_school mean_yr_school gross_inc_percap
## 0.83200806 0.83205560 0.73962670
## gender_development gender_inequality secondary_education_f_.
## 0.68543578 0.86438653 0.75253027
## seats_in_parliament_f_. labour_participation_f_. labour_participation_m_.
## 0.52931199 0.65737505 0.09247337
## co2_emission_tons mat_footprint_percap_tons
## 0.62385756 0.65452245
#loading signifikan
print(pca_final$loadings, cutoff=0.5)
##
## Loadings:
## PC1 PC2
## hdi 0.974
## life_expectancy 0.870
## pop_millions
## expec_yr_school 0.907
## mean_yr_school 0.910
## gross_inc_percap 0.834
## gender_development 0.742
## gender_inequality -0.912
## secondary_education_f_. 0.866
## seats_in_parliament_f_. 0.634
## labour_participation_f_. 0.809
## labour_participation_m_.
## co2_emission_tons 0.701
## mat_footprint_percap_tons 0.758
##
## PC1 PC2
## SS loadings 7.438 1.582
## Proportion Var 0.531 0.113
## Cumulative Var 0.531 0.644
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.
Faktor RC1 (Dimensi Kesejahteraan Sosial & Pendidikan): Variabel dengan korelasi (loading) paling besar adalah gender_inequality (-0.835), expec_yr_school (0.806), dan mean_yr_school (0.796). Nilai yang tinggi pada variabel-variabel ini menunjukkan bahwa RC1 mewakili kualitas sumber daya manusia. Tanda negatif yang kuat pada ketimpangan gender berarti semakin tinggi nilai RC1 di suatu wilayah, semakin rendah tingkat ketimpangan gendernya.
Faktor RC2 (Dimensi Kapasitas Ekonomi & Ekologi): Variabel yang paling dominan adalah co2_emission_tons (0.914), mat_footprint_percap_tons (0.899), dan gross_inc_percap (0.843). Hal ini menunjukkan bahwa RC2 menggambarkan kekuatan ekonomi dan aktivitas industri, di mana kenaikan pendapatan per kapita berjalan seiring dengan tingginya emisi karbon dan jejak konsumsi material.
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)
Garis Hitam: Menunjukkan adanya korelasi positif. Semakin tebal garisnya, semakin besar nilai loading-nya. Terlihat bahwa sebagian besar variabel memiliki garis hitam yang tebal menuju RC1 dan RC2, yang berarti kontribusinya sangat kuat terhadap faktor tersebut.
Garis Merah Putus-putus: Muncul pada variabel gender_inequality. Garis ini menggambarkan korelasi negatif (-0,8). Artinya, variabel tersebut memiliki hubungan berlawanan arah dengan RC1; jika nilai RC1 naik, maka tingkat ketimpangan gender akan turun.
Klaster RC1 (Kesejahteraan & SDM): Berisi variabel pendidikan (mean_yr_school, expec_yr_school), kesehatan (life_expectancy, hdi), dan partisipasi sosial (seats_in_parliament). Kelompok ini mencerminkan aspek pembangunan manusia.
Klaster RC2 (Ekonomi & Ekologi):Terdiri dari tiga variabel utama dengan loading sangat tinggi (sekitar 0,8 sampai 0,9), yaitu gross_inc_percap, co2_emission_tons, dan mat_footprint_percap_tons. Klaster ini menunjukkan hubungan antara tingkat kekayaan materi dengan dampak terhadap lingkungan.
# 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)
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
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).
Garis merah horizontal (Sumbu Y = 0) menunjukkan batas rata-rata pada dimensi ekonomi dan emisi. Negara yang berada di atas garis ini memiliki kapasitas ekonomi dan tingkat emisi di atas rata-rata, sedangkan yang berada di bawahnya memiliki kapasitas ekonomi dan emisi di bawah rata-rata.
Garis merah vertikal (Sumbu X = 0) menunjukkan batas rata-rata pada dimensi kualitas sumber daya manusia dan kesejahteraan. Negara di sebelah kanan garis memiliki kualitas SDM dan kesejahteraan di atas rata-rata, sedangkan yang di sebelah kiri berada di bawah rata-rata.
Kuadran kanan-bawah dapat disebut sebagai kelompok “Ideal/Efisien”. Negara di area ini memiliki kualitas SDM yang baik (RC1 positif), tetapi kapasitas ekonomi dan emisinya relatif lebih rendah dari rata-rata (RC2 negatif). Kondisi ini mencerminkan pembangunan yang cukup sejahtera namun dengan tekanan lingkungan yang lebih rendah.
Kuadran kanan-atas merupakan kelompok “Maju/Konsumtif”. Negara di wilayah ini memiliki kualitas sosial dan pendidikan yang tinggi serta kapasitas ekonomi yang besar, namun diikuti oleh tingkat emisi dan konsumsi material yang juga tinggi.
Kuadran kiri-bawah menggambarkan kelompok “Berkembang”. Negara di area ini memiliki kualitas SDM yang masih di bawah rata-rata dan kapasitas ekonomi serta emisi yang juga rendah. Hal ini menunjukkan wilayah yang masih dalam tahap pengembangan.
Kuadran kiri-atas disebut sebagai kelompok “Tidak Seimbang”. Negara di bagian ini memiliki kapasitas ekonomi dan emisi yang tinggi, tetapi kualitas pembangunan manusianya tidak setinggi tingkat ekonominya. Kondisi ini sering ditemukan pada negara yang pertumbuhan ekonominya lebih banyak ditopang oleh industri besar atau eksploitasi sumber daya alam.
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.