Load Data dan Library

library(psych)
library(GPArotation)
## 
## Attaching package: 'GPArotation'
## The following objects are masked from 'package:psych':
## 
##     equamax, varimin
library(corrplot)
## corrplot 0.95 loaded
library(factoextra)
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
## Welcome to factoextra!
## Want to learn more? See two factoextra-related books at https://www.datanovia.com/en/product/practical-guide-to-principal-component-methods-in-r/
data <- read.csv("gaming_mental_health_10M_40features.csv")

set.seed(123)
data_sample <- data[sample(nrow(data), 2000), ]

data_numeric <- data_sample[, sapply(data_sample, is.numeric)]
cat("Dimensi:", dim(data_numeric), "\n")
## Dimensi: 2000 38

Imputasi Median

for(i in 1:ncol(data_numeric)){
  data_numeric[is.na(data_numeric[,i]), i] <- 
    median(data_numeric[,i], na.rm=TRUE)
}

cat("Total NA setelah imputasi:", sum(is.na(data_numeric)))
## Total NA setelah imputasi: 0

Statistik Deskriptif

desc <- describe(data_numeric)
round(desc[,c("mean","sd","skew","kurtosis")],2)
##                                mean       sd  skew kurtosis
## age                           36.10    13.52  0.00    -1.17
## income                     77325.38 41241.25  0.02    -1.17
## daily_gaming_hours             4.04     2.92  1.39     2.69
## weekly_sessions               20.72    11.39 -0.09    -1.22
## years_gaming                  11.87     7.22  0.02    -1.20
## sleep_hours                    6.98     1.49  0.06    -0.09
## caffeine_intake                1.91     1.93  1.95     5.37
## exercise_hours                 2.04     2.10  2.07     6.02
## stress_level                   5.68     2.84 -0.06    -1.21
## anxiety_score                  5.05     1.99 -0.03    -0.25
## depression_score               4.96     2.32 -0.02    -0.47
## social_interaction_score       5.99     1.96 -0.18    -0.23
## relationship_satisfaction      5.92     1.93 -0.08    -0.32
## academic_performance          69.92    14.57 -0.05    -0.28
## work_productivity             69.74    14.78 -0.13    -0.26
## addiction_level                2.83     2.16  0.95     0.65
## multiplayer_ratio              0.50     0.23 -0.01    -0.88
## toxic_exposure                 0.28     0.16  0.57    -0.19
## violent_games_ratio            0.40     0.20  0.24    -0.69
## mobile_gaming_ratio            0.50     0.23 -0.04    -0.89
## night_gaming_ratio             0.50     0.22  0.00    -0.85
## weekend_gaming_hours           5.98     4.37  1.33     2.02
## friends_gaming_count          24.66    14.40  0.00    -1.19
## online_friends               249.68   142.09 -0.01    -1.16
## streaming_hours                1.95     1.38  1.24     1.88
## esports_interest               5.04     3.11 -0.02    -1.18
## headset_usage                  0.52     0.50 -0.07    -2.00
## microtransactions_spending   492.09   499.94  2.01     5.55
## parental_supervision           5.03     3.14 -0.01    -1.20
## loneliness_score               4.97     2.00 -0.01    -0.21
## aggression_score               5.02     2.04 -0.01    -0.33
## happiness_score                5.97     1.93 -0.17    -0.14
## bmi                           24.02     4.00  0.04    -0.03
## screen_time_total              8.09     4.03  0.92     1.14
## eye_strain_score               4.99     1.89  0.00    -0.23
## back_pain_score                4.07     1.95  0.12    -0.20
## competitive_rank              49.10    28.85  0.02    -1.21
## internet_quality               5.61     2.88 -0.05    -1.24
data_scaled <- scale(data_numeric)

boxplot(data_scaled, 
        main="Boxplot Seluruh Variabel", 
        col="lightblue", 
        las=2,          
        cex.axis=0.7) 

hist(data_numeric$screen_time_total, 
     main="Distribusi Total Screen Time", 
     xlab="Jam per Hari", 
     col="steelblue", 
     border="white")

Uji Asumsi dan Kelayakan

cor_matrix <- cor(data_numeric)

# KMO
KMO(cor_matrix)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = cor_matrix)
## Overall MSA =  0.64
## MSA for each item = 
##                        age                     income 
##                       0.56                       0.51 
##         daily_gaming_hours            weekly_sessions 
##                       0.62                       0.50 
##               years_gaming                sleep_hours 
##                       0.53                       0.51 
##            caffeine_intake             exercise_hours 
##                       0.57                       0.48 
##               stress_level              anxiety_score 
##                       0.50                       0.48 
##           depression_score   social_interaction_score 
##                       0.49                       0.45 
##  relationship_satisfaction       academic_performance 
##                       0.53                       0.55 
##          work_productivity            addiction_level 
##                       0.51                       0.65 
##          multiplayer_ratio             toxic_exposure 
##                       0.47                       0.49 
##        violent_games_ratio        mobile_gaming_ratio 
##                       0.53                       0.44 
##         night_gaming_ratio       weekend_gaming_hours 
##                       0.54                       0.51 
##       friends_gaming_count             online_friends 
##                       0.49                       0.47 
##            streaming_hours           esports_interest 
##                       0.49                       0.51 
##              headset_usage microtransactions_spending 
##                       0.42                       0.51 
##       parental_supervision           loneliness_score 
##                       0.47                       0.48 
##           aggression_score            happiness_score 
##                       0.48                       0.51 
##                        bmi          screen_time_total 
##                       0.51                       0.86 
##           eye_strain_score            back_pain_score 
##                       0.47                       0.50 
##           competitive_rank           internet_quality 
##                       0.52                       0.53
# Bartlett
cortest.bartlett(cor_matrix, n=nrow(data_numeric))
## $chisq
## [1] 5274.833
## 
## $p.value
## [1] 0
## 
## $df
## [1] 703

Penentuan Jumlah Komponen(Ekstraksi)

# PCA
pca_model <- prcomp(data_numeric, scale. = TRUE)

# Eigenvalue
library(factoextra)
eigen_values <- get_eigenvalue(pca_model)
print(eigen_values)
##        eigenvalue variance.percent cumulative.variance.percent
## Dim.1  2.52686825         6.649653                    6.649653
## Dim.2  1.27453912         3.354050                   10.003704
## Dim.3  1.22685159         3.228557                   13.232260
## Dim.4  1.21895233         3.207769                   16.440030
## Dim.5  1.18603034         3.121132                   19.561162
## Dim.6  1.17623113         3.095345                   22.656507
## Dim.7  1.15827382         3.048089                   25.704596
## Dim.8  1.15277197         3.033610                   28.738207
## Dim.9  1.13425632         2.984885                   31.723092
## Dim.10 1.09703436         2.886933                   34.610024
## Dim.11 1.08799360         2.863141                   37.473165
## Dim.12 1.08045684         2.843307                   40.316473
## Dim.13 1.06855937         2.811998                   43.128471
## Dim.14 1.05014981         2.763552                   45.892023
## Dim.15 1.04176790         2.741494                   48.633518
## Dim.16 1.01485620         2.670674                   51.304192
## Dim.17 0.99826265         2.627007                   53.931199
## Dim.18 0.99592920         2.620866                   56.552065
## Dim.19 0.98500618         2.592122                   59.144187
## Dim.20 0.97646501         2.569645                   61.713832
## Dim.21 0.97434404         2.564063                   64.277895
## Dim.22 0.95601492         2.515829                   66.793724
## Dim.23 0.94428228         2.484953                   69.278677
## Dim.24 0.93417905         2.458366                   71.737043
## Dim.25 0.92486962         2.433867                   74.170910
## Dim.26 0.91836586         2.416752                   76.587663
## Dim.27 0.90993116         2.394556                   78.982218
## Dim.28 0.88190918         2.320814                   81.303032
## Dim.29 0.87277091         2.296766                   83.599797
## Dim.30 0.86318801         2.271547                   85.871345
## Dim.31 0.85334205         2.245637                   88.116982
## Dim.32 0.85150257         2.240796                   90.357778
## Dim.33 0.82953602         2.182990                   92.540768
## Dim.34 0.80878004         2.128369                   94.669136
## Dim.35 0.78948445         2.077591                   96.746727
## Dim.36 0.74602978         1.963236                   98.709963
## Dim.37 0.39059025         1.027869                   99.737832
## Dim.38 0.09962383         0.262168                  100.000000
# jumlah komponen (metode Kaiser)
jumlah_pc <- sum(eigen_values$eigenvalue > 1)
jumlah_pc
## [1] 16

Analisis Komponen Utama (Unrotated PCA)

# Scree Plot
fviz_screeplot(pca_model,
               addlabels = TRUE,
               main = "Scree Plot PCA") +
  theme_minimal()

# Biplot PCA
fviz_pca_biplot(pca_model,
                col.var = "steelblue",
                col.ind = "gray70",
                label = "var",
                repel = TRUE,
                title = "Biplot PCA") +
  theme_minimal()

# Kontribusi variabel PC1
fviz_contrib(pca_model,
             choice = "var",
             axes = 1,
             title = "Kontribusi Variabel ke PC1")

# Kontribusi variabel PC2
fviz_contrib(pca_model,
             choice = "var",
             axes = 2,
             title = "Kontribusi Variabel ke PC2")

pca_unrot <- principal(data_numeric,
                       nfactors = jumlah_pc,
                       rotate = "none",
                       scores = TRUE)

print(pca_unrot$loadings)
## 
## Loadings:
##                            PC1    PC2    PC3    PC4    PC5    PC6    PC7   
## age                                             -0.257 -0.131  0.332 -0.153
## income                            -0.124  0.140  0.267  0.147 -0.181 -0.296
## daily_gaming_hours          0.951                                          
## weekly_sessions                    0.317        -0.269                     
## years_gaming                       0.187  0.183  0.189        -0.205  0.250
## sleep_hours                       -0.278                       0.162  0.223
## caffeine_intake                    0.216 -0.201 -0.279        -0.191  0.100
## exercise_hours                            0.148  0.393 -0.366         0.133
## stress_level                       0.108 -0.344  0.166  0.123  0.110  0.178
## anxiety_score                            -0.210  0.110  0.136 -0.394 -0.117
## depression_score                          0.148  0.316                0.418
## social_interaction_score          -0.153 -0.106         0.254              
## relationship_satisfaction          0.149 -0.416  0.321                0.170
## academic_performance              -0.112  0.277 -0.157                     
## work_productivity                 -0.398                              0.115
## addiction_level             0.931                                          
## multiplayer_ratio                        -0.172        -0.300         0.101
## toxic_exposure                    -0.159 -0.181        -0.295         0.131
## violent_games_ratio                              0.234  0.105        -0.286
## mobile_gaming_ratio                0.135 -0.166         0.375  0.156       
## night_gaming_ratio                                             0.193  0.115
## weekend_gaming_hours              -0.139 -0.106 -0.107        -0.360       
## friends_gaming_count                      0.297  0.126               -0.205
## online_friends                            0.117  0.256         0.338 -0.368
## streaming_hours                           0.116        -0.311  0.172 -0.192
## esports_interest                          0.330  0.117         0.102       
## headset_usage                     -0.184        -0.184  0.153              
## microtransactions_spending               -0.278 -0.136 -0.129  0.306 -0.176
## parental_supervision               0.223  0.151         0.378 -0.198       
## loneliness_score                   0.291               -0.144 -0.231       
## aggression_score                  -0.242        -0.177  0.117  0.125  0.307
## happiness_score                    0.222         0.121 -0.146              
## bmi                                0.310  0.342 -0.301  0.230         0.109
## screen_time_total           0.844                                          
## eye_strain_score                   0.380               -0.277        -0.189
## back_pain_score                    0.253  0.262        -0.202         0.231
## competitive_rank                   0.179         0.315  0.180  0.282       
## internet_quality                   0.273                       0.283  0.202
##                            PC8    PC9    PC10   PC11   PC12   PC13   PC14  
## age                        -0.134         0.135  0.269  0.225 -0.154  0.157
## income                      0.173  0.211        -0.260               -0.119
## daily_gaming_hours                                                         
## weekly_sessions             0.227 -0.143        -0.150  0.181        -0.302
## years_gaming               -0.160         0.213               -0.111       
## sleep_hours                -0.167  0.208  0.312        -0.227              
## caffeine_intake                    0.212                0.154  0.200 -0.116
## exercise_hours              0.117 -0.203                0.221              
## stress_level                       0.424               -0.220              
## anxiety_score                     -0.107 -0.294  0.198        -0.266  0.249
## depression_score                         -0.344                0.107 -0.323
## social_interaction_score          -0.101        -0.330         0.281       
## relationship_satisfaction   0.215 -0.118         0.135  0.128              
## academic_performance        0.352  0.304                0.132              
## work_productivity           0.147 -0.301  0.279               -0.187 -0.192
## addiction_level                                                            
## multiplayer_ratio          -0.118               -0.239 -0.278 -0.269       
## toxic_exposure              0.254  0.163        -0.280  0.111         0.201
## violent_games_ratio        -0.262  0.116 -0.191         0.282        -0.144
## mobile_gaming_ratio         0.276                0.110 -0.198 -0.287 -0.198
## night_gaming_ratio                 0.398 -0.240  0.146  0.328 -0.239 -0.128
## weekend_gaming_hours                      0.161         0.348  0.170  0.178
## friends_gaming_count                      0.306                0.165 -0.137
## online_friends                                   0.124        -0.113  0.281
## streaming_hours             0.182        -0.359 -0.157 -0.142  0.190 -0.155
## esports_interest            0.116  0.371                              0.256
## headset_usage               0.149 -0.170 -0.153  0.428 -0.235  0.246       
## microtransactions_spending                      -0.242  0.165  0.213       
## parental_supervision                      0.164 -0.359  0.113         0.224
## loneliness_score                   0.278  0.184  0.287 -0.188  0.288 -0.143
## aggression_score            0.277                0.156  0.297         0.168
## happiness_score             0.465               -0.144 -0.129         0.327
## bmi                               -0.106 -0.109        -0.116 -0.197  0.141
## screen_time_total                                                          
## eye_strain_score            0.116 -0.122  0.284               -0.221 -0.179
## back_pain_score            -0.144        -0.105        -0.111  0.299  0.256
## competitive_rank            0.112 -0.155  0.248         0.176  0.280       
## internet_quality           -0.344                                          
##                            PC15   PC16  
## age                        -0.200  0.147
## income                     -0.148  0.104
## daily_gaming_hours                      
## weekly_sessions             0.116  0.117
## years_gaming               -0.179       
## sleep_hours                 0.137 -0.123
## caffeine_intake                   -0.115
## exercise_hours                     0.158
## stress_level               -0.121       
## anxiety_score                           
## depression_score           -0.141       
## social_interaction_score    0.323 -0.208
## relationship_satisfaction   0.119       
## academic_performance        0.336 -0.105
## work_productivity           0.108  0.188
## addiction_level                         
## multiplayer_ratio           0.100  0.292
## toxic_exposure             -0.260 -0.234
## violent_games_ratio         0.161  0.154
## mobile_gaming_ratio        -0.116       
## night_gaming_ratio                      
## weekend_gaming_hours                    
## friends_gaming_count       -0.467       
## online_friends                    -0.197
## streaming_hours                         
## esports_interest            0.287  0.166
## headset_usage                      0.151
## microtransactions_spending -0.163  0.235
## parental_supervision               0.396
## loneliness_score                   0.314
## aggression_score                   0.179
## happiness_score                         
## bmi                        -0.148 -0.238
## screen_time_total                       
## eye_strain_score            0.268 -0.315
## back_pain_score             0.127       
## competitive_rank                  -0.136
## internet_quality            0.176  0.112
## 
##                  PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10
## SS loadings    2.527 1.275 1.227 1.219 1.186 1.176 1.158 1.153 1.134 1.097
## Proportion Var 0.066 0.034 0.032 0.032 0.031 0.031 0.030 0.030 0.030 0.029
## Cumulative Var 0.066 0.100 0.132 0.164 0.196 0.227 0.257 0.287 0.317 0.346
##                 PC11  PC12  PC13  PC14  PC15  PC16
## SS loadings    1.088 1.080 1.069 1.050 1.042 1.015
## Proportion Var 0.029 0.028 0.028 0.028 0.027 0.027
## Cumulative Var 0.375 0.403 0.431 0.459 0.486 0.513
skor_pca <- as.data.frame(pca_unrot$scores)
head(skor_pca)
##               PC1          PC2         PC3         PC4         PC5         PC6
## 969167 -0.1735429 -0.576083399 -0.04677546  0.02473745  0.09277985  0.05438539
## 188942 -0.4133187  0.053124779 -1.15991931  1.56052373  1.51386590 -0.98009723
## 134058 -0.2996580  0.009501433 -0.35689080  0.77478626 -0.82011129 -0.15984599
## 124022 -0.9657914 -0.916095386 -0.49528105 -1.39734989 -0.40457242 -0.77957198
## 685285 -0.4991855  0.538801217 -0.73634182 -1.84262468  0.20525690  0.27864787
## 226318  0.3942790 -1.532115504 -0.43218915 -2.19227239  1.55296288  1.23378472
##               PC7        PC8        PC9       PC10         PC11        PC12
## 969167 -1.0520466 -0.1893227  0.3381657  0.3956740  0.006055845 -0.01362691
## 188942 -0.1703374  1.1739741  0.9451856 -0.0962916  0.236573087  1.13003738
## 134058  0.7354931 -0.3049681  1.9540400 -0.4833779  1.221293151 -0.78623073
## 124022 -0.6314017 -0.6375343 -0.6775547  0.2333630 -0.745148771  0.44404384
## 685285  0.3444215 -0.9179188  0.7203258  0.1557850 -0.710958455  2.92871096
## 226318  0.4996327 -0.4328555 -1.9267028  1.0800242 -1.526400088 -0.59772689
##              PC13       PC14        PC15       PC16
## 969167  1.3634246 -0.6153250  1.42665282 -0.4290958
## 188942  0.7690762 -1.3399541 -2.39919424  0.2032196
## 134058  0.7233293 -2.0932042  1.54650704 -0.5728923
## 124022  0.0734412 -0.6647065  0.01655439 -1.4685173
## 685285  1.4803849  1.7196718 -2.89119642  1.7242594
## 226318 -0.9495389 -0.7950670  1.20710533  0.1506474

Rotasi Komponen (PCA with Varimax)

pca <- principal(data_numeric,
                 nfactors = 5,
                 rotate = "varimax",
                 scores = TRUE)

print(pca$loadings)
## 
## Loadings:
##                            RC1    RC2    RC5    RC3    RC4   
## age                                             -0.166 -0.245
## income                                                  0.349
## daily_gaming_hours          0.950                            
## weekly_sessions                    0.116  0.309 -0.126 -0.238
## years_gaming                       0.274                0.174
## sleep_hours                       -0.159 -0.251              
## caffeine_intake                           0.147        -0.369
## exercise_hours                     0.400 -0.260         0.286
## stress_level                                     0.411       
## anxiety_score                                    0.267       
## depression_score                                        0.344
## social_interaction_score          -0.290         0.110       
## relationship_satisfaction                        0.543       
## academic_performance              -0.104        -0.319       
## work_productivity                 -0.223 -0.297         0.129
## addiction_level             0.928                            
## multiplayer_ratio                  0.121 -0.255        -0.217
## toxic_exposure                           -0.347        -0.151
## violent_games_ratio                              0.217  0.169
## mobile_gaming_ratio               -0.186  0.303  0.242       
## night_gaming_ratio                                           
## weekend_gaming_hours              -0.130 -0.117        -0.113
## friends_gaming_count                            -0.170  0.251
## online_friends                                          0.275
## streaming_hours                    0.253 -0.152 -0.156       
## esports_interest                                -0.211  0.269
## headset_usage                     -0.287                     
## microtransactions_spending                       0.139 -0.304
## parental_supervision                      0.433         0.160
## loneliness_score                   0.262  0.105        -0.182
## aggression_score                  -0.277        -0.188       
## happiness_score                    0.271         0.132       
## bmi                                       0.506 -0.308       
## screen_time_total           0.844                            
## eye_strain_score                   0.427               -0.194
## back_pain_score                    0.355        -0.191       
## competitive_rank                          0.176  0.266  0.231
## internet_quality                   0.108  0.222  0.153       
## 
##                  RC1   RC2   RC5   RC3   RC4
## SS loadings    2.516 1.234 1.231 1.229 1.223
## Proportion Var 0.066 0.032 0.032 0.032 0.032
## Cumulative Var 0.066 0.099 0.131 0.163 0.196
ev <- eigen(cor_matrix)$values
jumlah_pc <- sum(ev > 1)
jumlah_pc
## [1] 16
data.frame(
  Variabel = colnames(data_numeric),
  h2 = round(pca$communality,3)
)
##                                              Variabel    h2
## age                                               age 0.093
## income                                         income 0.129
## daily_gaming_hours                 daily_gaming_hours 0.906
## weekly_sessions                       weekly_sessions 0.182
## years_gaming                             years_gaming 0.112
## sleep_hours                               sleep_hours 0.090
## caffeine_intake                       caffeine_intake 0.171
## exercise_hours                         exercise_hours 0.311
## stress_level                             stress_level 0.173
## anxiety_score                           anxiety_score 0.077
## depression_score                     depression_score 0.128
## social_interaction_score     social_interaction_score 0.100
## relationship_satisfaction   relationship_satisfaction 0.304
## academic_performance             academic_performance 0.120
## work_productivity                   work_productivity 0.163
## addiction_level                       addiction_level 0.867
## multiplayer_ratio                   multiplayer_ratio 0.127
## toxic_exposure                         toxic_exposure 0.146
## violent_games_ratio               violent_games_ratio 0.079
## mobile_gaming_ratio               mobile_gaming_ratio 0.188
## night_gaming_ratio                 night_gaming_ratio 0.009
## weekend_gaming_hours             weekend_gaming_hours 0.044
## friends_gaming_count             friends_gaming_count 0.106
## online_friends                         online_friends 0.086
## streaming_hours                       streaming_hours 0.112
## esports_interest                     esports_interest 0.124
## headset_usage                           headset_usage 0.094
## microtransactions_spending microtransactions_spending 0.123
## parental_supervision             parental_supervision 0.218
## loneliness_score                     loneliness_score 0.113
## aggression_score                     aggression_score 0.114
## happiness_score                       happiness_score 0.093
## bmi                                               bmi 0.358
## screen_time_total                   screen_time_total 0.714
## eye_strain_score                     eye_strain_score 0.227
## back_pain_score                       back_pain_score 0.176
## competitive_rank                     competitive_rank 0.166
## internet_quality                     internet_quality 0.092
head(pca$scores)
##               RC1        RC2        RC5         RC3        RC4
## 969167 -0.1640023 -0.4580843 -0.3330218 -0.05405484  0.1511083
## 188942 -0.5208790 -0.6849911  0.4877612  2.07064978  0.9899810
## 134058 -0.3989368  0.7013576 -0.7661614  0.45624093  0.2095716
## 124022 -0.8695872 -0.9109335 -0.7287508 -0.64599154 -1.2645901
## 685285 -0.3807554 -0.4767106  0.6543285 -0.20345766 -1.9176339
## 226318  0.6254229 -2.7609626  0.2868990 -0.65401361 -1.1761208

Analisis Faktor (Exploratory Factor Analysis - EFA)

data.frame(
  Variabel = colnames(data_numeric),
  h2 = round(pca$communality,3)
)
##                                              Variabel    h2
## age                                               age 0.093
## income                                         income 0.129
## daily_gaming_hours                 daily_gaming_hours 0.906
## weekly_sessions                       weekly_sessions 0.182
## years_gaming                             years_gaming 0.112
## sleep_hours                               sleep_hours 0.090
## caffeine_intake                       caffeine_intake 0.171
## exercise_hours                         exercise_hours 0.311
## stress_level                             stress_level 0.173
## anxiety_score                           anxiety_score 0.077
## depression_score                     depression_score 0.128
## social_interaction_score     social_interaction_score 0.100
## relationship_satisfaction   relationship_satisfaction 0.304
## academic_performance             academic_performance 0.120
## work_productivity                   work_productivity 0.163
## addiction_level                       addiction_level 0.867
## multiplayer_ratio                   multiplayer_ratio 0.127
## toxic_exposure                         toxic_exposure 0.146
## violent_games_ratio               violent_games_ratio 0.079
## mobile_gaming_ratio               mobile_gaming_ratio 0.188
## night_gaming_ratio                 night_gaming_ratio 0.009
## weekend_gaming_hours             weekend_gaming_hours 0.044
## friends_gaming_count             friends_gaming_count 0.106
## online_friends                         online_friends 0.086
## streaming_hours                       streaming_hours 0.112
## esports_interest                     esports_interest 0.124
## headset_usage                           headset_usage 0.094
## microtransactions_spending microtransactions_spending 0.123
## parental_supervision             parental_supervision 0.218
## loneliness_score                     loneliness_score 0.113
## aggression_score                     aggression_score 0.114
## happiness_score                       happiness_score 0.093
## bmi                                               bmi 0.358
## screen_time_total                   screen_time_total 0.714
## eye_strain_score                     eye_strain_score 0.227
## back_pain_score                       back_pain_score 0.176
## competitive_rank                     competitive_rank 0.166
## internet_quality                     internet_quality 0.092
#``````
fa_result <- fa(data_numeric,
                nfactors = 5,
                rotate = "varimax",
                fm = "pa",
                scores = "regression")

print(fa_result$loadings, cutoff=0.4)
## 
## Loadings:
##                            PA1    PA3    PA5    PA4    PA2   
## age                                                          
## income                                                       
## daily_gaming_hours          0.983                            
## weekly_sessions                                              
## years_gaming                                                 
## sleep_hours                                                  
## caffeine_intake                                              
## exercise_hours                                               
## stress_level                                                 
## anxiety_score                                                
## depression_score                                             
## social_interaction_score                                     
## relationship_satisfaction                                    
## academic_performance                                         
## work_productivity                                            
## addiction_level             0.900                            
## multiplayer_ratio                                            
## toxic_exposure                                               
## violent_games_ratio                                          
## mobile_gaming_ratio                                          
## night_gaming_ratio                                           
## weekend_gaming_hours                                         
## friends_gaming_count                                         
## online_friends                                               
## streaming_hours                                              
## esports_interest                                             
## headset_usage                                                
## microtransactions_spending                                   
## parental_supervision                                         
## loneliness_score                                             
## aggression_score                                             
## happiness_score                                              
## bmi                                                          
## screen_time_total           0.711                            
## eye_strain_score                                             
## back_pain_score                                              
## competitive_rank                                             
## internet_quality                                             
## 
##                  PA1   PA3   PA5   PA4   PA2
## SS loadings    2.298 0.303 0.294 0.279 0.272
## Proportion Var 0.060 0.008 0.008 0.007 0.007
## Cumulative Var 0.060 0.068 0.076 0.084 0.091
#``````
data.frame(
  Variabel = colnames(data_numeric),
  h2 = round(fa_result$communality,3),
  Psi = round(fa_result$uniquenesses,3)
)
##                                              Variabel    h2   Psi
## age                                               age 0.014 0.986
## income                                         income 0.017 0.983
## daily_gaming_hours                 daily_gaming_hours 0.972 0.028
## weekly_sessions                       weekly_sessions 0.037 0.963
## years_gaming                             years_gaming 0.022 0.978
## sleep_hours                               sleep_hours 0.019 0.981
## caffeine_intake                       caffeine_intake 0.040 0.960
## exercise_hours                         exercise_hours 0.110 0.890
## stress_level                             stress_level 0.041 0.959
## anxiety_score                           anxiety_score 0.008 0.992
## depression_score                     depression_score 0.033 0.967
## social_interaction_score     social_interaction_score 0.015 0.985
## relationship_satisfaction   relationship_satisfaction 0.102 0.898
## academic_performance             academic_performance 0.018 0.982
## work_productivity                   work_productivity 0.036 0.964
## addiction_level                       addiction_level 0.825 0.175
## multiplayer_ratio                   multiplayer_ratio 0.017 0.983
## toxic_exposure                         toxic_exposure 0.018 0.982
## violent_games_ratio               violent_games_ratio 0.010 0.990
## mobile_gaming_ratio               mobile_gaming_ratio 0.045 0.955
## night_gaming_ratio                 night_gaming_ratio 0.002 0.998
## weekend_gaming_hours             weekend_gaming_hours 0.011 0.989
## friends_gaming_count             friends_gaming_count 0.018 0.982
## online_friends                         online_friends 0.012 0.988
## streaming_hours                       streaming_hours 0.012 0.988
## esports_interest                     esports_interest 0.021 0.979
## headset_usage                           headset_usage 0.015 0.985
## microtransactions_spending microtransactions_spending 0.020 0.980
## parental_supervision             parental_supervision 0.032 0.968
## loneliness_score                     loneliness_score 0.028 0.972
## aggression_score                     aggression_score 0.018 0.982
## happiness_score                       happiness_score 0.021 0.979
## bmi                                               bmi 0.146 0.854
## screen_time_total                   screen_time_total 0.510 0.490
## eye_strain_score                     eye_strain_score 0.078 0.922
## back_pain_score                       back_pain_score 0.036 0.964
## competitive_rank                     competitive_rank 0.048 0.952
## internet_quality                     internet_quality 0.019 0.981
#``````
head(fa_result$scores)
##               PA1         PA3         PA5        PA4         PA2
## 969167 -0.1144214 -0.02389559 -0.37509588 -0.2274070  0.02321295
## 188942 -0.7114270  0.89072753  0.09561537 -0.2752606  0.37192903
## 134058 -0.3714190  0.30249829 -0.36190539  0.1786933  0.01140296
## 124022 -0.8133638 -0.52568973 -0.38336001 -0.2682179 -0.60551235
## 685285 -0.9698832 -0.11192388  0.24926422 -0.3734783 -0.93085663
## 226318  0.2253806 -0.37846757  0.20994099 -1.3028050 -0.40851999