1. Load Data
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.2.0 ✔ readr 2.1.6
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.2 ✔ tibble 3.3.1
## ✔ lubridate 1.9.5 ✔ tidyr 1.3.2
## ✔ purrr 1.2.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(psych)
##
## Attaching package: 'psych'
##
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(corrplot)
## corrplot 0.95 loaded
library(factoextra)
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
Pada tahap awal, dilakukan pemanggilan package yang dibutuhkan dalam analisis.
2. Import Data
data <- read.csv("https://archive.ics.uci.edu/ml/machine-learning-databases/00374/energydata_complete.csv")
head(data)
## date Appliances lights T1 RH_1 T2 RH_2 T3
## 1 2016-01-11 17:00:00 60 30 19.89 47.59667 19.2 44.79000 19.79
## 2 2016-01-11 17:10:00 60 30 19.89 46.69333 19.2 44.72250 19.79
## 3 2016-01-11 17:20:00 50 30 19.89 46.30000 19.2 44.62667 19.79
## 4 2016-01-11 17:30:00 50 40 19.89 46.06667 19.2 44.59000 19.79
## 5 2016-01-11 17:40:00 60 40 19.89 46.33333 19.2 44.53000 19.79
## 6 2016-01-11 17:50:00 50 40 19.89 46.02667 19.2 44.50000 19.79
## RH_3 T4 RH_4 T5 RH_5 T6 RH_6 T7 RH_7
## 1 44.73000 19.00000 45.56667 17.16667 55.20 7.026667 84.25667 17.20000 41.62667
## 2 44.79000 19.00000 45.99250 17.16667 55.20 6.833333 84.06333 17.20000 41.56000
## 3 44.93333 18.92667 45.89000 17.16667 55.09 6.560000 83.15667 17.20000 41.43333
## 4 45.00000 18.89000 45.72333 17.16667 55.09 6.433333 83.42333 17.13333 41.29000
## 5 45.00000 18.89000 45.53000 17.20000 55.09 6.366667 84.89333 17.20000 41.23000
## 6 44.93333 18.89000 45.73000 17.13333 55.03 6.300000 85.76667 17.13333 41.26000
## T8 RH_8 T9 RH_9 T_out Press_mm_hg RH_out Windspeed Visibility
## 1 18.2 48.90000 17.03333 45.53 6.600000 733.5 92 7.000000 63.00000
## 2 18.2 48.86333 17.06667 45.56 6.483333 733.6 92 6.666667 59.16667
## 3 18.2 48.73000 17.00000 45.50 6.366667 733.7 92 6.333333 55.33333
## 4 18.1 48.59000 17.00000 45.40 6.250000 733.8 92 6.000000 51.50000
## 5 18.1 48.59000 17.00000 45.40 6.133333 733.9 92 5.666667 47.66667
## 6 18.1 48.59000 17.00000 45.29 6.016667 734.0 92 5.333333 43.83333
## Tdewpoint rv1 rv2
## 1 5.3 13.27543 13.27543
## 2 5.2 18.60619 18.60619
## 3 5.1 28.64267 28.64267
## 4 5.0 45.41039 45.41039
## 5 4.9 10.08410 10.08410
## 6 4.8 44.91948 44.91948
str(data)
## 'data.frame': 19735 obs. of 29 variables:
## $ date : chr "2016-01-11 17:00:00" "2016-01-11 17:10:00" "2016-01-11 17:20:00" "2016-01-11 17:30:00" ...
## $ Appliances : int 60 60 50 50 60 50 60 60 60 70 ...
## $ lights : int 30 30 30 40 40 40 50 50 40 40 ...
## $ T1 : num 19.9 19.9 19.9 19.9 19.9 ...
## $ RH_1 : num 47.6 46.7 46.3 46.1 46.3 ...
## $ T2 : num 19.2 19.2 19.2 19.2 19.2 ...
## $ RH_2 : num 44.8 44.7 44.6 44.6 44.5 ...
## $ T3 : num 19.8 19.8 19.8 19.8 19.8 ...
## $ RH_3 : num 44.7 44.8 44.9 45 45 ...
## $ T4 : num 19 19 18.9 18.9 18.9 ...
## $ RH_4 : num 45.6 46 45.9 45.7 45.5 ...
## $ T5 : num 17.2 17.2 17.2 17.2 17.2 ...
## $ RH_5 : num 55.2 55.2 55.1 55.1 55.1 ...
## $ T6 : num 7.03 6.83 6.56 6.43 6.37 ...
## $ RH_6 : num 84.3 84.1 83.2 83.4 84.9 ...
## $ T7 : num 17.2 17.2 17.2 17.1 17.2 ...
## $ RH_7 : num 41.6 41.6 41.4 41.3 41.2 ...
## $ T8 : num 18.2 18.2 18.2 18.1 18.1 18.1 18.1 18.1 18.1 18.1 ...
## $ RH_8 : num 48.9 48.9 48.7 48.6 48.6 ...
## $ T9 : num 17 17.1 17 17 17 ...
## $ RH_9 : num 45.5 45.6 45.5 45.4 45.4 ...
## $ T_out : num 6.6 6.48 6.37 6.25 6.13 ...
## $ Press_mm_hg: num 734 734 734 734 734 ...
## $ RH_out : num 92 92 92 92 92 ...
## $ Windspeed : num 7 6.67 6.33 6 5.67 ...
## $ Visibility : num 63 59.2 55.3 51.5 47.7 ...
## $ Tdewpoint : num 5.3 5.2 5.1 5 4.9 ...
## $ rv1 : num 13.3 18.6 28.6 45.4 10.1 ...
## $ rv2 : num 13.3 18.6 28.6 45.4 10.1 ...
dim(data)
## [1] 19735 29
Dataset yang digunakan adalah Appliances Energy Prediction dari UCI Machine Learning Repository. Berdasarkan output di atas, dataset terdiri dari 19.735 observasi dan 29 variabel.
3. Persiapan Data
data_numeric <- data %>%
select(starts_with("T"),
starts_with("RH"))
sum(is.na(data_numeric))
## [1] 0
Data tidak ditemukan missing value pada data. Variabel Appliances tidak disertakan dalam analisis PCA dan FA karena penelitian ini berfokus pada struktur hubungan antar variabel suhu dan kelembapan.
4. Statistik Deskriptif
desc <- describe(data_numeric)
desc
## vars n mean sd median trimmed mad min max range skew
## T1 1 19735 21.69 1.61 21.60 21.65 1.33 16.79 26.26 9.47 0.12
## T2 2 19735 20.34 2.19 20.00 20.15 1.93 16.10 29.86 13.76 0.89
## T3 3 19735 22.27 2.01 22.10 22.15 1.91 17.20 29.24 12.04 0.45
## T4 4 19735 20.86 2.04 20.67 20.81 1.89 15.10 26.20 11.10 0.17
## T5 5 19735 19.59 1.84 19.39 19.46 1.76 15.33 25.80 10.47 0.56
## T6 6 19735 7.91 6.09 7.30 7.52 5.62 -6.07 28.29 34.35 0.60
## T7 7 19735 20.27 2.11 20.03 20.20 2.13 15.39 26.00 10.61 0.25
## T8 8 19735 22.03 1.96 22.10 22.09 1.91 16.31 27.23 10.92 -0.26
## T9 9 19735 19.49 2.01 19.39 19.40 1.91 14.89 24.50 9.61 0.38
## T_out 10 19735 7.41 5.32 6.92 7.12 5.02 -5.00 26.10 31.10 0.53
## Tdewpoint 11 19735 3.76 4.19 3.43 3.66 4.10 -6.60 15.50 22.10 0.24
## RH_1 12 19735 40.26 3.98 39.66 40.07 4.01 27.02 63.36 36.34 0.47
## RH_2 13 19735 40.42 4.07 40.50 40.52 4.00 20.46 56.03 35.56 -0.27
## RH_3 14 19735 39.24 3.25 38.53 39.07 3.05 28.77 50.16 21.40 0.47
## RH_4 15 19735 39.03 4.34 38.40 38.79 4.70 27.66 51.09 23.43 0.44
## RH_5 16 19735 50.95 9.02 49.09 49.59 5.93 29.82 96.32 66.51 1.87
## RH_6 17 19735 54.61 31.15 55.29 55.83 40.06 1.00 99.90 98.90 -0.24
## RH_7 18 19735 35.39 5.11 34.86 35.26 5.47 23.20 51.40 28.20 0.24
## RH_8 19 19735 42.94 5.22 42.38 42.76 5.41 29.60 58.78 29.18 0.31
## RH_9 20 19735 41.55 4.15 40.90 41.37 4.11 29.17 53.33 24.16 0.37
## RH_out 21 19735 79.75 14.90 83.67 81.40 14.08 24.00 100.00 76.00 -0.92
## kurtosis se
## T1 0.16 0.01
## T2 0.93 0.02
## T3 -0.01 0.01
## T4 -0.04 0.01
## T5 0.11 0.01
## T6 0.42 0.04
## T7 -0.46 0.02
## T8 -0.16 0.01
## T9 -0.33 0.01
## T_out 0.36 0.04
## Tdewpoint -0.13 0.03
## RH_1 0.11 0.03
## RH_2 0.67 0.03
## RH_3 -0.58 0.02
## RH_4 -0.61 0.03
## RH_5 4.50 0.06
## RH_6 -1.14 0.22
## RH_7 -0.55 0.04
## RH_8 -0.48 0.04
## RH_9 -0.41 0.03
## RH_out 0.26 0.11
summary(data$Appliances)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 10.00 50.00 60.00 97.69 100.00 1080.00
Statistik deskriptif digunakan untuk melihat gambaran umum data. Sebagian besar variabel suhu berada pada rentang 15–25°C, sedangkan kelembaban berada pada kisaran 30–60%.
5. Visualisasi Data
hist(data$Appliances,
main = "Distribusi Konsumsi Energi Appliances",
xlab = "Konsumsi Energi",
col = "lightblue",
border = "white")
boxplot(data$Appliances,
main = "Boxplot Konsumsi Energi",
col = "orange")
Terlihat bahwa distribusi cenderung right-skewed, dengan beberapa nilai
konsumsi yang cukup tinggi.
cor_matrix <- cor(data_numeric, method = "pearson")
corrplot(cor_matrix,
method = "color",
tl.cex = 0.6,
number.cex = 0.5)
Terlihat adanya korelasi tinggi antar variabel suhu dan kelembaban pada
beberapa ruangan. Korelasi Pearson digunakan karena seluruh variabel
berskala numerik dan diasumsikan memiliki hubungan linear.
6. Uji Asumsi
KMO(cor_matrix)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = cor_matrix)
## Overall MSA = 0.87
## MSA for each item =
## T1 T2 T3 T4 T5 T6 T7 T8
## 0.84 0.78 0.95 0.96 0.95 0.91 0.90 0.93
## T9 T_out Tdewpoint RH_1 RH_2 RH_3 RH_4 RH_5
## 0.90 0.76 0.77 0.80 0.71 0.95 0.92 0.87
## RH_6 RH_7 RH_8 RH_9 RH_out
## 0.93 0.90 0.89 0.93 0.65
cortest.bartlett(cor_matrix, n = nrow(data_numeric))
## $chisq
## [1] 767831.5
##
## $p.value
## [1] 0
##
## $df
## [1] 210
Nilai KMO > 0.5 menunjukkan data layak untuk analisis faktor. Sedangkan nilai p-value < 0.05 menunjukkan bahwa matriks korelasi tidak berbentuk matriks identitas, sehingga analisis faktor dapat dilakukan.
7. PCA
sapply(data_numeric, class)
## T1 T2 T3 T4 T5 T6 T7 T8
## "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric"
## T9 T_out Tdewpoint RH_1 RH_2 RH_3 RH_4 RH_5
## "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric"
## RH_6 RH_7 RH_8 RH_9 RH_out
## "numeric" "numeric" "numeric" "numeric" "numeric"
pca_result <- prcomp(data_numeric,
center = TRUE,
scale. = TRUE)
summary(pca_result)
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 3.0451 2.6287 1.23430 0.97332 0.74063 0.63365 0.52777
## Proportion of Variance 0.4415 0.3291 0.07255 0.04511 0.02612 0.01912 0.01326
## Cumulative Proportion 0.4415 0.7706 0.84316 0.88827 0.91439 0.93351 0.94677
## PC8 PC9 PC10 PC11 PC12 PC13 PC14
## Standard deviation 0.43576 0.38379 0.37693 0.34648 0.34120 0.30766 0.27895
## Proportion of Variance 0.00904 0.00701 0.00677 0.00572 0.00554 0.00451 0.00371
## Cumulative Proportion 0.95581 0.96283 0.96959 0.97531 0.98085 0.98536 0.98907
## PC15 PC16 PC17 PC18 PC19 PC20 PC21
## Standard deviation 0.26030 0.2150 0.20953 0.17420 0.1517 0.12024 0.06214
## Proportion of Variance 0.00323 0.0022 0.00209 0.00145 0.0011 0.00069 0.00018
## Cumulative Proportion 0.99229 0.9945 0.99659 0.99803 0.9991 0.99982 1.00000
Berdasarkan hasil summary, dua komponen pertama menjelaskan proporsi variasi terbesar dibandingkan komponen lainnya dan sudah cukup representatif dalam merangkum struktur data. Standardisasi dilakukan agar seluruh variabel memiliki skala yang sama sehingga tidak ada variabel yang mendominasi pembentukan komponen utama. Eigenvalues dan proporsi varians
eigenvalues <- pca_result$sdev^2
eigenvalues
## [1] 9.27248155 6.91030501 1.52348628 0.94735348 0.54853583 0.40151284
## [7] 0.27854641 0.18988568 0.14729239 0.14207852 0.12004660 0.11641578
## [13] 0.09465664 0.07781581 0.06775483 0.04623564 0.04390234 0.03034650
## [19] 0.02302792 0.01445818 0.00386179
prop_var <- eigenvalues / sum(eigenvalues)
prop_var
## [1] 0.4415467404 0.3290621431 0.0725469657 0.0451120707 0.0261207539
## [6] 0.0191196589 0.0132641148 0.0090421750 0.0070139232 0.0067656436
## [11] 0.0057165046 0.0055436088 0.0045074589 0.0037055146 0.0032264202
## [16] 0.0022016970 0.0020905876 0.0014450715 0.0010965677 0.0006884849
## [21] 0.0001838948
Scree Plot
fviz_eig(pca_result,
addlabels = TRUE,
main = "Scree Plot PCA")
## Warning in geom_bar(stat = "identity", fill = barfill, color = barcolor, :
## Ignoring empty aesthetic: `width`.
Berdasarkan scree plot terlihat adanya penurunan tajam pada komponen
kedua. Dua komponen pertama menjelaskan proporsi variasi terbesar
dibandingkan komponen lainnya. Loading Komponen
loading_pca <- pca_result$rotation
round(loading_pca, 3)
## PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10
## T1 0.302 -0.005 0.121 0.133 -0.298 -0.007 -0.206 -0.201 -0.192 0.039
## T2 0.281 0.028 -0.233 0.202 -0.402 0.017 -0.339 0.054 0.048 -0.158
## T3 0.304 0.018 0.163 -0.033 -0.053 -0.041 -0.010 0.070 -0.648 -0.095
## T4 0.299 -0.045 0.131 0.066 -0.148 -0.035 -0.011 0.535 0.260 0.125
## T5 0.300 0.004 0.219 0.105 -0.023 -0.021 0.020 0.134 -0.087 0.169
## T6 0.277 0.042 -0.372 -0.105 0.214 0.173 -0.058 -0.029 0.023 -0.074
## T7 0.296 -0.080 0.193 -0.016 0.005 -0.110 0.273 -0.026 0.430 -0.205
## T8 0.269 -0.091 0.309 0.060 -0.001 -0.074 0.023 -0.670 0.183 0.218
## T9 0.305 -0.044 0.216 -0.081 0.081 0.004 0.133 0.106 0.082 -0.172
## T_out 0.280 0.057 -0.355 -0.088 0.204 0.137 0.015 -0.146 0.051 0.063
## Tdewpoint 0.230 0.216 -0.058 -0.209 0.257 0.448 -0.219 -0.078 0.056 -0.083
## RH_1 0.078 0.336 -0.032 -0.048 0.176 -0.443 -0.303 0.156 0.081 -0.025
## RH_2 0.009 0.309 0.304 -0.208 0.429 -0.294 -0.006 0.002 -0.070 0.094
## RH_3 -0.013 0.352 -0.104 0.085 -0.183 -0.355 -0.083 -0.014 0.036 0.028
## RH_4 0.039 0.362 -0.114 0.008 -0.035 -0.080 -0.155 -0.193 -0.024 -0.015
## RH_5 -0.023 0.152 0.057 0.881 0.389 0.144 0.056 0.021 -0.020 -0.118
## RH_6 -0.248 0.199 0.129 0.054 -0.261 0.057 -0.188 -0.224 0.255 -0.098
## RH_7 0.054 0.353 -0.043 -0.016 -0.127 0.189 0.187 0.148 0.320 0.204
## RH_8 -0.003 0.351 0.012 0.021 -0.187 0.244 0.321 0.026 -0.187 0.579
## RH_9 0.032 0.343 -0.043 -0.062 -0.207 -0.016 0.546 -0.097 -0.131 -0.570
## RH_out -0.152 0.194 0.501 -0.129 -0.048 0.441 -0.317 0.118 0.003 -0.222
## PC11 PC12 PC13 PC14 PC15 PC16 PC17 PC18 PC19 PC20
## T1 0.228 -0.284 -0.221 0.344 0.062 -0.108 0.442 0.049 -0.010 0.390
## T2 -0.144 0.251 0.021 0.052 0.162 0.003 0.133 0.179 -0.008 -0.596
## T3 0.052 -0.056 -0.313 -0.473 0.074 0.045 -0.291 -0.114 0.044 -0.079
## T4 -0.260 -0.495 0.023 0.201 -0.004 -0.020 -0.367 -0.055 0.044 0.023
## T5 0.462 0.199 0.629 0.027 -0.124 0.322 0.014 -0.125 0.104 -0.017
## T6 -0.064 0.001 0.064 -0.090 0.007 0.034 -0.050 0.391 0.656 0.258
## T7 0.112 0.135 -0.182 -0.217 -0.024 -0.343 0.236 -0.403 0.311 -0.098
## T8 -0.346 0.068 -0.040 0.042 -0.019 0.284 -0.265 0.061 0.003 -0.026
## T9 -0.055 0.184 0.180 -0.197 0.015 -0.326 0.020 0.534 -0.482 0.216
## T_out 0.075 -0.254 0.086 -0.105 -0.034 0.027 0.063 -0.155 -0.196 -0.056
## Tdewpoint -0.053 -0.141 0.019 -0.002 -0.163 0.032 0.085 -0.277 -0.301 -0.126
## RH_1 -0.279 0.195 0.044 -0.111 0.381 0.224 0.167 -0.244 -0.077 0.329
## RH_2 0.140 -0.233 -0.068 0.210 0.087 -0.071 0.152 0.301 0.139 -0.465
## RH_3 -0.079 -0.064 -0.037 -0.213 -0.785 -0.003 0.069 0.094 -0.008 0.036
## RH_4 0.226 0.210 0.073 0.294 0.056 -0.512 -0.550 -0.151 0.006 0.083
## RH_5 -0.036 -0.039 -0.056 -0.026 0.009 -0.024 0.006 0.015 -0.010 0.010
## RH_6 0.205 -0.439 0.265 -0.487 0.291 -0.035 -0.059 0.100 0.050 -0.006
## RH_7 0.376 0.192 -0.492 -0.032 0.098 0.350 -0.112 0.182 -0.122 0.053
## RH_8 -0.329 0.068 0.155 -0.114 0.133 -0.276 0.228 -0.052 0.093 -0.027
## RH_9 -0.142 -0.123 0.158 0.249 0.069 0.235 0.000 -0.032 -0.006 0.008
## RH_out -0.167 0.188 -0.029 0.070 -0.176 0.033 0.028 -0.012 0.213 0.091
## PC21
## T1 -0.022
## T2 0.032
## T3 0.000
## T4 0.001
## T5 -0.035
## T6 -0.126
## T7 -0.012
## T8 0.002
## T9 0.017
## T_out 0.732
## Tdewpoint -0.531
## RH_1 0.013
## RH_2 0.030
## RH_3 -0.014
## RH_4 0.023
## RH_5 0.004
## RH_6 -0.059
## RH_7 0.007
## RH_8 -0.019
## RH_9 -0.003
## RH_out 0.395
Loading menunjukkan kontribusi masing-masing variabel terhadap komponen utama. Biplot
fviz_pca_biplot(pca_result,
repel = TRUE,
title = "Biplot PCA")
8. Menentukan Jumlah Faktor
fa.parallel(data_numeric,
fa = "fa",
main = "Parallel Analysis")
## Parallel analysis suggests that the number of factors = 4 and the number of components = NA
Hasil parallel analysis menunjukkan bahwa jumlah faktor optimal yang disarankan adalah empat faktor. Parallel analysis digunakan karena lebih akurat dibandingkan hanya menggunakan kriteria eigenvalue > 1.
9. FA
fa_result <- fa(data_numeric,
nfactors = 4,
rotate = "varimax")
print(fa_result, cut = 0.4)
## Factor Analysis using method = minres
## Call: fa(r = data_numeric, nfactors = 4, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
## MR1 MR2 MR3 MR4 h2 u2 com
## T1 0.91 0.92 0.0812 1.2
## T2 0.68 0.55 0.94 0.0594 2.7
## T3 0.90 0.89 0.1137 1.2
## T4 0.90 0.86 0.1360 1.2
## T5 0.93 0.90 0.0981 1.1
## T6 0.53 0.82 0.99 0.0080 1.9
## T7 0.92 0.91 0.0946 1.1
## T8 0.90 0.84 0.1603 1.1
## T9 0.95 0.97 0.0333 1.2
## T_out 0.55 0.80 0.99 0.0076 2.0
## Tdewpoint 0.52 0.60 0.87 0.1298 3.2
## RH_1 0.88 0.82 0.1845 1.1
## RH_2 0.78 0.44 0.88 0.1207 1.9
## RH_3 0.93 0.89 0.1059 1.1
## RH_4 0.96 0.94 0.0568 1.0
## RH_5 0.18 0.8152 1.8
## RH_6 -0.63 0.46 -0.51 0.88 0.1228 2.8
## RH_7 0.93 0.88 0.1223 1.0
## RH_8 0.91 0.84 0.1641 1.0
## RH_9 0.89 0.79 0.2052 1.0
## RH_out 0.44 -0.68 0.75 0.2508 2.2
##
## MR1 MR2 MR3 MR4
## SS loadings 7.67 6.75 2.86 0.65
## Proportion Var 0.37 0.32 0.14 0.03
## Cumulative Var 0.37 0.69 0.82 0.85
## Proportion Explained 0.43 0.38 0.16 0.04
## Cumulative Proportion 0.43 0.80 0.96 1.00
##
## Mean item complexity = 1.6
## Test of the hypothesis that 4 factors are sufficient.
##
## df null model = 210 with the objective function = 38.92 with Chi Square = 767831.5
## df of the model are 132 and the objective function was 6.98
##
## The root mean square of the residuals (RMSR) is 0.02
## The df corrected root mean square of the residuals is 0.02
##
## The harmonic n.obs is 19735 with the empirical chi square 1545.74 with prob < 1.6e-239
## The total n.obs was 19735 with Likelihood Chi Square = 137627.5 with prob < 0
##
## Tucker Lewis Index of factoring reliability = 0.715
## RMSEA index = 0.23 and the 90 % confidence intervals are 0.229 0.231
## BIC = 136322
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy
## MR1 MR2 MR3 MR4
## Correlation of (regression) scores with factors 0.99 0.99 0.99 0.94
## Multiple R square of scores with factors 0.98 0.98 0.98 0.88
## Minimum correlation of possible factor scores 0.97 0.96 0.97 0.77
Nilai RMSR sebesar 0.02 menunjukkan bahwa residual korelasi relatif kecil sehingga model cukup baik dalam merepresentasikan data. Nilai TLI sebesar 0.715 menunjukkan tingkat kecocokan model yang sedang. Nilai RMSEA sebesar 0.23 masih tergolong tinggi sehingga model belum sepenuhnya optimal, tetapi secara umum struktur faktor sudah mampu menjelaskan sebagian besar variasi data. FA dilakukan menggunakan metode ekstraksi Minimum Residual (MinRes) dengan rotasi Varimax berbasis matriks korelasi.
Factor Loading
round(fa_result$loadings, 3)
##
## Loadings:
## MR1 MR2 MR3 MR4
## T1 0.910 0.221 -0.185
## T2 0.676 0.176 0.548 -0.391
## T3 0.903 0.125 0.225
## T4 0.895 0.240
## T5 0.934 0.145
## T6 0.527 0.179 0.819 0.110
## T7 0.919 -0.135 0.196
## T8 0.899 -0.167
## T9 0.946 0.192 0.179
## T_out 0.545 0.220 0.798
## Tdewpoint 0.518 0.603 0.392 0.291
## RH_1 0.121 0.881 0.105 0.116
## RH_2 0.778 -0.280 0.435
## RH_3 -0.140 0.926 -0.131
## RH_4 0.963 0.122
## RH_5 0.365 -0.120 -0.188
## RH_6 -0.632 0.458 -0.510
## RH_7 0.933
## RH_8 0.909
## RH_9 0.891
## RH_out -0.224 0.440 -0.676 0.219
##
## MR1 MR2 MR3 MR4
## SS loadings 7.665 6.749 2.863 0.652
## Proportion Var 0.365 0.321 0.136 0.031
## Cumulative Var 0.365 0.686 0.823 0.854
Varians yang dijelaskan
fa_result$Vaccounted
## MR1 MR2 MR3 MR4
## SS loadings 7.6671029 6.7472804 2.8631867 0.65199427
## Proportion Var 0.3651001 0.3212991 0.1363422 0.03104735
## Cumulative Var 0.3651001 0.6863992 0.8227414 0.85378878
## Proportion Explained 0.4276235 0.3763215 0.1596908 0.03636420
## Cumulative Proportion 0.4276235 0.8039450 0.9636358 1.00000000
fa_result$communality
## T1 T2 T3 T4 T5 T6 T7 T8
## 0.9187535 0.9406176 0.8862946 0.8639964 0.9019132 0.9919578 0.9053552 0.8397087
## T9 T_out Tdewpoint RH_1 RH_2 RH_3 RH_4 RH_5
## 0.9667296 0.9923617 0.8701544 0.8155307 0.8793087 0.8941135 0.9431857 0.1847960
## RH_6 RH_7 RH_8 RH_9 RH_out
## 0.8772330 0.8777075 0.8358661 0.7948069 0.7491735
Setelah dilakukan rotasi Varimax, diperoleh struktur faktor yang lebih jelas. Faktor-faktor yang terbentuk menunjukkan adanya pengelompokan variabel suhu dan kelembapan pada beberapa ruangan tertentu. Berdasarkan nilai loading, Faktor pertama (MR1) didominasi oleh variabel suhu ruangan (T1–T9), sedangkan variabel suhu luar ruangan (T_out) memiliki kontribusi pada faktor lain yang berkaitan dengan kondisi eksternal. Faktor kedua (MR2) didominasi oleh variabel kelembapan dalam ruangan (RH_1–RH_9). Diagram Faktor
fa.diagram(fa_result)
Simpan Loading PCA dan FA
write.csv(round(loading_pca, 3),
"loading_pca.csv")
write.csv(round(fa_result$loadings[], 3),
"loading_fa.csv")
Kesimpulan: Berdasarkan hasil analisis, data layak dianalisis menggunakan PCA dan FA karena memenuhi asumsi KMO dan uji Bartlett. Dua komponen utama pada PCA mampu menjelaskan lebih dari 70% variasi data. Hasil parallel analysis menunjukkan bahwa empat faktor optimal dalam analisis faktor. Struktur faktor yang terbentuk memperlihatkan adanya pengelompokan variabel suhu dan kelembapan dengan sub-struktur tertentu berdasarkan kondisi ruangan dan lingkungan luar. Secara keseluruhan, PCA dan FA berhasil menyederhanakan struktur data berdimensi tinggi menjadi lebih ringkas dan mudah diinterpretasikan.