1. Putri Sofyatus Salwa (24031554112)

2. Umi Imro’atus Sholekhah (24031554150)


STAGE 1 : Objective (Tujuan Analisis)

(Tahap ini dijelaskan dalam laporan)

STAGE 2 : Research Design & Data Preparation

2.1 Load Library

library(psych)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.0     ✔ readr     2.2.0
## ✔ 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() ──
## ✖ ggplot2::%+%()   masks psych::%+%()
## ✖ ggplot2::alpha() masks psych::alpha()
## ✖ 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(factoextra)
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa

2.2 Import Dataset

data <- read.csv("C:/Users/MSI-PC/Downloads/brisbane_water_quality.csv")

2.3 Exploratory Data Analysis (EDA) Awal

str(data)
## 'data.frame':    30894 obs. of  20 variables:
##  $ Timestamp                               : chr  "2023-08-04 23:00:00" "2023-08-04 23:30:00" "2023-08-04 23:00:00" "2023-08-04 23:30:00" ...
##  $ Record.number                           : int  1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 ...
##  $ Average.Water.Speed                     : num  4.83 2.54 1.26 0.76 3.4 ...
##  $ Average.Water.Direction                 : num  73.5 106.4 156.8 281.8 244.6 ...
##  $ Chlorophyll                             : num  1.62 1.96 1.62 1.76 1.64 ...
##  $ Chlorophyll..quality.                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Temperature                             : num  20 20 20 20 20 ...
##  $ Temperature..quality.                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Dissolved.Oxygen                        : num  7.47 7.46 7.43 7.42 7.43 ...
##  $ Dissolved.Oxygen..quality.              : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Dissolved.Oxygen...Saturation.          : num  101 101 101 100 101 ...
##  $ Dissolved.Oxygen...Saturation...quality.: num  NA NA NA NA NA NA NA NA NA NA ...
##  $ pH                                      : num  8.18 8.18 8.17 8.17 8.17 ...
##  $ pH..quality.                            : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Salinity                                : num  35.2 35.2 35.2 35.2 35.2 ...
##  $ Salinity..quality.                      : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Specific.Conductance                    : num  53.3 53.3 53.3 53.3 53.3 ...
##  $ Specific.Conductance..quality.          : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Turbidity                               : num  2.07 1.99 2.03 1.97 1.94 ...
##  $ Turbidity..quality.                     : num  NA NA NA NA NA NA NA NA NA NA ...
dim(data)
## [1] 30894    20
summary(data)
##   Timestamp         Record.number   Average.Water.Speed Average.Water.Direction
##  Length:30894       Min.   : 1468   Min.   : 0.000      Min.   :  0.00         
##  Class :character   1st Qu.: 9191   1st Qu.: 6.594      1st Qu.: 86.31         
##  Mode  :character   Median :16915   Median :13.390      Median :176.33         
##                     Mean   :16915   Mean   :16.799      Mean   :177.54         
##                     3rd Qu.:24638   3rd Qu.:23.600      3rd Qu.:267.87         
##                     Max.   :32361   Max.   :89.912      Max.   :359.99         
##                                     NA's   :20          NA's   :1              
##   Chlorophyll     Chlorophyll..quality.  Temperature    Temperature..quality.
##  Min.   : 0.100   Min.   :1020          Min.   :17.00   Min.   :1020         
##  1st Qu.: 1.451   1st Qu.:1020          1st Qu.:21.29   1st Qu.:1020         
##  Median : 2.371   Median :1020          Median :25.25   Median :1020         
##  Mean   : 2.782   Mean   :1020          Mean   :24.42   Mean   :1022         
##  3rd Qu.: 3.650   3rd Qu.:1020          3rd Qu.:27.25   3rd Qu.:1020         
##  Max.   :43.301   Max.   :1220          Max.   :32.06   Max.   :2010         
##  NA's   :585      NA's   :808           NA's   :5164    NA's   :5344         
##  Dissolved.Oxygen Dissolved.Oxygen..quality. Dissolved.Oxygen...Saturation.
##  Min.   :3.030    Min.   :1020               Min.   : 51.84                
##  1st Qu.:6.387    1st Qu.:1020               1st Qu.: 92.23                
##  Median :6.814    Median :1020               Median : 96.51                
##  Mean   :6.815    Mean   :1020               Mean   : 96.64                
##  3rd Qu.:7.254    3rd Qu.:1020               3rd Qu.:101.67                
##  Max.   :9.260    Max.   :2010               Max.   :134.08                
##  NA's   :4300     NA's   :4524               NA's   :5749                  
##  Dissolved.Oxygen...Saturation...quality.       pH         pH..quality. 
##  Min.   :1020                             Min.   :7.309   Min.   :1020  
##  1st Qu.:1020                             1st Qu.:7.980   1st Qu.:1020  
##  Median :1020                             Median :8.073   Median :1020  
##  Mean   :1023                             Mean   :8.063   Mean   :1020  
##  3rd Qu.:1020                             3rd Qu.:8.140   3rd Qu.:1020  
##  Max.   :2010                             Max.   :8.255   Max.   :1020  
##  NA's   :5950                             NA's   :1084    NA's   :1308  
##     Salinity      Salinity..quality. Specific.Conductance
##  Min.   : 0.057   Min.   :1020       Min.   : 0.021      
##  1st Qu.:29.151   1st Qu.:1020       1st Qu.:45.046      
##  Median :30.604   Median :1020       Median :47.420      
##  Mean   :31.003   Mean   :1020       Mean   :47.927      
##  3rd Qu.:33.918   3rd Qu.:1020       3rd Qu.:53.361      
##  Max.   :36.000   Max.   :1020       Max.   :54.996      
##  NA's   :3958     NA's   :4182       NA's   :1367        
##  Specific.Conductance..quality.   Turbidity      Turbidity..quality.
##  Min.   :1020                   Min.   : 0.335   Min.   :1020       
##  1st Qu.:1020                   1st Qu.: 2.354   1st Qu.:1020       
##  Median :1020                   Median : 3.093   Median :1020       
##  Mean   :1020                   Mean   : 3.942   Mean   :1020       
##  3rd Qu.:1020                   3rd Qu.: 4.005   3rd Qu.:1020       
##  Max.   :1020                   Max.   :49.869   Max.   :1020       
##  NA's   :1591                   NA's   :2000     NA's   :2224
colSums(is.na(data))
##                                Timestamp 
##                                        0 
##                            Record.number 
##                                        0 
##                      Average.Water.Speed 
##                                       20 
##                  Average.Water.Direction 
##                                        1 
##                              Chlorophyll 
##                                      585 
##                    Chlorophyll..quality. 
##                                      808 
##                              Temperature 
##                                     5164 
##                    Temperature..quality. 
##                                     5344 
##                         Dissolved.Oxygen 
##                                     4300 
##               Dissolved.Oxygen..quality. 
##                                     4524 
##           Dissolved.Oxygen...Saturation. 
##                                     5749 
## Dissolved.Oxygen...Saturation...quality. 
##                                     5950 
##                                       pH 
##                                     1084 
##                             pH..quality. 
##                                     1308 
##                                 Salinity 
##                                     3958 
##                       Salinity..quality. 
##                                     4182 
##                     Specific.Conductance 
##                                     1367 
##           Specific.Conductance..quality. 
##                                     1591 
##                                Turbidity 
##                                     2000 
##                      Turbidity..quality. 
##                                     2224

2.4 Seleksi Variabel Numerik (Data Mentah)

data_numeric_all <- data %>% select(where(is.numeric))
describe(data_numeric_all)
##                                          vars     n     mean      sd   median
## Record.number                               1 30894 16914.50 8918.47 16914.50
## Average.Water.Speed                         2 30874    16.80   13.17    13.39
## Average.Water.Direction                     3 30893   177.54  103.62   176.33
## Chlorophyll                                 4 30309     2.78    1.86     2.37
## Chlorophyll..quality.                       5 30086  1020.01    1.15  1020.00
## Temperature                                 6 25730    24.42    3.49    25.25
## Temperature..quality.                       7 25550  1021.67   40.60  1020.00
## Dissolved.Oxygen                            8 26594     6.82    0.62     6.81
## Dissolved.Oxygen..quality.                  9 26370  1020.49   21.98  1020.00
## Dissolved.Oxygen...Saturation.             10 25145    96.64    8.11    96.51
## Dissolved.Oxygen...Saturation...quality.   11 24944  1022.98   54.20  1020.00
## pH                                         12 29810     8.06    0.09     8.07
## pH..quality.                               13 29586  1020.00    0.00  1020.00
## Salinity                                   14 26936    31.00    3.47    30.60
## Salinity..quality.                         15 26712  1020.00    0.00  1020.00
## Specific.Conductance                       16 29527    47.93    5.16    47.42
## Specific.Conductance..quality.             17 29303  1020.00    0.00  1020.00
## Turbidity                                  18 28894     3.94    4.07     3.09
## Turbidity..quality.                        19 28670  1020.00    0.00  1020.00
##                                           trimmed      mad     min      max
## Record.number                            16914.50 11450.86 1468.00 32361.00
## Average.Water.Speed                         15.00    11.56    0.00    89.91
## Average.Water.Direction                    176.99   134.62    0.00   359.99
## Chlorophyll                                  2.55     1.55    0.10    43.30
## Chlorophyll..quality.                     1020.00     0.00 1020.00  1220.00
## Temperature                                 24.57     3.61   17.00    32.06
## Temperature..quality.                     1020.00     0.00 1020.00  2010.00
## Dissolved.Oxygen                             6.82     0.64    3.03     9.26
## Dissolved.Oxygen..quality.                1020.00     0.00 1020.00  2010.00
## Dissolved.Oxygen...Saturation.              96.73     6.92   51.84   134.08
## Dissolved.Oxygen...Saturation...quality.  1020.00     0.00 1020.00  2010.00
## pH                                           8.06     0.12    7.31     8.26
## pH..quality.                              1020.00     0.00 1020.00  1020.00
## Salinity                                    31.20     2.56    0.06    36.00
## Salinity..quality.                        1020.00     0.00 1020.00  1020.00
## Specific.Conductance                        48.31     4.46    0.02    55.00
## Specific.Conductance..quality.            1020.00     0.00 1020.00  1020.00
## Turbidity                                    3.22     1.21    0.34    49.87
## Turbidity..quality.                       1020.00     0.00 1020.00  1020.00
##                                             range   skew kurtosis    se
## Record.number                            30893.00   0.00    -1.20 50.74
## Average.Water.Speed                         89.91   1.31     1.95  0.07
## Average.Water.Direction                    359.99   0.04    -1.23  0.59
## Chlorophyll                                 43.20   2.26    20.51  0.01
## Chlorophyll..quality.                      200.00 173.44 30079.00  0.01
## Temperature                                 15.06  -0.38    -0.93  0.02
## Temperature..quality.                      990.00  24.28   588.04  0.25
## Dissolved.Oxygen                             6.23  -0.23     0.65  0.00
## Dissolved.Oxygen..quality.                 990.00  45.00  2023.31  0.14
## Dissolved.Oxygen...Saturation.              82.25  -0.08     1.38  0.05
## Dissolved.Oxygen...Saturation...quality.   990.00  18.15   327.56  0.34
## pH                                           0.95  -0.19    -0.35  0.00
## pH..quality.                                 0.00    NaN      NaN  0.00
## Salinity                                    35.94  -0.99     3.98  0.02
## Salinity..quality.                           0.00    NaN      NaN  0.00
## Specific.Conductance                        54.98  -1.14     4.83  0.03
## Specific.Conductance..quality.               0.00    NaN      NaN  0.00
## Turbidity                                   49.53   5.32    36.99  0.02
## Turbidity..quality.                          0.00    NaN      NaN  0.00

2.5 Visualisasi Distribusi Awal

data_long <- data_numeric_all %>%
  pivot_longer(cols = everything(),
               names_to = "Variabel",
               values_to = "Nilai")

— Histogram

ggplot(data_long, aes(x = Nilai)) +
  geom_histogram(bins = 30, fill = "skyblue", color = "black") +
  facet_wrap(~ Variabel, scales = "free") +
  labs(
    title = "Distribusi Variabel Kualitas Air",
    x = "Nilai",
    y = "Frekuensi"
  )
## Warning: Removed 50159 rows containing non-finite outside the scale range
## (`stat_bin()`).

— Boxplot

ggplot(data_long, aes(x = Variabel, y = Nilai)) +
  geom_boxplot(fill = "salmon") +
  coord_flip() +
  labs(
    title = "Boxplot Variabel Kualitas Air",
    x = "Variabel",
    y = "Nilai"
  )
## Warning: Removed 50159 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

2.6 Seleksi Variabel untuk PCA & FA

data_num <- data %>%
  select(
    Temperature,
    pH,
    Dissolved.Oxygen,
    Dissolved.Oxygen...Saturation.,
    Salinity,
    Turbidity,
    Chlorophyll,
    Specific.Conductance,
    Average.Water.Speed,
    Average.Water.Direction
  )

2.7 Penanganan Missing Value

prop_na <- colMeans(is.na(data_num))
data_clean <- data_num[, prop_na <= 0.5]

data_clean <- data_clean %>%
  mutate(across(everything(),
                ~ ifelse(is.na(.), mean(., na.rm = TRUE), .)))

colSums(is.na(data_clean))
##                    Temperature                             pH 
##                              0                              0 
##               Dissolved.Oxygen Dissolved.Oxygen...Saturation. 
##                              0                              0 
##                       Salinity                      Turbidity 
##                              0                              0 
##                    Chlorophyll           Specific.Conductance 
##                              0                              0 
##            Average.Water.Speed        Average.Water.Direction 
##                              0                              0

2.8 Statistik Deskriptif Setelah Cleaning

describe(data_clean)
##                                vars     n   mean     sd median trimmed    mad
## Temperature                       1 30894  24.42   3.19  24.42   24.57   3.59
## pH                                2 30894   8.06   0.09   8.07    8.06   0.12
## Dissolved.Oxygen                  3 30894   6.82   0.58   6.82    6.82   0.53
## Dissolved.Oxygen...Saturation.    4 30894  96.64   7.32  96.64   96.71   5.18
## Salinity                          5 30894  31.00   3.24  31.00   31.15   2.52
## Turbidity                         6 30894   3.94   3.94   3.19    3.27   1.11
## Chlorophyll                       7 30894   2.78   1.84   2.41    2.56   1.54
## Specific.Conductance              8 30894  47.93   5.04  47.66   48.28   4.44
## Average.Water.Speed               9 30894  16.80  13.16  13.40   15.00  11.56
## Average.Water.Direction          10 30894 177.54 103.62 176.33  176.99 134.62
##                                  min    max  range  skew kurtosis   se
## Temperature                    17.00  32.06  15.06 -0.42    -0.51 0.02
## pH                              7.31   8.26   0.95 -0.20    -0.25 0.00
## Dissolved.Oxygen                3.03   9.26   6.23 -0.24     1.24 0.00
## Dissolved.Oxygen...Saturation. 51.84 134.08  82.25 -0.09     2.38 0.04
## Salinity                        0.06  36.00  35.94 -1.06     5.00 0.02
## Turbidity                       0.34  49.87  49.53  5.50    39.75 0.02
## Chlorophyll                     0.10  43.30  43.20  2.28    20.97 0.01
## Specific.Conductance            0.02  55.00  54.98 -1.17     5.19 0.03
## Average.Water.Speed             0.00  89.91  89.91  1.32     1.95 0.07
## Average.Water.Direction         0.00 359.99 359.99  0.04    -1.23 0.59

2.9 Visualisasi Setelah Cleaning & Imputasi

data_clean_long <- data_clean %>%
  pivot_longer(
    cols = everything(),
    names_to = "Variabel",
    values_to = "Nilai"
  )

— Histogram

ggplot(data_clean_long, aes(x = Nilai)) +
  geom_histogram(bins = 30, fill = "steelblue", color = "black") +
  facet_wrap(~ Variabel, scales = "free") +
  labs(
    title = "Distribusi Variabel Kualitas Air Setelah Cleaning & Imputasi",
    x = "Nilai",
    y = "Frekuensi"
  )

— Boxplot

ggplot(data_clean_long, aes(x = Variabel, y = Nilai)) +
  geom_boxplot(fill = "orange") +
  coord_flip() +
  labs(
    title = "Boxplot Variabel Kualitas Air Setelah Cleaning & Imputasi",
    x = "Variabel",
    y = "Nilai"
  )

2.10 Standarisasi Data

data_scaled <- scale(data_clean)

STAGE 3 : Assumption Testing (Uji Asumsi)

3.1 Matriks Korelasi

cor_matrix <- cor(data_scaled)
cor_matrix 
##                                 Temperature          pH Dissolved.Oxygen
## Temperature                     1.000000000 -0.49240828     -0.353587645
## pH                             -0.492408283  1.00000000      0.345585762
## Dissolved.Oxygen               -0.353587645  0.34558576      1.000000000
## Dissolved.Oxygen...Saturation.  0.242942133 -0.08325193      0.631901391
## Salinity                       -0.052703138 -0.18793072     -0.130492835
## Turbidity                      -0.108563401  0.21117544      0.046123022
## Chlorophyll                     0.200101059 -0.02636365      0.209959555
## Specific.Conductance           -0.032884191 -0.22030838     -0.146478809
## Average.Water.Speed             0.009350559  0.04806107     -0.056891770
## Average.Water.Direction        -0.040042127  0.02465841     -0.004656729
##                                Dissolved.Oxygen...Saturation.     Salinity
## Temperature                                        0.24294213 -0.052703138
## pH                                                -0.08325193 -0.187930723
## Dissolved.Oxygen                                   0.63190139 -0.130492835
## Dissolved.Oxygen...Saturation.                     1.00000000  0.055648951
## Salinity                                           0.05564895  1.000000000
## Turbidity                                         -0.07520407 -0.259396223
## Chlorophyll                                        0.32627719 -0.246801529
## Specific.Conductance                               0.06595632  0.892962626
## Average.Water.Speed                               -0.13493854 -0.109285465
## Average.Water.Direction                           -0.05223865 -0.006512387
##                                  Turbidity  Chlorophyll Specific.Conductance
## Temperature                    -0.10856340  0.200101059          -0.03288419
## pH                              0.21117544 -0.026363652          -0.22030838
## Dissolved.Oxygen                0.04612302  0.209959555          -0.14647881
## Dissolved.Oxygen...Saturation. -0.07520407  0.326277185           0.06595632
## Salinity                       -0.25939622 -0.246801529           0.89296263
## Turbidity                       1.00000000  0.085125417          -0.25870116
## Chlorophyll                     0.08512542  1.000000000          -0.26618449
## Specific.Conductance           -0.25870116 -0.266184494           1.00000000
## Average.Water.Speed             0.10228689 -0.048677120          -0.11776581
## Average.Water.Direction         0.01399139 -0.006064756          -0.01002414
##                                Average.Water.Speed Average.Water.Direction
## Temperature                            0.009350559            -0.040042127
## pH                                     0.048061065             0.024658413
## Dissolved.Oxygen                      -0.056891770            -0.004656729
## Dissolved.Oxygen...Saturation.        -0.134938542            -0.052238646
## Salinity                              -0.109285465            -0.006512387
## Turbidity                              0.102286892             0.013991389
## Chlorophyll                           -0.048677120            -0.006064756
## Specific.Conductance                  -0.117765809            -0.010024138
## Average.Water.Speed                    1.000000000             0.027425790
## Average.Water.Direction                0.027425790             1.000000000

3.2 Uji KMO (Kaiser-Meyer-Olkin)

KMO(cor_matrix)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = cor_matrix)
## Overall MSA =  0.51
## MSA for each item = 
##                    Temperature                             pH 
##                           0.37                           0.77 
##               Dissolved.Oxygen Dissolved.Oxygen...Saturation. 
##                           0.40                           0.36 
##                       Salinity                      Turbidity 
##                           0.57                           0.84 
##                    Chlorophyll           Specific.Conductance 
##                           0.84                           0.56 
##            Average.Water.Speed        Average.Water.Direction 
##                           0.68                           0.68

3.3 Uji Bartlett’s Test of Sphericity

cortest.bartlett(cor_matrix, n = nrow(data_scaled))
## $chisq
## [1] 115088.4
## 
## $p.value
## [1] 0
## 
## $df
## [1] 45

STAGE 4 : Factor Extraction

4.1 Principal Component Analysis (PCA)

pca <- prcomp(data_scaled)
summary(pca)
## Importance of components:
##                           PC1    PC2    PC3    PC4     PC5     PC6     PC7
## Standard deviation     1.5376 1.3362 1.3070 0.9985 0.96942 0.91701 0.80712
## Proportion of Variance 0.2364 0.1785 0.1708 0.0997 0.09398 0.08409 0.06514
## Cumulative Proportion  0.2364 0.4150 0.5858 0.6855 0.77947 0.86356 0.92871
##                            PC8     PC9    PC10
## Standard deviation     0.69158 0.36029 0.32379
## Proportion of Variance 0.04783 0.01298 0.01048
## Cumulative Proportion  0.97653 0.98952 1.00000
pca$rotation
##                                        PC1         PC2          PC3         PC4
## Temperature                     0.13721108 -0.24087973  0.611301062 -0.03580942
## pH                             -0.33246275  0.17734912 -0.462410842  0.04554132
## Dissolved.Oxygen               -0.31982198 -0.42506967 -0.423984767 -0.04069505
## Dissolved.Oxygen...Saturation. -0.09199094 -0.67639482 -0.073143809 -0.05733365
## Salinity                        0.53891326 -0.11507008 -0.294344790 -0.04238309
## Turbidity                      -0.29833162  0.18923046 -0.001169295  0.02216107
## Chlorophyll                    -0.26459253 -0.38069114  0.230513523 -0.08346973
## Specific.Conductance            0.54928285 -0.11835094 -0.276906486 -0.03759107
## Average.Water.Speed            -0.09216561  0.23987437  0.098807411 -0.15577744
## Average.Water.Direction        -0.01576699  0.08251296 -0.034019293 -0.97814422
##                                        PC5         PC6         PC7         PC8
## Temperature                    -0.08175712 -0.06237519 -0.19061766  0.57218237
## pH                              0.02719840  0.03304206  0.21985140  0.76743451
## Dissolved.Oxygen               -0.13209042  0.12219028 -0.19267696 -0.19771928
## Dissolved.Oxygen...Saturation. -0.19137719 -0.03148638 -0.29899545  0.13115705
## Salinity                       -0.14743919 -0.22486032  0.17793547  0.07809202
## Turbidity                      -0.14517529 -0.89078338 -0.23556789 -0.06204404
## Chlorophyll                     0.02716109 -0.20734760  0.81753364 -0.10868236
## Specific.Conductance           -0.14240222 -0.22869894  0.12713218  0.06006381
## Average.Water.Speed            -0.91898936  0.19878723  0.11461649 -0.03788677
## Average.Water.Direction         0.17358332 -0.01503012 -0.06319433  0.02353224
##                                        PC9          PC10
## Temperature                    -0.40991905  0.0764362156
## pH                              0.05241432  0.0157750675
## Dissolved.Oxygen               -0.64022803  0.1308545212
## Dissolved.Oxygen...Saturation.  0.60278634 -0.1334994905
## Salinity                       -0.22222493 -0.6696658840
## Turbidity                      -0.02785686 -0.0029998345
## Chlorophyll                    -0.01407892  0.0293136080
## Specific.Conductance            0.06478713  0.7138920755
## Average.Water.Speed             0.03613406  0.0006700977
## Average.Water.Direction         0.01070626 -0.0007779577

— Scree Plot PCA

fviz_eig(pca)
## Warning in geom_bar(stat = "identity", fill = barfill, color = barcolor, :
## Ignoring empty aesthetic: `width`.

4.2 Penentuan Jumlah Faktor (Parallel Analysis)

fa.parallel(data_scaled, fa = "fa")

## Parallel analysis suggests that the number of factors =  4  and the number of components =  NA

4.3 Ekstraksi Faktor dengan Rotasi Varimax

fa_result <- fa(
  data_scaled,
  nfactors = 4,
  rotate = "varimax"
)

fa_result
## Factor Analysis using method =  minres
## Call: fa(r = data_scaled, nfactors = 4, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                                  MR1   MR2   MR3   MR4     h2     u2 com
## Temperature                    -0.12  0.13 -0.86 -0.01 0.7746 0.2254 1.1
## pH                             -0.16  0.01  0.60  0.11 0.3914 0.6086 1.2
## Dissolved.Oxygen               -0.11  0.74  0.54 -0.01 0.8525 0.1475 1.9
## Dissolved.Oxygen...Saturation.  0.05  0.96 -0.14 -0.02 0.9414 0.0586 1.1
## Salinity                        0.89  0.00 -0.06 -0.11 0.8163 0.1837 1.0
## Turbidity                      -0.16 -0.03  0.13  0.97 0.9952 0.0048 1.1
## Chlorophyll                    -0.28  0.34 -0.14  0.07 0.2179 0.7821 2.4
## Specific.Conductance            0.98  0.00 -0.10 -0.09 0.9781 0.0219 1.0
## Average.Water.Speed            -0.11 -0.13  0.02  0.08 0.0348 0.9652 2.7
## Average.Water.Direction        -0.01 -0.04  0.04  0.01 0.0036 0.9964 2.1
## 
##                        MR1  MR2  MR3  MR4
## SS loadings           1.93 1.62 1.46 0.99
## Proportion Var        0.19 0.16 0.15 0.10
## Cumulative Var        0.19 0.36 0.50 0.60
## Proportion Explained  0.32 0.27 0.24 0.17
## Cumulative Proportion 0.32 0.59 0.83 1.00
## 
## Mean item complexity =  1.6
## Test of the hypothesis that 4 factors are sufficient.
## 
## df null model =  45  with the objective function =  3.73 with Chi Square =  115088.4
## df of  the model are 11  and the objective function was  0.01 
## 
## The root mean square of the residuals (RMSR) is  0.01 
## The df corrected root mean square of the residuals is  0.02 
## 
## The harmonic n.obs is  30894 with the empirical chi square  108.73  with prob <  3.3e-18 
## The total n.obs was  30894  with Likelihood Chi Square =  390.99  with prob <  5e-77 
## 
## Tucker Lewis Index of factoring reliability =  0.986
## RMSEA index =  0.033  and the 90 % confidence intervals are  0.031 0.036
## BIC =  277.26
## 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.98 0.93 1.00
## Multiple R square of scores with factors          0.98 0.95 0.86 0.99
## Minimum correlation of possible factor scores     0.96 0.90 0.72 0.98

STAGE 5 : Factor Interpretation

5.1 Matriks Factor Loadings

fa_result$loadings
## 
## Loadings:
##                                MR1    MR2    MR3    MR4   
## Temperature                    -0.122  0.128 -0.862       
## pH                             -0.157         0.595  0.111
## Dissolved.Oxygen               -0.107  0.744  0.537       
## Dissolved.Oxygen...Saturation.         0.958 -0.144       
## Salinity                        0.895               -0.106
## Turbidity                      -0.165         0.131  0.974
## Chlorophyll                    -0.278  0.342 -0.139       
## Specific.Conductance            0.981                     
## Average.Water.Speed            -0.110 -0.128              
## Average.Water.Direction                                   
## 
##                  MR1   MR2   MR3   MR4
## SS loadings    1.932 1.624 1.458 0.992
## Proportion Var 0.193 0.162 0.146 0.099
## Cumulative Var 0.193 0.356 0.501 0.601