1. Import dan Persiapan Data

library(DT)
data_mentah <- read.csv("company_esg_financial_dataset.csv")
data_num <- data_mentah[, 6:16]
data_num[is.na(data_num)] <- 0

datatable(head(data_num), 
          options = list(scrollX = TRUE),
          caption = "Tabel 1. Pratinjau Data Numerik ESG & Financial")
Tabel 2. Statistika Deskriptif Variabel Penelitian
mean sd min max
Revenue 4670.85 9969.95 35.9 180810.4
ProfitMargin 10.90 8.76 -20.0 50.0
MarketCap 13380.62 39922.87 1.8 865271.7
GrowthRate 4.39 9.09 -36.0 38.0
ESG_Overall 54.62 15.89 6.3 98.8
ESG_Environmental 56.42 26.77 0.0 100.0
ESG_Social 55.66 23.36 0.0 100.0
ESG_Governance 51.77 25.32 0.0 100.0
CarbonEmissions 1271462.35 5067760.30 2042.2 174104721.4
WaterUsage 560044.15 1565686.22 1021.1 52231416.4
EnergyConsumption 11658393.75 50958356.02 5105.5 1741047214.3

2. Uji Asumsi (KMO & Bartlett)

library(knitr)
cor_matrix <- cor(data_num)
corrplot(cor_matrix, method = "color", type = "upper", 
         addCoef.col = "black", tl.col = "black", number.cex = 0.7)

kmo_res <- KMO(cor_matrix)
kmo_table <- data.frame(
  Variabel = names(kmo_res$MSAi),
  MSA_Score = as.numeric(kmo_res$MSAi)
)

kable(kmo_table, 
      digits = 3, 
      format = "html",
      table.attr = "class='table table-striped'", 
      caption = "Tabel 3. Nilai MSA (KMO) per Variabel")
Tabel 3. Nilai MSA (KMO) per Variabel
Variabel MSA_Score
Revenue 0.569
ProfitMargin 0.592
MarketCap 0.645
GrowthRate 0.617
ESG_Overall 0.298
ESG_Environmental 0.154
ESG_Social 0.151
ESG_Governance 0.156
CarbonEmissions 0.622
WaterUsage 0.708
EnergyConsumption 0.581

3. Principal Component Analysis (PCA)

pca_res <- PCA(data_num, scale.unit = TRUE, graph = FALSE, ncp = 11)
fviz_eig(pca_res, addlabels = TRUE, barfill = "steelblue", linecolor = "red") +
  labs(title = "Scree Plot: Penentuan Jumlah Faktor")

eigen_df <- as.data.frame(pca_res$eig)
colnames(eigen_df) <- c("Eigenvalue", "Variance (%)", "Cumulative Variance (%)")

kable(eigen_df, 
      digits = 3, 
      format = "html",
      table.attr = "class='table table-bordered'", 
      caption = "Tabel 4. Eigenvalue dan Varians Kumulatif")
Tabel 4. Eigenvalue dan Varians Kumulatif
Eigenvalue Variance (%) Cumulative Variance (%)
comp 1 3.589 32.628 32.628
comp 2 2.336 21.238 53.867
comp 3 1.650 14.998 68.865
comp 4 0.953 8.665 77.530
comp 5 0.850 7.726 85.256
comp 6 0.768 6.983 92.240
comp 7 0.695 6.320 98.560
comp 8 0.124 1.129 99.689
comp 9 0.033 0.299 99.988
comp 10 0.001 0.012 100.000
comp 11 0.000 0.000 100.000

4. Factor Analysis (FA)

library(knitr)

# Ekstraksi 3 Faktor
fa_res <- principal(data_num, nfactors = 3, rotate = "varimax", score = TRUE)
loadings_table <- as.data.frame(unclass(fa_res$loadings))

kable(loadings_table, 
      digits = 3, 
      format = "html",
      table.attr = "class='table table-hover'", 
      caption = "Tabel 5. Matriks Loading Factor (Rotasi Varimax)")
Tabel 5. Matriks Loading Factor (Rotasi Varimax)
RC1 RC2 RC3
Revenue 0.539 0.023 0.712
ProfitMargin -0.104 -0.080 0.543
MarketCap 0.326 -0.012 0.792
GrowthRate 0.077 0.023 0.294
ESG_Overall -0.107 0.936 0.301
ESG_Environmental -0.306 0.264 0.653
ESG_Social 0.038 0.763 -0.029
ESG_Governance 0.087 0.780 -0.096
CarbonEmissions 0.974 0.020 0.072
WaterUsage 0.974 0.019 0.088
EnergyConsumption 0.973 0.022 0.044
# Diagram Struktur Faktor
par(mar=c(1, 10, 3, 1))
fa.diagram(fa_res$loadings, 
           main = "Struktur Faktor ESG & Finansial",
           cex = 0.8, rsize = 0.5, e.size = 0.06)