1 Load Library

library(car)
## Loading required package: carData
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:car':
## 
##     recode
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(factoextra)
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(psych)
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
## The following object is masked from 'package:car':
## 
##     logit
library(corrplot)
## corrplot 0.95 loaded
library(sjPlot)
## 
## Attaching package: 'sjPlot'
## The following object is masked from 'package:ggplot2':
## 
##     set_theme
library(readxl)
library(FactoMineR)
library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
library(ggcorrplot)

2 Baca Data dan Rapikan Data

data <- read_excel("D:/.tugas semester 4 dika/analisis multivariat/gallstone-1/dataset-uci/dataset-uci.xlsx")
names(data)
##  [1] "Gallstone Status"                              
##  [2] "Age"                                           
##  [3] "Gender"                                        
##  [4] "Comorbidity"                                   
##  [5] "Coronary Artery Disease (CAD)"                 
##  [6] "Hypothyroidism"                                
##  [7] "Hyperlipidemia"                                
##  [8] "Diabetes Mellitus (DM)"                        
##  [9] "Height"                                        
## [10] "Weight"                                        
## [11] "Body Mass Index (BMI)"                         
## [12] "Total Body Water (TBW)"                        
## [13] "Extracellular Water (ECW)"                     
## [14] "Intracellular Water (ICW)"                     
## [15] "Extracellular Fluid/Total Body Water (ECF/TBW)"
## [16] "Total Body Fat Ratio (TBFR) (%)"               
## [17] "Lean Mass (LM) (%)"                            
## [18] "Body Protein Content (Protein) (%)"            
## [19] "Visceral Fat Rating (VFR)"                     
## [20] "Bone Mass (BM)"                                
## [21] "Muscle Mass (MM)"                              
## [22] "Obesity (%)"                                   
## [23] "Total Fat Content (TFC)"                       
## [24] "Visceral Fat Area (VFA)"                       
## [25] "Visceral Muscle Area (VMA) (Kg)"               
## [26] "Hepatic Fat Accumulation (HFA)"                
## [27] "Glucose"                                       
## [28] "Total Cholesterol (TC)"                        
## [29] "Low Density Lipoprotein (LDL)"                 
## [30] "High Density Lipoprotein (HDL)"                
## [31] "Triglyceride"                                  
## [32] "Aspartat Aminotransferaz (AST)"                
## [33] "Alanin Aminotransferaz (ALT)"                  
## [34] "Alkaline Phosphatase (ALP)"                    
## [35] "Creatinine"                                    
## [36] "Glomerular Filtration Rate (GFR)"              
## [37] "C-Reactive Protein (CRP)"                      
## [38] "Hemoglobin (HGB)"                              
## [39] "Vitamin D"
data <- data %>%
  rename(
    Status       = `Gallstone Status`,
    Age          = `Age`,
    Gender       = `Gender`,
    Comorbidity  = `Comorbidity`,
    CAD          = `Coronary Artery Disease (CAD)`,
    Hypothyroid  = `Hypothyroidism`,
    Hyperlipid   = `Hyperlipidemia`,
    DM           = `Diabetes Mellitus (DM)`,
    Height       = `Height`,
    Weight       = `Weight`,
    BMI          = `Body Mass Index (BMI)`,
    TBW          = `Total Body Water (TBW)`,
    ECW          = `Extracellular Water (ECW)`,
    ICW          = `Intracellular Water (ICW)`,
    ECF_TBW      = `Extracellular Fluid/Total Body Water (ECF/TBW)`,
    TBFR         = `Total Body Fat Ratio (TBFR) (%)`,
    LeanMass     = `Lean Mass (LM) (%)`,
    Protein      = `Body Protein Content (Protein) (%)`,
    VFR          = `Visceral Fat Rating (VFR)`,
    BoneMass     = `Bone Mass (BM)`,
    MuscleMass   = `Muscle Mass (MM)`,
    Obesity      = `Obesity (%)`,
    TFC          = `Total Fat Content (TFC)`,
    VFA          = `Visceral Fat Area (VFA)`,
    VMA          = `Visceral Muscle Area (VMA) (Kg)`,
    HFA          = `Hepatic Fat Accumulation (HFA)`,
    Glucose      = `Glucose`,
    TotalChol    = `Total Cholesterol (TC)`,
    LDL          = `Low Density Lipoprotein (LDL)`,
    HDL          = `High Density Lipoprotein (HDL)`,
    Triglyceride = `Triglyceride`,
    AST          = `Aspartat Aminotransferaz (AST)`,
    ALT          = `Alanin Aminotransferaz (ALT)`,
    ALP          = `Alkaline Phosphatase (ALP)`,
    Creatinine   = `Creatinine`,
    GFR          = `Glomerular Filtration Rate (GFR)`,
    CRP          = `C-Reactive Protein (CRP)`,
    HGB          = `Hemoglobin (HGB)`,
    VitaminD     = `Vitamin D`
  ) %>%
  mutate(Status = factor(Status, levels=c(0,1),
                         labels=c("Batu Empedu","Normal")))
head(data)
## # A tibble: 6 × 39
##   Status        Age Gender Comorbidity   CAD Hypothyroid Hyperlipid    DM Height
##   <fct>       <dbl>  <dbl>       <dbl> <dbl>       <dbl>      <dbl> <dbl>  <dbl>
## 1 Batu Empedu    50      0           0     0           0          0     0    185
## 2 Batu Empedu    47      0           1     0           0          0     0    176
## 3 Batu Empedu    61      0           0     0           0          0     0    171
## 4 Batu Empedu    41      0           0     0           0          0     0    168
## 5 Batu Empedu    42      0           0     0           0          0     0    178
## 6 Batu Empedu    96      0           0     0           0          0     0    155
## # ℹ 30 more variables: Weight <dbl>, BMI <dbl>, TBW <dbl>, ECW <dbl>,
## #   ICW <dbl>, ECF_TBW <dbl>, TBFR <dbl>, LeanMass <dbl>, Protein <dbl>,
## #   VFR <dbl>, BoneMass <dbl>, MuscleMass <dbl>, Obesity <dbl>, TFC <dbl>,
## #   VFA <dbl>, VMA <dbl>, HFA <dbl>, Glucose <dbl>, TotalChol <dbl>, LDL <dbl>,
## #   HDL <dbl>, Triglyceride <dbl>, AST <dbl>, ALT <dbl>, ALP <dbl>,
## #   Creatinine <dbl>, GFR <dbl>, CRP <dbl>, HGB <dbl>, VitaminD <dbl>
data_num <- data[,-26]
data_num <- data_num[,9:38]
head(data_num)
## # A tibble: 6 × 30
##   Height Weight   BMI   TBW   ECW   ICW ECF_TBW  TBFR LeanMass Protein   VFR
##    <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>   <dbl> <dbl>    <dbl>   <dbl> <dbl>
## 1    185   92.8  27.1  52.9  21.2  31.7      40  19.2     80.8    18.9     9
## 2    176   94.5  30.5  43.1  19.5  23.6      45  32.8     67.2    16.7    15
## 3    171   91.1  31.2  47.2  20.1  27.1      43  27.3     72.7    16.4    15
## 4    168   67.7  24    41.4  17    24.4      41  15.8     84.2    16.9     6
## 5    178   89.6  28.3  51.4  20    31.4      39  20       80.0    16.8     8
## 6    155   49    20.4  34    15.7  18.3      46   6.3     93.7    18.5    12
## # ℹ 19 more variables: BoneMass <dbl>, MuscleMass <dbl>, Obesity <dbl>,
## #   TFC <dbl>, VFA <dbl>, VMA <dbl>, Glucose <dbl>, TotalChol <dbl>, LDL <dbl>,
## #   HDL <dbl>, Triglyceride <dbl>, AST <dbl>, ALT <dbl>, ALP <dbl>,
## #   Creatinine <dbl>, GFR <dbl>, CRP <dbl>, HGB <dbl>, VitaminD <dbl>

3 Statistika Deskriptif

hasil_desc <- describe(data_num)
hasil <- select(hasil_desc,n,mean,median,sd,min,max,skew,kurtosis)
hasil
##                n   mean median     sd    min     max  skew kurtosis
## Height       319 167.16 168.00  10.05 145.00  191.00 -0.08    -0.70
## Weight       319  80.56  78.80  15.71  42.90  143.50  0.43     0.31
## BMI          319  28.88  28.30   5.31  17.40   49.70  0.66     1.13
## TBW          319  40.59  39.80   7.93  13.00   66.20  0.21    -0.38
## ECW          319  17.07  17.10   3.16   9.00   27.80  0.02    -0.37
## ICW          319  23.63  23.00   5.35  13.80   57.10  0.94     3.47
## ECF_TBW      319  42.21  42.00   3.24  29.23   52.00 -0.51     1.37
## TBFR         319  28.27  27.82   8.44   6.30   50.92  0.13    -0.52
## LeanMass     319  71.64  72.11   8.44  48.99   93.67 -0.12    -0.51
## Protein      319  15.94  15.87   2.33   5.56   24.81 -0.05     1.82
## VFR          319   9.08   9.00   4.33   1.00   31.00  0.79     2.13
## BoneMass     319   2.80   2.80   0.51   1.40    4.00  0.20    -0.83
## MuscleMass   319  54.27  53.90  10.60   4.70   78.80 -0.10     0.36
## Obesity      319  35.85  25.60 109.80   0.40 1954.00 16.71   288.97
## TFC          319  23.49  22.60   9.61   3.10   62.50  0.80     1.11
## VFA          319  12.17  11.59   5.26   0.90   41.00  1.05     2.92
## VMA          319  30.40  30.41   4.46  18.90   41.10 -0.06    -0.47
## Glucose      319 108.69  98.00  44.85  69.00  575.00  5.88    45.42
## TotalChol    319 203.50 198.00  45.76  60.00  360.00  0.43     0.49
## LDL          319 126.65 122.00  38.54  11.00  293.00  0.54     1.08
## HDL          319  49.48  46.50  17.72  25.00  273.00  6.47    77.18
## Triglyceride 319 144.50 119.00  97.90   1.39  838.00  2.76    12.65
## AST          319  21.68  18.00  16.70   8.00  195.00  6.93    60.06
## ALT          319  26.86  19.00  27.88   3.00  372.00  7.21    76.92
## ALP          319  73.11  71.00  24.18   7.00  197.00  0.79     2.51
## Creatinine   319   0.80   0.79   0.18   0.46    1.46  0.61     0.14
## GFR          319 100.82 104.00  16.97  10.60  132.00 -1.80     6.39
## CRP          319   1.85   0.22   4.99   0.00   43.40  5.36    33.23
## HGB          319  14.42  14.40   1.78   8.50   18.80 -0.38     0.13
## VitaminD     319  21.40  22.00   9.98   3.50   53.10  0.28    -0.24

4 Karakteristik Data menggunakan Plot

data %>%
  count(Status) %>%
  mutate(label = paste0(Status, "\nn=", n, " (", round(n/sum(n)*100,1), "%)")) %>%
  ggplot(aes(x=2, y=n, fill=Status)) +
  geom_col(color="white") +
  coord_polar(theta="y") +
  xlim(0.5, 2.5) +
  geom_text(aes(label=label), position=position_stack(vjust=0.5),
            color="white", fontface="bold", size=4) +
  scale_fill_manual(values=c("Batu Empedu"="#E74C3C","Normal"="#2980B9")) +
  theme_void() +
  theme(legend.position="none",
        plot.title=element_text(face="bold", hjust=0.5))

vars_plot <- c("Height","Weight","BMI","TBW","ECW","ICW",
               "TBFR","LeanMass","Protein","VFR","BoneMass",
               "MuscleMass","Obesity","TFC","VFA","VMA",
               "Glucose","HDL","Triglyceride","AST","ALT",
               "ALP","Creatinine","GFR","CRP","HGB","VitaminD")
daftar_plot <- lapply(vars_plot, function(v) {
  rata2 <- data %>%
    group_by(Status) %>%
    summarise(nilai = mean(.data[[v]], na.rm=TRUE), .groups="drop")
  ggplot(data, aes(x=.data[[v]], fill=Status, color=Status)) +
    geom_histogram(aes(y=after_stat(density)), bins=25,
                   alpha=0.4, position="identity", linewidth=0.2) +
    geom_density(linewidth=0.9, fill=NA) +
    geom_vline(data=rata2, aes(xintercept=nilai, color=Status),
               linetype="dashed", linewidth=0.7) +
    scale_fill_manual(values=c("Batu Empedu"="#E74C3C","Normal"="#2980B9")) +
    scale_color_manual(values=c("Batu Empedu"="#E74C3C","Normal"="#2980B9")) +
    labs(title=v, x=NULL, y=NULL) +
    theme_minimal(base_size=9) +
    theme(legend.position="none",
          plot.title=element_text(face="bold", size=9))
})

leg <- cowplot::get_legend(
  ggplot(data, aes(x=BMI, fill=Status)) +
    geom_density(alpha=0.4) +
    scale_fill_manual(values=c("Batu Empedu"="#E74C3C","Normal"="#2980B9")) +
    theme_minimal() +
    theme(legend.title=element_blank(), legend.position="bottom")
)

grid.arrange(grobs=c(daftar_plot, list(leg)), ncol=4)

5 Uji Asumsi Korelasi , Bartlet Test , KMO

5.1 Matriks Correlation

matriks_corr <- cor(data_num)
corrplot(matriks_corr)

5.2 Uji KMO

kmo <- KMO(data_num)
print(kmo)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = data_num)
## Overall MSA =  0.8
## MSA for each item = 
##       Height       Weight          BMI          TBW          ECW          ICW 
##         0.78         0.80         0.77         0.82         0.77         0.83 
##      ECF_TBW         TBFR     LeanMass      Protein          VFR     BoneMass 
##         0.47         0.86         0.84         0.79         0.84         0.97 
##   MuscleMass      Obesity          TFC          VFA          VMA      Glucose 
##         0.97         0.86         0.92         0.85         0.98         0.74 
##    TotalChol          LDL          HDL Triglyceride          AST          ALT 
##         0.39         0.40         0.67         0.64         0.60         0.66 
##          ALP   Creatinine          GFR          CRP          HGB     VitaminD 
##         0.52         0.87         0.46         0.57         0.95         0.77
data_num1 <- data_num[,-19]
kmo <- KMO(data_num1)
print(kmo)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = data_num1)
## Overall MSA =  0.83
## MSA for each item = 
##       Height       Weight          BMI          TBW          ECW          ICW 
##         0.78         0.80         0.77         0.82         0.77         0.83 
##      ECF_TBW         TBFR     LeanMass      Protein          VFR     BoneMass 
##         0.47         0.85         0.83         0.79         0.84         0.98 
##   MuscleMass      Obesity          TFC          VFA          VMA      Glucose 
##         0.98         0.85         0.92         0.85         0.98         0.72 
##          LDL          HDL Triglyceride          AST          ALT          ALP 
##         0.37         0.92         0.85         0.59         0.66         0.51 
##   Creatinine          GFR          CRP          HGB     VitaminD 
##         0.87         0.45         0.57         0.95         0.76
data_num2 <- data_num1[,-19]
kmo <- KMO(data_num2)
print(kmo)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = data_num2)
## Overall MSA =  0.83
## MSA for each item = 
##       Height       Weight          BMI          TBW          ECW          ICW 
##         0.78         0.80         0.77         0.82         0.77         0.83 
##      ECF_TBW         TBFR     LeanMass      Protein          VFR     BoneMass 
##         0.47         0.85         0.84         0.79         0.84         0.98 
##   MuscleMass      Obesity          TFC          VFA          VMA      Glucose 
##         0.98         0.86         0.92         0.85         0.98         0.72 
##          HDL Triglyceride          AST          ALT          ALP   Creatinine 
##         0.93         0.85         0.59         0.66         0.51         0.87 
##          GFR          CRP          HGB     VitaminD 
##         0.46         0.57         0.95         0.77
data_num3 <- data_num2[,-7]
kmo <- KMO(data_num3)
print(kmo)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = data_num3)
## Overall MSA =  0.84
## MSA for each item = 
##       Height       Weight          BMI          TBW          ECW          ICW 
##         0.76         0.78         0.76         0.87         0.87         0.85 
##         TBFR     LeanMass      Protein          VFR     BoneMass   MuscleMass 
##         0.84         0.83         0.71         0.79         0.98         0.97 
##      Obesity          TFC          VFA          VMA      Glucose          HDL 
##         0.85         0.91         0.83         0.98         0.72         0.93 
## Triglyceride          AST          ALT          ALP   Creatinine          GFR 
##         0.85         0.59         0.66         0.52         0.87         0.45 
##          CRP          HGB     VitaminD 
##         0.56         0.94         0.71

5.3 Uji Bartlet

bartlet_test <- cortest.bartlett(cor(data_num3), n = nrow(data_num3))
print(bartlet_test)
## $chisq
## [1] 10972.26
## 
## $p.value
## [1] 0
## 
## $df
## [1] 351

6 Principal Component Analysis

6.1 Manual PCA

scale_data <- scale(data_num3)
r <- cov(scale_data)

pc <- eigen(r)
print(pc)
## eigen() decomposition
## $values
##  [1] 8.543020116 5.909418055 1.767097501 1.548861969 1.312008248 1.082754767
##  [7] 1.004615498 0.918128477 0.862861127 0.743264160 0.613419767 0.558760336
## [13] 0.396786097 0.354203219 0.267787216 0.236783770 0.213971445 0.197460719
## [19] 0.127368589 0.118080201 0.074695297 0.056775299 0.041017532 0.023099247
## [25] 0.018565507 0.005410330 0.003785511
## 
## $vectors
##              [,1]        [,2]          [,3]         [,4]          [,5]
##  [1,] -0.23545404  0.21739162 -0.0037080070  0.159297609 -4.764273e-02
##  [2,] -0.29643149 -0.18668585 -0.0019815092  0.099540530  3.499169e-03
##  [3,] -0.15837712 -0.34424799 -0.0006168793  0.001001541  3.038913e-02
##  [4,] -0.32016947  0.05125864 -0.0091479125  0.088126444  3.114604e-02
##  [5,] -0.31536101 -0.00581424  0.0030269525  0.088530519  7.111574e-02
##  [6,] -0.30056274  0.09504513  0.0113295489  0.114935532 -1.874966e-02
##  [7,]  0.02897468 -0.39736411  0.0184905790 -0.013751353 -3.262792e-03
##  [8,] -0.03066373  0.39743338 -0.0177179259  0.020391258  8.990578e-03
##  [9,] -0.01034868  0.30409955 -0.1060017585 -0.088361470  1.215771e-03
## [10,] -0.23064175 -0.20969875 -0.1042019954 -0.137706904  1.523130e-01
## [11,] -0.29538715  0.05989780 -0.0329191254  0.109635196  1.252728e-02
## [12,] -0.32320327  0.06783934 -0.0079500131  0.101319044  4.704108e-03
## [13,] -0.00892062 -0.08537336  0.0235484157 -0.124989920 -1.529563e-01
## [14,] -0.11025679 -0.37407809  0.0141845791  0.041477852  4.196625e-05
## [15,] -0.21465074 -0.29718709 -0.0137875377  0.051602083  3.439374e-02
## [16,] -0.29935240  0.06364837 -0.0106835797  0.073550970 -1.175211e-02
## [17,] -0.06574309 -0.03518461 -0.2151597501 -0.384762663 -3.903055e-01
## [18,]  0.14510027 -0.07452986  0.0542479806  0.057143661  2.977579e-01
## [19,] -0.14460036  0.00485697 -0.0997808553 -0.280151290 -4.174899e-01
## [20,] -0.09610112  0.05474895  0.6014574692 -0.297276996  1.514606e-01
## [21,] -0.13100755  0.05244508  0.5713748644 -0.320363343  1.320284e-01
## [22,] -0.01983034 -0.06297339  0.0393821566 -0.377716562 -1.756683e-01
## [23,] -0.16440493  0.18033049 -0.2648574601 -0.275450669  2.683504e-01
## [24,]  0.02573697  0.03364893  0.3755609435  0.456652736 -4.460369e-01
## [25,]  0.01687440 -0.08164519 -0.1036946558 -0.048913634  1.924508e-01
## [26,] -0.20864638  0.16298786 -0.0124251704 -0.093428634 -7.504613e-02
## [27,]  0.00122398  0.06472836 -0.0611320368  0.042771378  3.769220e-01
##                [,6]          [,7]         [,8]          [,9]        [,10]
##  [1,] -0.1360202508  0.0213757059 -0.096588012 -0.0279727359  0.094037310
##  [2,] -0.0555381966  0.0065104896 -0.038060342 -0.0058103241  0.020676223
##  [3,]  0.0122069214 -0.0150835613  0.036851378 -0.0005271727 -0.045512188
##  [4,] -0.0060919643  0.0003081984  0.013937776 -0.0772807221  0.009521554
##  [5,]  0.1060885213 -0.0394572575  0.018193150 -0.0910516525 -0.027119804
##  [6,] -0.0669530502  0.0307733090  0.012273501 -0.0775786948  0.025942546
##  [7,] -0.0009865401 -0.0160417147 -0.032618264  0.1001337779 -0.005087421
##  [8,]  0.0063323807  0.0232487979  0.036373254 -0.0983423344  0.020231002
##  [9,] -0.1792256009  0.0775367701 -0.138731647  0.0417120340  0.065141061
## [10,]  0.1215901927 -0.0102352461 -0.076085760  0.0131206223 -0.045933913
## [11,]  0.0322030485  0.0153001874  0.018675552 -0.0957945872  0.072995917
## [12,] -0.0605425920  0.0304118624 -0.025698098 -0.0495480408  0.038830053
## [13,]  0.2361361620  0.7551329814  0.313331751 -0.3899567675 -0.164065391
## [14,] -0.0294964441 -0.0075243944 -0.053331424  0.0577360504  0.010202920
## [15,] -0.0094032619 -0.0021873921 -0.075931734  0.0242650545  0.017321013
## [16,] -0.1008442836  0.0187702595 -0.006464326  0.0167799871  0.050186145
## [17,]  0.2066579968 -0.0587838054 -0.021218315 -0.1721854251  0.563753587
## [18,] -0.0109034933  0.2164086724 -0.485846708 -0.2226472177  0.575425361
## [19,]  0.0354243774 -0.1043015343  0.189055502  0.4206995129  0.155529182
## [20,]  0.0378861664  0.0172161356  0.096585466  0.1321196990  0.074677536
## [21,] -0.0364953891  0.0170471603 -0.001915481  0.0597955604  0.068388810
## [22,] -0.2649887178 -0.3767288117 -0.225091240 -0.6221874373 -0.331258111
## [23,]  0.0100900502  0.1160201691 -0.054350095  0.1293645374 -0.184739759
## [24,]  0.0392899383 -0.1183126254  0.085579659 -0.1596123491  0.089059741
## [25,] -0.6483690504  0.0003950853  0.585917562 -0.1414825544  0.291519394
## [26,]  0.1310454060  0.0229409601 -0.115852074  0.0035240990 -0.069939970
## [27,]  0.5363619511 -0.4317319526  0.390757659 -0.2505864136  0.136568863
##              [,11]        [,12]        [,13]        [,14]        [,15]
##  [1,]  0.012041336  0.092978708 -0.299316478  0.479375672  0.135161452
##  [2,] -0.110304952  0.032306750 -0.083136895  0.065004074 -0.052930834
##  [3,] -0.122888631 -0.017341724  0.093131663 -0.243168952 -0.148850835
##  [4,] -0.003494525 -0.055983473  0.182505663  0.014799875  0.040699621
##  [5,]  0.159455097 -0.097459910  0.262760668 -0.002422531  0.101624999
##  [6,]  0.005467107  0.045722487 -0.004904177 -0.020289256 -0.122178716
##  [7,] -0.044131716  0.075036868 -0.205196203  0.128001633 -0.002814619
##  [8,]  0.042492675 -0.091784324  0.201920694 -0.129450233  0.019291012
##  [9,] -0.626476246  0.066228992 -0.353678246 -0.354090863 -0.100961336
## [10,] -0.029309594 -0.120154829  0.077874815 -0.522443055  0.014025617
## [11,] -0.025689500 -0.089818173  0.226549884 -0.007174512  0.189299354
## [12,] -0.103056689 -0.012229174  0.032184864 -0.002715459 -0.027568377
## [13,] -0.115665430  0.162078546 -0.027951164  0.060318733  0.026391894
## [14,] -0.078891490  0.036998520 -0.157989060  0.115535010 -0.075460271
## [15,]  0.066304600  0.023642478 -0.190852697  0.070811250 -0.065319909
## [16,] -0.243703041  0.024749150 -0.054150455  0.078277371  0.132744903
## [17,]  0.059453811 -0.457703138 -0.149717654  0.073591939 -0.072734613
## [18,]  0.055074658  0.385472773  0.227286640 -0.028518397 -0.068382841
## [19,] -0.088447578  0.574474910  0.335991814  0.027233861  0.026171773
## [20,] -0.039753513 -0.085016254 -0.042629551  0.026148917  0.038812290
## [21,] -0.005335826 -0.050267936 -0.012942965  0.035104550 -0.050896123
## [22,] -0.058878659  0.188323121  0.092306520  0.072055004  0.008889710
## [23,]  0.156957537  0.001530598  0.049756111  0.227472310 -0.726940494
## [24,]  0.054125031  0.051250474 -0.015415291 -0.179617106 -0.535111713
## [25,]  0.204706377  0.043967083 -0.061799951 -0.128751714 -0.032782244
## [26,]  0.574623383  0.320070492 -0.479235283 -0.355300605  0.146419933
## [27,] -0.190353787  0.255053085 -0.165195934  0.075163166 -0.045723570
##              [,16]         [,17]        [,18]         [,19]        [,20]
##  [1,]  0.327508392 -0.1889480400  0.083787864  0.0216984436 -0.081699049
##  [2,] -0.038508741  0.0215472973  0.039452624 -0.0374354387  0.167663282
##  [3,] -0.294717245  0.1351191051 -0.062378195 -0.0392394039  0.244815942
##  [4,]  0.215432325  0.0619809842 -0.205324985 -0.2786539271  0.438676933
##  [5,]  0.212297849  0.0009776405 -0.109834706 -0.0502582606  0.103553023
##  [6,] -0.355825946  0.2419521056  0.632573935  0.2610676059 -0.086318751
##  [7,] -0.083487221 -0.0717665744 -0.134652303 -0.0178382994 -0.011158336
##  [8,]  0.062985432  0.0564170680  0.120117310  0.0223680686 -0.000334363
##  [9,]  0.025631804 -0.2126522170 -0.036729530 -0.0851044012  0.136889429
## [10,]  0.460105184 -0.0864955753  0.105622641  0.1189909910 -0.372541205
## [11,] -0.481255765 -0.6655529657 -0.177720800  0.0095104279 -0.248709740
## [12,]  0.018619889  0.0801384025  0.144558503 -0.0293083578  0.294285189
## [13,]  0.064596454 -0.0127231144  0.005684504 -0.0065316495 -0.025532719
## [14,] -0.046208205 -0.0811932452  0.007564407 -0.0925106026  0.057933513
## [15,]  0.231153372 -0.1401813095  0.211978208  0.1082025786 -0.133673076
## [16,] -0.091527208  0.5553049679 -0.496715561  0.1327349492 -0.447522082
## [17,] -0.039348415  0.0607572249 -0.010211416  0.0003021102  0.040684306
## [18,]  0.006118770  0.0345829342 -0.047679847  0.0478518720  0.011350308
## [19,]  0.085919243 -0.0525919670  0.062309461  0.0032934360 -0.012559094
## [20,]  0.042787424 -0.1013368296 -0.143974607  0.6042771557  0.255853668
## [21,] -0.061853241  0.0550709128  0.169684102 -0.6379465735 -0.263609089
## [22,]  0.013902135 -0.0276154333 -0.023270026  0.0773235950 -0.004160230
## [23,] -0.038220882 -0.0729712305 -0.183040664  0.0431173029 -0.063672368
## [24,]  0.124984324 -0.0903800211 -0.161788904  0.0172485229 -0.123776825
## [25,]  0.051071506 -0.0416874194 -0.049245987 -0.0083776960 -0.016706875
## [26,] -0.168569974  0.0309883609 -0.157393923 -0.0547324812  0.097983981
## [27,] -0.004227577  0.0098523301  0.025741372 -0.0391431403 -0.015483611
##              [,21]         [,22]        [,23]         [,24]        [,25]
##  [1,]  0.097970737 -0.0672698627  0.004709907  0.4437955216  0.185311340
##  [2,]  0.022876951 -0.0748532743  0.107335186  0.2331420682  0.228110052
##  [3,]  0.005852499 -0.1130343346  0.077454856  0.2951324826  0.519327459
##  [4,] -0.416517207  0.1005592031  0.351411531  0.0734243106 -0.390283428
##  [5,]  0.726108469 -0.1360192766  0.151669714 -0.3284272605  0.050102950
##  [6,]  0.102496911  0.0319118706  0.259030099  0.0430141459 -0.326411229
##  [7,]  0.205761573  0.3835611838  0.092603069  0.0247024822 -0.266523994
##  [8,] -0.206597647 -0.3628137836 -0.072479739 -0.0623478611  0.143859732
##  [9,]  0.177504997 -0.0369647878  0.164508442 -0.1784647694 -0.028592861
## [10,] -0.019618005  0.0586125252 -0.112325002  0.3304403788 -0.152661230
## [11,] -0.105951419  0.0517252821 -0.024265488 -0.0054603671 -0.023472926
## [12,] -0.006616124  0.3987358825 -0.746090527 -0.1590310155  0.038849229
## [13,]  0.005875118 -0.0046963884 -0.003003255 -0.0042171771  0.001877854
## [14,] -0.034809611 -0.7017620045 -0.328272605 -0.0918936888 -0.387357446
## [15,] -0.370719221  0.0581652637  0.217047251 -0.5954945241  0.328885433
## [16,] -0.082204763 -0.0233560543 -0.027607141 -0.1047494783  0.001864987
## [17,]  0.018183062  0.0036268452  0.010942875  0.0043126868  0.002102103
## [18,]  0.007165899 -0.0013193927  0.003930012  0.0081957061  0.000352813
## [19,]  0.001449447 -0.0186901864  0.003812208 -0.0144737287  0.015051997
## [20,] -0.031424207 -0.0411867137  0.006275874  0.0139574782 -0.036991252
## [21,]  0.025056548  0.0364268784  0.001604572 -0.0102488695  0.053973468
## [22,] -0.011508211  0.0015498719 -0.012645810 -0.0114751954 -0.009223695
## [23,]  0.015612087  0.0182768697 -0.017182319  0.0157819058 -0.018873454
## [24,]  0.021360062  0.0318448193 -0.014449417  0.0224436817 -0.035140096
## [25,]  0.035231202 -0.0009527924 -0.011703370 -0.0066132353 -0.014658271
## [26,] -0.012845435 -0.0328822272 -0.034063217 -0.0071284137 -0.002839603
## [27,] -0.027586100  0.0013167622 -0.017956093  0.0003324248  0.002188838
##               [,26]         [,27]
##  [1,] -0.0016012928  0.2875894479
##  [2,] -0.1084673138 -0.8163012888
##  [3,] -0.0096955250  0.4473543035
##  [4,]  0.0453628190  0.1098362784
##  [5,]  0.0076286783  0.0398027479
##  [6,]  0.0369363755  0.0888452361
##  [7,] -0.6700740328  0.1178914672
##  [8,] -0.7304102671  0.0212097902
##  [9,]  0.0133917384  0.0386546859
## [10,]  0.0010777182 -0.0114552420
## [11,]  0.0249185776 -0.0066474831
## [12,] -0.0047395121  0.0341045915
## [13,] -0.0001528412  0.0002482526
## [14,]  0.0287530206  0.0756458790
## [15,] -0.0037687292  0.0764706940
## [16,]  0.0100805572  0.0110461609
## [17,]  0.0071776527 -0.0007167878
## [18,]  0.0011495481  0.0021567621
## [19,] -0.0098332779  0.0039923647
## [20,]  0.0064163087 -0.0050569152
## [21,] -0.0046192832  0.0038810164
## [22,] -0.0117645196 -0.0059065642
## [23,] -0.0058914753 -0.0046337065
## [24,] -0.0012134038 -0.0015015100
## [25,]  0.0022065482 -0.0105892736
## [26,] -0.0012660659 -0.0129652820
## [27,] -0.0002277842 -0.0017883147
sumvar <- sum(pc$values)
propvar <- sapply(pc$values, function(x) x/sumvar)*100
cumvar <- data.frame(cbind(pc$values, propvar)) %>% mutate(cum = cumsum(propvar))
colnames(cumvar)[1] <- "eigen_value"
row.names(cumvar) <- paste0("PC",c(1:ncol(data_num3)))
print(cumvar)
##      eigen_value     propvar       cum
## PC1  8.543020116 31.64081525  31.64082
## PC2  5.909418055 21.88673354  53.52755
## PC3  1.767097501  6.54480556  60.07235
## PC4  1.548861969  5.73652581  65.80888
## PC5  1.312008248  4.85928981  70.66817
## PC6  1.082754767  4.01020284  74.67837
## PC7  1.004615498  3.72079814  78.39917
## PC8  0.918128477  3.40047584  81.79965
## PC9  0.862861127  3.19578195  84.99543
## PC10 0.743264160  2.75283022  87.74826
## PC11 0.613419767  2.27192506  90.02018
## PC12 0.558760336  2.06948273  92.08967
## PC13 0.396786097  1.46957814  93.55924
## PC14 0.354203219  1.31186377  94.87111
## PC15 0.267787216  0.99180450  95.86291
## PC16 0.236783770  0.87697692  96.73989
## PC17 0.213971445  0.79248683  97.53238
## PC18 0.197460719  0.73133600  98.26371
## PC19 0.127368589  0.47173552  98.73545
## PC20 0.118080201  0.43733408  99.17278
## PC21 0.074695297  0.27664925  99.44943
## PC22 0.056775299  0.21027888  99.65971
## PC23 0.041017532  0.15191679  99.81163
## PC24 0.023099247  0.08555277  99.89718
## PC25 0.018565507  0.06876114  99.96594
## PC26 0.005410330  0.02003826  99.98598
## PC27 0.003785511  0.01402041 100.00000
print('eigen vectors:')
## [1] "eigen vectors:"
pc$vectors
##              [,1]        [,2]          [,3]         [,4]          [,5]
##  [1,] -0.23545404  0.21739162 -0.0037080070  0.159297609 -4.764273e-02
##  [2,] -0.29643149 -0.18668585 -0.0019815092  0.099540530  3.499169e-03
##  [3,] -0.15837712 -0.34424799 -0.0006168793  0.001001541  3.038913e-02
##  [4,] -0.32016947  0.05125864 -0.0091479125  0.088126444  3.114604e-02
##  [5,] -0.31536101 -0.00581424  0.0030269525  0.088530519  7.111574e-02
##  [6,] -0.30056274  0.09504513  0.0113295489  0.114935532 -1.874966e-02
##  [7,]  0.02897468 -0.39736411  0.0184905790 -0.013751353 -3.262792e-03
##  [8,] -0.03066373  0.39743338 -0.0177179259  0.020391258  8.990578e-03
##  [9,] -0.01034868  0.30409955 -0.1060017585 -0.088361470  1.215771e-03
## [10,] -0.23064175 -0.20969875 -0.1042019954 -0.137706904  1.523130e-01
## [11,] -0.29538715  0.05989780 -0.0329191254  0.109635196  1.252728e-02
## [12,] -0.32320327  0.06783934 -0.0079500131  0.101319044  4.704108e-03
## [13,] -0.00892062 -0.08537336  0.0235484157 -0.124989920 -1.529563e-01
## [14,] -0.11025679 -0.37407809  0.0141845791  0.041477852  4.196625e-05
## [15,] -0.21465074 -0.29718709 -0.0137875377  0.051602083  3.439374e-02
## [16,] -0.29935240  0.06364837 -0.0106835797  0.073550970 -1.175211e-02
## [17,] -0.06574309 -0.03518461 -0.2151597501 -0.384762663 -3.903055e-01
## [18,]  0.14510027 -0.07452986  0.0542479806  0.057143661  2.977579e-01
## [19,] -0.14460036  0.00485697 -0.0997808553 -0.280151290 -4.174899e-01
## [20,] -0.09610112  0.05474895  0.6014574692 -0.297276996  1.514606e-01
## [21,] -0.13100755  0.05244508  0.5713748644 -0.320363343  1.320284e-01
## [22,] -0.01983034 -0.06297339  0.0393821566 -0.377716562 -1.756683e-01
## [23,] -0.16440493  0.18033049 -0.2648574601 -0.275450669  2.683504e-01
## [24,]  0.02573697  0.03364893  0.3755609435  0.456652736 -4.460369e-01
## [25,]  0.01687440 -0.08164519 -0.1036946558 -0.048913634  1.924508e-01
## [26,] -0.20864638  0.16298786 -0.0124251704 -0.093428634 -7.504613e-02
## [27,]  0.00122398  0.06472836 -0.0611320368  0.042771378  3.769220e-01
##                [,6]          [,7]         [,8]          [,9]        [,10]
##  [1,] -0.1360202508  0.0213757059 -0.096588012 -0.0279727359  0.094037310
##  [2,] -0.0555381966  0.0065104896 -0.038060342 -0.0058103241  0.020676223
##  [3,]  0.0122069214 -0.0150835613  0.036851378 -0.0005271727 -0.045512188
##  [4,] -0.0060919643  0.0003081984  0.013937776 -0.0772807221  0.009521554
##  [5,]  0.1060885213 -0.0394572575  0.018193150 -0.0910516525 -0.027119804
##  [6,] -0.0669530502  0.0307733090  0.012273501 -0.0775786948  0.025942546
##  [7,] -0.0009865401 -0.0160417147 -0.032618264  0.1001337779 -0.005087421
##  [8,]  0.0063323807  0.0232487979  0.036373254 -0.0983423344  0.020231002
##  [9,] -0.1792256009  0.0775367701 -0.138731647  0.0417120340  0.065141061
## [10,]  0.1215901927 -0.0102352461 -0.076085760  0.0131206223 -0.045933913
## [11,]  0.0322030485  0.0153001874  0.018675552 -0.0957945872  0.072995917
## [12,] -0.0605425920  0.0304118624 -0.025698098 -0.0495480408  0.038830053
## [13,]  0.2361361620  0.7551329814  0.313331751 -0.3899567675 -0.164065391
## [14,] -0.0294964441 -0.0075243944 -0.053331424  0.0577360504  0.010202920
## [15,] -0.0094032619 -0.0021873921 -0.075931734  0.0242650545  0.017321013
## [16,] -0.1008442836  0.0187702595 -0.006464326  0.0167799871  0.050186145
## [17,]  0.2066579968 -0.0587838054 -0.021218315 -0.1721854251  0.563753587
## [18,] -0.0109034933  0.2164086724 -0.485846708 -0.2226472177  0.575425361
## [19,]  0.0354243774 -0.1043015343  0.189055502  0.4206995129  0.155529182
## [20,]  0.0378861664  0.0172161356  0.096585466  0.1321196990  0.074677536
## [21,] -0.0364953891  0.0170471603 -0.001915481  0.0597955604  0.068388810
## [22,] -0.2649887178 -0.3767288117 -0.225091240 -0.6221874373 -0.331258111
## [23,]  0.0100900502  0.1160201691 -0.054350095  0.1293645374 -0.184739759
## [24,]  0.0392899383 -0.1183126254  0.085579659 -0.1596123491  0.089059741
## [25,] -0.6483690504  0.0003950853  0.585917562 -0.1414825544  0.291519394
## [26,]  0.1310454060  0.0229409601 -0.115852074  0.0035240990 -0.069939970
## [27,]  0.5363619511 -0.4317319526  0.390757659 -0.2505864136  0.136568863
##              [,11]        [,12]        [,13]        [,14]        [,15]
##  [1,]  0.012041336  0.092978708 -0.299316478  0.479375672  0.135161452
##  [2,] -0.110304952  0.032306750 -0.083136895  0.065004074 -0.052930834
##  [3,] -0.122888631 -0.017341724  0.093131663 -0.243168952 -0.148850835
##  [4,] -0.003494525 -0.055983473  0.182505663  0.014799875  0.040699621
##  [5,]  0.159455097 -0.097459910  0.262760668 -0.002422531  0.101624999
##  [6,]  0.005467107  0.045722487 -0.004904177 -0.020289256 -0.122178716
##  [7,] -0.044131716  0.075036868 -0.205196203  0.128001633 -0.002814619
##  [8,]  0.042492675 -0.091784324  0.201920694 -0.129450233  0.019291012
##  [9,] -0.626476246  0.066228992 -0.353678246 -0.354090863 -0.100961336
## [10,] -0.029309594 -0.120154829  0.077874815 -0.522443055  0.014025617
## [11,] -0.025689500 -0.089818173  0.226549884 -0.007174512  0.189299354
## [12,] -0.103056689 -0.012229174  0.032184864 -0.002715459 -0.027568377
## [13,] -0.115665430  0.162078546 -0.027951164  0.060318733  0.026391894
## [14,] -0.078891490  0.036998520 -0.157989060  0.115535010 -0.075460271
## [15,]  0.066304600  0.023642478 -0.190852697  0.070811250 -0.065319909
## [16,] -0.243703041  0.024749150 -0.054150455  0.078277371  0.132744903
## [17,]  0.059453811 -0.457703138 -0.149717654  0.073591939 -0.072734613
## [18,]  0.055074658  0.385472773  0.227286640 -0.028518397 -0.068382841
## [19,] -0.088447578  0.574474910  0.335991814  0.027233861  0.026171773
## [20,] -0.039753513 -0.085016254 -0.042629551  0.026148917  0.038812290
## [21,] -0.005335826 -0.050267936 -0.012942965  0.035104550 -0.050896123
## [22,] -0.058878659  0.188323121  0.092306520  0.072055004  0.008889710
## [23,]  0.156957537  0.001530598  0.049756111  0.227472310 -0.726940494
## [24,]  0.054125031  0.051250474 -0.015415291 -0.179617106 -0.535111713
## [25,]  0.204706377  0.043967083 -0.061799951 -0.128751714 -0.032782244
## [26,]  0.574623383  0.320070492 -0.479235283 -0.355300605  0.146419933
## [27,] -0.190353787  0.255053085 -0.165195934  0.075163166 -0.045723570
##              [,16]         [,17]        [,18]         [,19]        [,20]
##  [1,]  0.327508392 -0.1889480400  0.083787864  0.0216984436 -0.081699049
##  [2,] -0.038508741  0.0215472973  0.039452624 -0.0374354387  0.167663282
##  [3,] -0.294717245  0.1351191051 -0.062378195 -0.0392394039  0.244815942
##  [4,]  0.215432325  0.0619809842 -0.205324985 -0.2786539271  0.438676933
##  [5,]  0.212297849  0.0009776405 -0.109834706 -0.0502582606  0.103553023
##  [6,] -0.355825946  0.2419521056  0.632573935  0.2610676059 -0.086318751
##  [7,] -0.083487221 -0.0717665744 -0.134652303 -0.0178382994 -0.011158336
##  [8,]  0.062985432  0.0564170680  0.120117310  0.0223680686 -0.000334363
##  [9,]  0.025631804 -0.2126522170 -0.036729530 -0.0851044012  0.136889429
## [10,]  0.460105184 -0.0864955753  0.105622641  0.1189909910 -0.372541205
## [11,] -0.481255765 -0.6655529657 -0.177720800  0.0095104279 -0.248709740
## [12,]  0.018619889  0.0801384025  0.144558503 -0.0293083578  0.294285189
## [13,]  0.064596454 -0.0127231144  0.005684504 -0.0065316495 -0.025532719
## [14,] -0.046208205 -0.0811932452  0.007564407 -0.0925106026  0.057933513
## [15,]  0.231153372 -0.1401813095  0.211978208  0.1082025786 -0.133673076
## [16,] -0.091527208  0.5553049679 -0.496715561  0.1327349492 -0.447522082
## [17,] -0.039348415  0.0607572249 -0.010211416  0.0003021102  0.040684306
## [18,]  0.006118770  0.0345829342 -0.047679847  0.0478518720  0.011350308
## [19,]  0.085919243 -0.0525919670  0.062309461  0.0032934360 -0.012559094
## [20,]  0.042787424 -0.1013368296 -0.143974607  0.6042771557  0.255853668
## [21,] -0.061853241  0.0550709128  0.169684102 -0.6379465735 -0.263609089
## [22,]  0.013902135 -0.0276154333 -0.023270026  0.0773235950 -0.004160230
## [23,] -0.038220882 -0.0729712305 -0.183040664  0.0431173029 -0.063672368
## [24,]  0.124984324 -0.0903800211 -0.161788904  0.0172485229 -0.123776825
## [25,]  0.051071506 -0.0416874194 -0.049245987 -0.0083776960 -0.016706875
## [26,] -0.168569974  0.0309883609 -0.157393923 -0.0547324812  0.097983981
## [27,] -0.004227577  0.0098523301  0.025741372 -0.0391431403 -0.015483611
##              [,21]         [,22]        [,23]         [,24]        [,25]
##  [1,]  0.097970737 -0.0672698627  0.004709907  0.4437955216  0.185311340
##  [2,]  0.022876951 -0.0748532743  0.107335186  0.2331420682  0.228110052
##  [3,]  0.005852499 -0.1130343346  0.077454856  0.2951324826  0.519327459
##  [4,] -0.416517207  0.1005592031  0.351411531  0.0734243106 -0.390283428
##  [5,]  0.726108469 -0.1360192766  0.151669714 -0.3284272605  0.050102950
##  [6,]  0.102496911  0.0319118706  0.259030099  0.0430141459 -0.326411229
##  [7,]  0.205761573  0.3835611838  0.092603069  0.0247024822 -0.266523994
##  [8,] -0.206597647 -0.3628137836 -0.072479739 -0.0623478611  0.143859732
##  [9,]  0.177504997 -0.0369647878  0.164508442 -0.1784647694 -0.028592861
## [10,] -0.019618005  0.0586125252 -0.112325002  0.3304403788 -0.152661230
## [11,] -0.105951419  0.0517252821 -0.024265488 -0.0054603671 -0.023472926
## [12,] -0.006616124  0.3987358825 -0.746090527 -0.1590310155  0.038849229
## [13,]  0.005875118 -0.0046963884 -0.003003255 -0.0042171771  0.001877854
## [14,] -0.034809611 -0.7017620045 -0.328272605 -0.0918936888 -0.387357446
## [15,] -0.370719221  0.0581652637  0.217047251 -0.5954945241  0.328885433
## [16,] -0.082204763 -0.0233560543 -0.027607141 -0.1047494783  0.001864987
## [17,]  0.018183062  0.0036268452  0.010942875  0.0043126868  0.002102103
## [18,]  0.007165899 -0.0013193927  0.003930012  0.0081957061  0.000352813
## [19,]  0.001449447 -0.0186901864  0.003812208 -0.0144737287  0.015051997
## [20,] -0.031424207 -0.0411867137  0.006275874  0.0139574782 -0.036991252
## [21,]  0.025056548  0.0364268784  0.001604572 -0.0102488695  0.053973468
## [22,] -0.011508211  0.0015498719 -0.012645810 -0.0114751954 -0.009223695
## [23,]  0.015612087  0.0182768697 -0.017182319  0.0157819058 -0.018873454
## [24,]  0.021360062  0.0318448193 -0.014449417  0.0224436817 -0.035140096
## [25,]  0.035231202 -0.0009527924 -0.011703370 -0.0066132353 -0.014658271
## [26,] -0.012845435 -0.0328822272 -0.034063217 -0.0071284137 -0.002839603
## [27,] -0.027586100  0.0013167622 -0.017956093  0.0003324248  0.002188838
##               [,26]         [,27]
##  [1,] -0.0016012928  0.2875894479
##  [2,] -0.1084673138 -0.8163012888
##  [3,] -0.0096955250  0.4473543035
##  [4,]  0.0453628190  0.1098362784
##  [5,]  0.0076286783  0.0398027479
##  [6,]  0.0369363755  0.0888452361
##  [7,] -0.6700740328  0.1178914672
##  [8,] -0.7304102671  0.0212097902
##  [9,]  0.0133917384  0.0386546859
## [10,]  0.0010777182 -0.0114552420
## [11,]  0.0249185776 -0.0066474831
## [12,] -0.0047395121  0.0341045915
## [13,] -0.0001528412  0.0002482526
## [14,]  0.0287530206  0.0756458790
## [15,] -0.0037687292  0.0764706940
## [16,]  0.0100805572  0.0110461609
## [17,]  0.0071776527 -0.0007167878
## [18,]  0.0011495481  0.0021567621
## [19,] -0.0098332779  0.0039923647
## [20,]  0.0064163087 -0.0050569152
## [21,] -0.0046192832  0.0038810164
## [22,] -0.0117645196 -0.0059065642
## [23,] -0.0058914753 -0.0046337065
## [24,] -0.0012134038 -0.0015015100
## [25,]  0.0022065482 -0.0105892736
## [26,] -0.0012660659 -0.0129652820
## [27,] -0.0002277842 -0.0017883147

6.2 With Function PCA for Visualisation

pca_result <- PCA(scale_data,
                  scale.unit = TRUE,
                  graph = FALSE,
                  ncp=ncol(data_num3))
pca_result$eig
##          eigenvalue percentage of variance cumulative percentage of variance
## comp 1  8.543020116            31.64081525                          31.64082
## comp 2  5.909418055            21.88673354                          53.52755
## comp 3  1.767097501             6.54480556                          60.07235
## comp 4  1.548861969             5.73652581                          65.80888
## comp 5  1.312008248             4.85928981                          70.66817
## comp 6  1.082754767             4.01020284                          74.67837
## comp 7  1.004615498             3.72079814                          78.39917
## comp 8  0.918128477             3.40047584                          81.79965
## comp 9  0.862861127             3.19578195                          84.99543
## comp 10 0.743264160             2.75283022                          87.74826
## comp 11 0.613419767             2.27192506                          90.02018
## comp 12 0.558760336             2.06948273                          92.08967
## comp 13 0.396786097             1.46957814                          93.55924
## comp 14 0.354203219             1.31186377                          94.87111
## comp 15 0.267787216             0.99180450                          95.86291
## comp 16 0.236783770             0.87697692                          96.73989
## comp 17 0.213971445             0.79248683                          97.53238
## comp 18 0.197460719             0.73133600                          98.26371
## comp 19 0.127368589             0.47173552                          98.73545
## comp 20 0.118080201             0.43733408                          99.17278
## comp 21 0.074695297             0.27664925                          99.44943
## comp 22 0.056775299             0.21027888                          99.65971
## comp 23 0.041017532             0.15191679                          99.81163
## comp 24 0.023099247             0.08555277                          99.89718
## comp 25 0.018565507             0.06876114                          99.96594
## comp 26 0.005410330             0.02003826                          99.98598
## comp 27 0.003785511             0.01402041                         100.00000
fviz_eig(pca_result,
         choice = "eigenvalue",
         addlabels = TRUE,
         ncp = ncol(data_num3),
         barfill = "skyblue",
         barcolor = "darkblue",
         linecolor = "red")+
  geom_hline(yintercept = 1, linetype = "dashed", color = "black", size = 1)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning in geom_bar(stat = "identity", fill = barfill, color = barcolor, :
## Ignoring empty aesthetic: `width`.

fviz_pca_biplot(pca_result,
                col.ind = data$Status,
                palette = c("Batu Empedu" = "#E74C3C", "Normal" = "#2980B9"),
                addEllipses = TRUE,
                ellipse.type = "confidence",
                col.var = "black",
                label = "var",
                repel = TRUE,
                legend.title = "Status") +
  labs(title = "Biplot PCA — Gallstone Disease") +
  theme_minimal(base_size = 11)
## Ignoring unknown labels:
## • linetype : "Status"

fviz_pca_var(pca_result,
             col.var = "cos2",
             gradient.cols = c("#2980B9", "#F39C12", "#E74C3C"),
             repel = TRUE,
             legend.title = "cos²") +
  labs(title = "Correlation Circle PCA — Gallstone Disease") +
  theme_minimal(base_size = 11)
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## ℹ The deprecated feature was likely used in the factoextra package.
##   Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Ignoring unknown labels:
## • fill : "cos²"
## • linetype : "cos²"
## • shape : "cos²"

contrib_PC1 <- fviz_contrib(pca_result, choice = "var", axes = 1, top = 10) + ggtitle("Kontribusi Variabel — PC1 (31.64%)")
contrib_PC2 <- fviz_contrib(pca_result, choice = "var", axes = 2, top = 10) + ggtitle("Kontribusi Variabel — PC2 (21.89%)")
contrib_PC3 <- fviz_contrib(pca_result, choice = "var", axes = 3, top = 10) + ggtitle("Kontribusi Variabel — PC3 (6.54%)")
contrib_PC4 <- fviz_contrib(pca_result, choice = "var", axes = 4, top = 10) + ggtitle("Kontribusi Variabel — PC4 (5.74%)")
contrib_PC5 <- fviz_contrib(pca_result, choice = "var", axes = 5, top = 10) + ggtitle("Kontribusi Variabel — PC5 (4.86%)")
contrib_PC6 <- fviz_contrib(pca_result, choice = "var", axes = 6, top = 10) + ggtitle("Kontribusi Variabel — PC6 (4.01%)")
contrib_PC7 <- fviz_contrib(pca_result, choice = "var", axes = 7, top = 10) + ggtitle("Kontribusi Variabel — PC7 (3.72%)")

grid.arrange(contrib_PC1, contrib_PC2, contrib_PC3,
             contrib_PC4, contrib_PC5, contrib_PC6, contrib_PC7,
             ncol = 3)

pc <- principal(data_num3,nfactors = 7, rotate= "none")
pc
## Principal Components Analysis
## Call: principal(r = data_num3, nfactors = 7, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                PC1   PC2   PC3   PC4   PC5   PC6   PC7   h2    u2 com
## Height        0.69 -0.53  0.00 -0.20 -0.05  0.14  0.02 0.82 0.184 2.2
## Weight        0.87  0.45  0.00 -0.12  0.00  0.06  0.01 0.98 0.025 1.6
## BMI           0.46  0.84  0.00  0.00  0.03 -0.01 -0.02 0.92 0.084 1.6
## TBW           0.94 -0.12 -0.01 -0.11  0.04  0.01  0.00 0.90 0.095 1.1
## ECW           0.92  0.01  0.00 -0.11  0.08 -0.11 -0.04 0.88 0.118 1.1
## ICW           0.88 -0.23  0.02 -0.14 -0.02  0.07  0.03 0.85 0.148 1.2
## TBFR         -0.08  0.97  0.02  0.02  0.00  0.00 -0.02 0.94 0.059 1.0
## LeanMass      0.09 -0.97 -0.02 -0.03  0.01 -0.01  0.02 0.94 0.057 1.0
## Protein       0.03 -0.74 -0.14  0.11  0.00  0.19  0.08 0.62 0.380 1.3
## VFR           0.67  0.51 -0.14  0.17  0.17 -0.13 -0.01 0.81 0.191 2.4
## BoneMass      0.86 -0.15 -0.04 -0.14  0.01 -0.03  0.02 0.79 0.211 1.1
## MuscleMass    0.94 -0.16 -0.01 -0.13  0.01  0.06  0.03 0.94 0.059 1.1
## Obesity       0.03  0.21  0.03  0.16 -0.18 -0.25  0.76 0.73 0.267 1.6
## TFC           0.32  0.91  0.02 -0.05  0.00  0.03 -0.01 0.93 0.065 1.3
## VFA           0.63  0.72 -0.02 -0.06  0.04  0.01  0.00 0.92 0.078 2.0
## VMA           0.87 -0.15 -0.01 -0.09 -0.01  0.10  0.02 0.81 0.190 1.1
## Glucose       0.19  0.09 -0.29  0.48 -0.45 -0.22 -0.06 0.60 0.395 3.6
## HDL          -0.42  0.18  0.07 -0.07  0.34  0.01  0.22 0.39 0.614 3.0
## Triglyceride  0.42 -0.01 -0.13  0.35 -0.48 -0.04 -0.10 0.56 0.441 3.1
## AST           0.28 -0.13  0.80  0.37  0.17 -0.04  0.02 0.90 0.095 1.9
## ALT           0.38 -0.13  0.76  0.40  0.15  0.04  0.02 0.92 0.077 2.2
## ALP           0.06  0.15  0.05  0.47 -0.20  0.28 -0.38 0.51 0.490 3.4
## Creatinine    0.48 -0.44 -0.35  0.34  0.31 -0.01  0.12 0.77 0.227 4.6
## GFR          -0.08 -0.08  0.50 -0.57 -0.51 -0.04 -0.12 0.86 0.139 3.2
## CRP          -0.05  0.20 -0.14  0.06  0.22  0.67  0.00 0.57 0.432 1.5
## HGB           0.61 -0.40 -0.02  0.12 -0.09 -0.14  0.02 0.57 0.431 2.0
## VitaminD      0.00 -0.16 -0.08 -0.05  0.43 -0.56 -0.43 0.72 0.281 3.1
## 
##                        PC1  PC2  PC3  PC4  PC5  PC6  PC7
## SS loadings           8.54 5.91 1.77 1.55 1.31 1.08 1.00
## Proportion Var        0.32 0.22 0.07 0.06 0.05 0.04 0.04
## Cumulative Var        0.32 0.54 0.60 0.66 0.71 0.75 0.78
## Proportion Explained  0.40 0.28 0.08 0.07 0.06 0.05 0.05
## Cumulative Proportion 0.40 0.68 0.77 0.84 0.90 0.95 1.00
## 
## Mean item complexity =  2
## Test of the hypothesis that 7 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.03 
##  with the empirical chi square  226.72  with prob <  0.015 
## 
## Fit based upon off diagonal values = 0.99
fa.diagram(pc, 
           cut = 0.40,     
           digits = 2, 
           sort = TRUE,
           cex = 0.7)   

7 Factor Analysis

7.1 Manual FA

fa_eigen <- eigen(r)
fa_eigen$values
##  [1] 8.543020116 5.909418055 1.767097501 1.548861969 1.312008248 1.082754767
##  [7] 1.004615498 0.918128477 0.862861127 0.743264160 0.613419767 0.558760336
## [13] 0.396786097 0.354203219 0.267787216 0.236783770 0.213971445 0.197460719
## [19] 0.127368589 0.118080201 0.074695297 0.056775299 0.041017532 0.023099247
## [25] 0.018565507 0.005410330 0.003785511
sp <- sum(fa_eigen$values[1:7])
sp
## [1] 21.16778
L1 = sqrt(fa_eigen$values[1])*fa_eigen$vectors[,1]
L2 = sqrt(fa_eigen$values[2])*fa_eigen$vectors[,2]
L3 = sqrt(fa_eigen$values[3])*fa_eigen$vectors[,3]
L4 = sqrt(fa_eigen$values[4])*fa_eigen$vectors[,4]
L5 = sqrt(fa_eigen$values[5])*fa_eigen$vectors[,5]
L6 = sqrt(fa_eigen$values[6])*fa_eigen$vectors[,6]
L7 = sqrt(fa_eigen$values[7])*fa_eigen$vectors[,7]

L = cbind(L1,L2,L3,L4,L5,L6,L7)

L
##                 L1          L2            L3           L4            L5
##  [1,] -0.688195548  0.52846370 -0.0049291360  0.198251104 -5.457138e-02
##  [2,] -0.866423161 -0.45382013 -0.0026340642  0.123881457  4.008050e-03
##  [3,] -0.462911693 -0.83684257 -0.0008200313  0.001246451  3.480860e-02
##  [4,] -0.935805588  0.12460613 -0.0121605231  0.109676253  3.567558e-02
##  [5,] -0.921751200 -0.01413401  0.0040237951  0.110179137  8.145805e-02
##  [6,] -0.878498147  0.23104802  0.0150606208  0.143041043 -2.147641e-02
##  [7,]  0.084688471 -0.96596412  0.0245799371 -0.017114010 -3.737297e-03
##  [8,] -0.089625313  0.96613252 -0.0235528322  0.025377590  1.029807e-02
##  [9,] -0.030247572  0.73924455 -0.1409104905 -0.109968751  1.392580e-03
## [10,] -0.674129965 -0.50976286 -0.1385180254 -0.171380763  1.744637e-01
## [11,] -0.863370717  0.14560733 -0.0437601241  0.136444601  1.434911e-02
## [12,] -0.944672910  0.16491265 -0.0105681289  0.126094877  5.388223e-03
## [13,] -0.026073586 -0.20753662  0.0313034317 -0.155554059 -1.752006e-01
## [14,] -0.322263446 -0.90935746  0.0188558759  0.051620548  4.806938e-05
## [15,] -0.627390734 -0.72244086 -0.0183280799  0.064220487  3.939560e-02
## [16,] -0.874960509  0.15472469 -0.0142019196  0.091536597 -1.346121e-02
## [17,] -0.192156842 -0.08553131 -0.2860166315 -0.478849767 -4.470673e-01
## [18,]  0.424105520 -0.18117683  0.0721130447  0.071117162  3.410607e-01
## [19,] -0.422644365  0.01180695 -0.1326409057 -0.348657479 -4.782052e-01
## [20,] -0.280888638  0.13309084  0.7995307639 -0.369970981  1.734874e-01
## [21,] -0.382914688  0.12749030  0.7595412896 -0.398702698  1.512292e-01
## [22,] -0.057960998 -0.15308386  0.0523515749 -0.470080662 -2.012156e-01
## [23,] -0.480530052  0.43837069 -0.3520809005 -0.342807401  3.073764e-01
## [24,]  0.075225168  0.08179817  0.4992414982  0.568319323 -5.109037e-01
## [25,]  0.049321239 -0.19847370 -0.1378436076 -0.060874623  2.204388e-01
## [26,] -0.609840925  0.39621200 -0.0165170549 -0.116275003 -8.596003e-02
## [27,]  0.003577503  0.15735008 -0.0812641734  0.053230384  4.317375e-01
##                 L6            L7
##  [1,] -0.141536556  0.0214249789
##  [2,] -0.057790550  0.0065254969
##  [3,]  0.012701973 -0.0151183303
##  [4,] -0.006339024  0.0003089088
##  [5,]  0.110390944 -0.0395482101
##  [6,] -0.069668333  0.0308442443
##  [7,] -0.001026549 -0.0160786923
##  [8,]  0.006589191  0.0233023886
##  [9,] -0.186494100  0.0777154995
## [10,]  0.126521286 -0.0102588393
## [11,]  0.033509044  0.0153354557
## [12,] -0.062997899  0.0304819645
## [13,]  0.245712671  0.7568736325
## [14,] -0.030692673 -0.0075417388
## [15,] -0.009784611 -0.0021924343
## [16,] -0.104934026  0.0188135267
## [17,]  0.215039018 -0.0589193075
## [18,] -0.011345685  0.2169075143
## [19,]  0.036861014 -0.1045419589
## [20,]  0.039422641  0.0172558204
## [21,] -0.037975461  0.0170864555
## [22,] -0.275735343 -0.3775972063
## [23,]  0.010499252  0.1162876063
## [24,]  0.040883343 -0.1185853469
## [25,] -0.674663675  0.0003959960
## [26,]  0.136359956  0.0229938411
## [27,]  0.558114125 -0.4327271345

7.2 With Function Principal for Rotate

fa_norotate <- principal(scale_data, nfactors = 7, rotate = "none")
fa_norotate
## Principal Components Analysis
## Call: principal(r = scale_data, nfactors = 7, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                PC1   PC2   PC3   PC4   PC5   PC6   PC7   h2    u2 com
## Height        0.69 -0.53  0.00 -0.20 -0.05  0.14  0.02 0.82 0.184 2.2
## Weight        0.87  0.45  0.00 -0.12  0.00  0.06  0.01 0.98 0.025 1.6
## BMI           0.46  0.84  0.00  0.00  0.03 -0.01 -0.02 0.92 0.084 1.6
## TBW           0.94 -0.12 -0.01 -0.11  0.04  0.01  0.00 0.90 0.095 1.1
## ECW           0.92  0.01  0.00 -0.11  0.08 -0.11 -0.04 0.88 0.118 1.1
## ICW           0.88 -0.23  0.02 -0.14 -0.02  0.07  0.03 0.85 0.148 1.2
## TBFR         -0.08  0.97  0.02  0.02  0.00  0.00 -0.02 0.94 0.059 1.0
## LeanMass      0.09 -0.97 -0.02 -0.03  0.01 -0.01  0.02 0.94 0.057 1.0
## Protein       0.03 -0.74 -0.14  0.11  0.00  0.19  0.08 0.62 0.380 1.3
## VFR           0.67  0.51 -0.14  0.17  0.17 -0.13 -0.01 0.81 0.191 2.4
## BoneMass      0.86 -0.15 -0.04 -0.14  0.01 -0.03  0.02 0.79 0.211 1.1
## MuscleMass    0.94 -0.16 -0.01 -0.13  0.01  0.06  0.03 0.94 0.059 1.1
## Obesity       0.03  0.21  0.03  0.16 -0.18 -0.25  0.76 0.73 0.267 1.6
## TFC           0.32  0.91  0.02 -0.05  0.00  0.03 -0.01 0.93 0.065 1.3
## VFA           0.63  0.72 -0.02 -0.06  0.04  0.01  0.00 0.92 0.078 2.0
## VMA           0.87 -0.15 -0.01 -0.09 -0.01  0.10  0.02 0.81 0.190 1.1
## Glucose       0.19  0.09 -0.29  0.48 -0.45 -0.22 -0.06 0.60 0.395 3.6
## HDL          -0.42  0.18  0.07 -0.07  0.34  0.01  0.22 0.39 0.614 3.0
## Triglyceride  0.42 -0.01 -0.13  0.35 -0.48 -0.04 -0.10 0.56 0.441 3.1
## AST           0.28 -0.13  0.80  0.37  0.17 -0.04  0.02 0.90 0.095 1.9
## ALT           0.38 -0.13  0.76  0.40  0.15  0.04  0.02 0.92 0.077 2.2
## ALP           0.06  0.15  0.05  0.47 -0.20  0.28 -0.38 0.51 0.490 3.4
## Creatinine    0.48 -0.44 -0.35  0.34  0.31 -0.01  0.12 0.77 0.227 4.6
## GFR          -0.08 -0.08  0.50 -0.57 -0.51 -0.04 -0.12 0.86 0.139 3.2
## CRP          -0.05  0.20 -0.14  0.06  0.22  0.67  0.00 0.57 0.432 1.5
## HGB           0.61 -0.40 -0.02  0.12 -0.09 -0.14  0.02 0.57 0.431 2.0
## VitaminD      0.00 -0.16 -0.08 -0.05  0.43 -0.56 -0.43 0.72 0.281 3.1
## 
##                        PC1  PC2  PC3  PC4  PC5  PC6  PC7
## SS loadings           8.54 5.91 1.77 1.55 1.31 1.08 1.00
## Proportion Var        0.32 0.22 0.07 0.06 0.05 0.04 0.04
## Cumulative Var        0.32 0.54 0.60 0.66 0.71 0.75 0.78
## Proportion Explained  0.40 0.28 0.08 0.07 0.06 0.05 0.05
## Cumulative Proportion 0.40 0.68 0.77 0.84 0.90 0.95 1.00
## 
## Mean item complexity =  2
## Test of the hypothesis that 7 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.03 
##  with the empirical chi square  226.72  with prob <  0.015 
## 
## Fit based upon off diagonal values = 0.99
fa_norotate$loadings
## 
## Loadings:
##              PC1    PC2    PC3    PC4    PC5    PC6    PC7   
## Height        0.688 -0.528        -0.198         0.142       
## Weight        0.866  0.454        -0.124                     
## BMI           0.463  0.837                                   
## TBW           0.936 -0.125        -0.110                     
## ECW           0.922               -0.110        -0.110       
## ICW           0.878 -0.231        -0.143                     
## TBFR                 0.966                                   
## LeanMass            -0.966                                   
## Protein             -0.739 -0.141  0.110         0.186       
## VFR           0.674  0.510 -0.139  0.171  0.174 -0.127       
## BoneMass      0.863 -0.146        -0.136                     
## MuscleMass    0.945 -0.165        -0.126                     
## Obesity              0.208         0.156 -0.175 -0.246  0.757
## TFC           0.322  0.909                                   
## VFA           0.627  0.722                                   
## VMA           0.875 -0.155                       0.105       
## Glucose       0.192        -0.286  0.479 -0.447 -0.215       
## HDL          -0.424  0.181                0.341         0.217
## Triglyceride  0.423        -0.133  0.349 -0.478        -0.105
## AST           0.281 -0.133  0.800  0.370  0.173              
## ALT           0.383 -0.127  0.760  0.399  0.151              
## ALP                  0.153         0.470 -0.201  0.276 -0.378
## Creatinine    0.481 -0.438 -0.352  0.343  0.307         0.116
## GFR                         0.499 -0.568 -0.511        -0.119
## CRP                  0.198 -0.138         0.220  0.675       
## HGB           0.610 -0.396         0.116        -0.136       
## VitaminD            -0.157                0.432 -0.558 -0.433
## 
##                  PC1   PC2   PC3   PC4   PC5   PC6   PC7
## SS loadings    8.543 5.909 1.767 1.549 1.312 1.083 1.005
## Proportion Var 0.316 0.219 0.065 0.057 0.049 0.040 0.037
## Cumulative Var 0.316 0.535 0.601 0.658 0.707 0.747 0.784
fa.diagram(fa_norotate$loadings, 
           cut = 0.40,     
           digits = 2, 
           sort = TRUE,
           cex = 0.7)   

fa_varimax <- principal(scale_data,nfactors = 7 ,rotate = "varimax")
fa_varimax
## Principal Components Analysis
## Call: principal(r = scale_data, nfactors = 7, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                RC1   RC2   RC3   RC5   RC4   RC6   RC7   h2    u2 com
## Height        0.82 -0.36  0.04  0.02 -0.06  0.06 -0.05 0.82 0.184 1.4
## Weight        0.75  0.63  0.05  0.08  0.02  0.08  0.01 0.98 0.025 2.0
## BMI           0.25  0.92  0.02  0.08  0.06  0.06  0.04 0.92 0.084 1.2
## TBW           0.93  0.10  0.10  0.08  0.06 -0.04 -0.01 0.90 0.095 1.1
## ECW           0.88  0.24  0.11  0.06  0.07 -0.15 -0.01 0.88 0.118 1.3
## ICW           0.91 -0.03  0.10  0.07  0.00  0.03  0.00 0.85 0.148 1.0
## TBFR         -0.30  0.91 -0.05  0.01 -0.02  0.10  0.04 0.94 0.059 1.3
## LeanMass      0.31 -0.91  0.05 -0.02  0.02 -0.11 -0.03 0.94 0.057 1.3
## Protein       0.19 -0.74 -0.01  0.05  0.16  0.12 -0.03 0.62 0.380 1.3
## VFR           0.48  0.65  0.07  0.16  0.34 -0.09  0.04 0.81 0.191 2.6
## BoneMass      0.88  0.06  0.05  0.07  0.04 -0.07  0.02 0.79 0.211 1.0
## MuscleMass    0.96  0.05  0.09  0.08  0.04  0.02  0.00 0.94 0.059 1.0
## Obesity      -0.05  0.15  0.05  0.05  0.06  0.07  0.83 0.73 0.267 1.1
## TFC           0.11  0.95 -0.02  0.03 -0.01  0.12  0.03 0.93 0.065 1.1
## VFA           0.45  0.84  0.01  0.06  0.06  0.06  0.03 0.92 0.078 1.6
## VMA           0.88  0.04  0.09  0.10  0.04  0.07 -0.02 0.81 0.190 1.1
## Glucose       0.04  0.08 -0.08  0.73  0.14 -0.09  0.15 0.60 0.395 1.3
## HDL          -0.41  0.09  0.01 -0.43  0.12  0.03  0.12 0.39 0.614 2.4
## Triglyceride  0.31  0.04  0.03  0.68  0.00  0.04  0.05 0.56 0.441 1.4
## AST           0.15 -0.03  0.94 -0.02 -0.04 -0.06  0.03 0.90 0.095 1.1
## ALT           0.25 -0.01  0.93  0.03  0.00  0.02  0.01 0.92 0.077 1.1
## ALP          -0.10  0.14  0.23  0.49  0.09  0.23 -0.36 0.51 0.490 3.3
## Creatinine    0.49 -0.33  0.03  0.12  0.63 -0.06  0.04 0.77 0.227 2.6
## GFR           0.05 -0.07  0.05 -0.07 -0.92 -0.03 -0.02 0.86 0.139 1.0
## CRP          -0.06  0.14 -0.06 -0.17  0.26  0.61 -0.27 0.57 0.432 2.2
## HGB           0.62 -0.25  0.15  0.25  0.09 -0.15  0.08 0.57 0.431 2.0
## VitaminD      0.01 -0.06 -0.01 -0.15  0.20 -0.75 -0.30 0.72 0.281 1.6
## 
##                        RC1  RC2  RC3  RC5  RC4  RC6  RC7
## SS loadings           7.92 5.96 1.89 1.63 1.58 1.14 1.05
## Proportion Var        0.29 0.22 0.07 0.06 0.06 0.04 0.04
## Cumulative Var        0.29 0.51 0.58 0.64 0.70 0.75 0.78
## Proportion Explained  0.37 0.28 0.09 0.08 0.07 0.05 0.05
## Cumulative Proportion 0.37 0.66 0.74 0.82 0.90 0.95 1.00
## 
## Mean item complexity =  1.5
## Test of the hypothesis that 7 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.03 
##  with the empirical chi square  226.72  with prob <  0.015 
## 
## Fit based upon off diagonal values = 0.99
fa.diagram(fa_varimax$loadings, 
           cut = 0.40,     
           digits = 2, 
           sort = TRUE,
           cex = 0.7)