====================================

“Analisis Pengaruh Penggunaan Media Sosial terhadap Dampak Psikologis Gen Z Menggunakan PLS-SEM”

====================================

1. LOAD LIBRARY

library(plspm)
## Warning: package 'plspm' was built under R version 4.5.3
library(readr)
## Warning: package 'readr' was built under R version 4.5.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(psych)
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:plspm':
## 
##     alpha, rescale, unidim

2. IMPORT DATASET

data <- read_csv("social_media_addiction.csv")
## Rows: 20 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (4): Gender, Platform, Addiction_Level, Emotional_State_Post_Usage
## dbl (11): User_ID, Age, Daily_Usage_Time_min, Posts_Per_Day, Likes_Received_...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

3. MENAMPILKAN DATA

Melihat 6 Data Pertama

head(data)
## # A tibble: 6 × 15
##   User_ID   Age Gender     Platform  Daily_Usage_Time_min Posts_Per_Day
##     <dbl> <dbl> <chr>      <chr>                    <dbl>         <dbl>
## 1    1001    23 Female     Instagram                  145             3
## 2    1002    19 Male       TikTok                     210             1
## 3    1003    28 Female     LinkedIn                    45             0
## 4    1004    35 Male       Facebook                    90             2
## 5    1005    21 Non-binary Twitter                    180            15
## 6    1006    25 Male       YouTube                    240             0
## # ℹ 9 more variables: Likes_Received_Daily <dbl>,
## #   Comments_Received_Daily <dbl>, Messages_Sent_Daily <dbl>,
## #   Scroll_Rate_ppm <dbl>, Addiction_Level <chr>,
## #   Emotional_State_Post_Usage <chr>, Productivity_Loss_Score <dbl>,
## #   Mental_Health_Index <dbl>, FOMO_Score <dbl>

Mengecek Struktur Data

str(data)
## spc_tbl_ [20 × 15] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ User_ID                   : num [1:20] 1001 1002 1003 1004 1005 ...
##  $ Age                       : num [1:20] 23 19 28 35 21 25 31 22 29 40 ...
##  $ Gender                    : chr [1:20] "Female" "Male" "Female" "Male" ...
##  $ Platform                  : chr [1:20] "Instagram" "TikTok" "LinkedIn" "Facebook" ...
##  $ Daily_Usage_Time_min      : num [1:20] 145 210 45 90 180 240 60 165 30 50 ...
##  $ Posts_Per_Day             : num [1:20] 3 1 0 2 15 0 1 5 0 1 ...
##  $ Likes_Received_Daily      : num [1:20] 120 45 5 30 200 10 50 90 2 15 ...
##  $ Comments_Received_Daily   : num [1:20] 25 5 2 10 60 1 8 12 0 3 ...
##  $ Messages_Sent_Daily       : num [1:20] 45 10 15 20 50 0 30 35 5 10 ...
##  $ Scroll_Rate_ppm           : num [1:20] 40 85 10 25 55 10 20 70 15 10 ...
##  $ Addiction_Level           : chr [1:20] "High" "Severe" "Low" "Moderate" ...
##  $ Emotional_State_Post_Usage: chr [1:20] "Anxious" "Depressed" "Motivated" "Neutral" ...
##  $ Productivity_Loss_Score   : num [1:20] 7 9 2 4 8 9 3 6 1 2 ...
##  $ Mental_Health_Index       : num [1:20] 45 30 80 65 40 35 75 50 85 70 ...
##  $ FOMO_Score                : num [1:20] 8 9 3 5 7 4 4 8 2 3 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   User_ID = col_double(),
##   ..   Age = col_double(),
##   ..   Gender = col_character(),
##   ..   Platform = col_character(),
##   ..   Daily_Usage_Time_min = col_double(),
##   ..   Posts_Per_Day = col_double(),
##   ..   Likes_Received_Daily = col_double(),
##   ..   Comments_Received_Daily = col_double(),
##   ..   Messages_Sent_Daily = col_double(),
##   ..   Scroll_Rate_ppm = col_double(),
##   ..   Addiction_Level = col_character(),
##   ..   Emotional_State_Post_Usage = col_character(),
##   ..   Productivity_Loss_Score = col_double(),
##   ..   Mental_Health_Index = col_double(),
##   ..   FOMO_Score = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>

Mengecek Nama Variabel

names(data)
##  [1] "User_ID"                    "Age"                       
##  [3] "Gender"                     "Platform"                  
##  [5] "Daily_Usage_Time_min"       "Posts_Per_Day"             
##  [7] "Likes_Received_Daily"       "Comments_Received_Daily"   
##  [9] "Messages_Sent_Daily"        "Scroll_Rate_ppm"           
## [11] "Addiction_Level"            "Emotional_State_Post_Usage"
## [13] "Productivity_Loss_Score"    "Mental_Health_Index"       
## [15] "FOMO_Score"

Ringkasan Statistik

summary(data)
##     User_ID          Age           Gender            Platform        
##  Min.   :1001   Min.   :18.00   Length:20          Length:20         
##  1st Qu.:1006   1st Qu.:21.75   Class :character   Class :character  
##  Median :1010   Median :25.50   Mode  :character   Mode  :character  
##  Mean   :1010   Mean   :26.50                                        
##  3rd Qu.:1015   3rd Qu.:30.25                                        
##  Max.   :1020   Max.   :40.00                                        
##  Daily_Usage_Time_min Posts_Per_Day   Likes_Received_Daily
##  Min.   : 20.0        Min.   : 0.00   Min.   :  1.00      
##  1st Qu.: 57.5        1st Qu.: 0.00   1st Qu.: 13.75      
##  Median :137.5        Median : 1.50   Median : 37.50      
##  Mean   :132.5        Mean   : 3.35   Mean   : 54.90      
##  3rd Qu.:182.5        3rd Qu.: 4.25   3rd Qu.: 82.50      
##  Max.   :300.0        Max.   :15.00   Max.   :200.00      
##  Comments_Received_Daily Messages_Sent_Daily Scroll_Rate_ppm Addiction_Level   
##  Min.   : 0.00           Min.   :  0.00      Min.   : 5.0    Length:20         
##  1st Qu.: 2.00           1st Qu.:  8.75      1st Qu.:10.0    Class :character  
##  Median : 9.00           Median : 22.50      Median :27.5    Mode  :character  
##  Mean   :14.00           Mean   : 45.00      Mean   :34.5                      
##  3rd Qu.:21.25           3rd Qu.: 41.25      3rd Qu.:50.0                      
##  Max.   :60.00           Max.   :300.00      Max.   :95.0                      
##  Emotional_State_Post_Usage Productivity_Loss_Score Mental_Health_Index
##  Length:20                  Min.   : 1.00           Min.   :25.00      
##  Class :character           1st Qu.: 2.75           1st Qu.:40.00      
##  Mode  :character           Median : 5.00           Median :57.50      
##                             Mean   : 5.25           Mean   :56.75      
##                             3rd Qu.: 8.00           3rd Qu.:71.25      
##                             Max.   :10.00           Max.   :90.00      
##    FOMO_Score   
##  Min.   : 2.00  
##  1st Qu.: 3.75  
##  Median : 5.50  
##  Mean   : 5.70  
##  3rd Qu.: 8.00  
##  Max.   :10.00

4. MEMILIH VARIABEL UNTUK SEM

sem_data <- data %>%
  select(
    Daily_Usage_Time_min,
    Posts_Per_Day,
    Likes_Received_Daily,
    Comments_Received_Daily,
    Productivity_Loss_Score,
    Mental_Health_Index
  )

5. STATISTIK DESKRIPTIF

describe(sem_data)
##                         vars  n   mean    sd median trimmed   mad min max range
## Daily_Usage_Time_min       1 20 132.50 77.11  137.5  128.75 85.25  20 300   280
## Posts_Per_Day              2 20   3.35  4.44    1.5    2.50  2.22   0  15    15
## Likes_Received_Daily       3 20  54.90 54.96   37.5   46.56 48.18   1 200   199
## Comments_Received_Daily    4 20  14.00 16.16    9.0   10.94 10.38   0  60    60
## Productivity_Loss_Score    5 20   5.25  2.88    5.0    5.25  4.45   1  10     9
## Mental_Health_Index        6 20  56.75 19.62   57.5   56.56 25.95  25  90    65
##                         skew kurtosis    se
## Daily_Usage_Time_min    0.23    -0.91 17.24
## Posts_Per_Day           1.34     0.52  0.99
## Likes_Received_Daily    1.05     0.23 12.29
## Comments_Received_Daily 1.40     1.18  3.61
## Productivity_Loss_Score 0.03    -1.47  0.64
## Mental_Health_Index     0.07    -1.38  4.39

6. VISUALISASI DATA

Histogram Daily Usage Time

hist(
  sem_data$Daily_Usage_Time_min,
  main = "Histogram Daily Usage Time",
  xlab = "Daily Usage Time (Minutes)",
  col = "lightblue"
)

## Boxplot Productivity Loss Score

boxplot(
  sem_data$Productivity_Loss_Score,
  main = "Boxplot Productivity Loss Score",
  col = "lightgreen"
)

# 7. MEMBANGUN INNER MODEL

inner_model <- matrix(c(
  0, 0, 0,
  1, 0, 0,
  1, 1, 0
),
nrow = 3,
byrow = TRUE)

colnames(inner_model) <- rownames(inner_model) <- c("SMU", "SIP", "PI")

8. MEMBANGUN OUTER MODEL

outer_model <- list(

c("Daily_Usage_Time_min", "Posts_Per_Day"),

c("Likes_Received_Daily", "Comments_Received_Daily"),

c("Productivity_Loss_Score", "Mental_Health_Index")

)

9. MENENTUKAN MODE PENGUKURAN

modes <- c("A", "A", "A")

10. MENJALANKAN ANALISIS PLS-SEM

pls_model <- plspm(
  sem_data,
  inner_model,
  outer_model,
  modes = modes
)
## Warning: Setting row names on a tibble is deprecated.

11. RINGKASAN HASIL MODEL

summary(pls_model)
## PARTIAL LEAST SQUARES PATH MODELING (PLS-PM) 
## 
## ---------------------------------------------------------- 
## MODEL SPECIFICATION 
## 1   Number of Cases      20 
## 2   Latent Variables     3 
## 3   Manifest Variables   6 
## 4   Scale of Data        Standardized Data 
## 5   Non-Metric PLS       FALSE 
## 6   Weighting Scheme     centroid 
## 7   Tolerance Crit       1e-06 
## 8   Max Num Iters        100 
## 9   Convergence Iters    4 
## 10  Bootstrapping        FALSE 
## 11  Bootstrap samples    NULL 
## 
## ---------------------------------------------------------- 
## BLOCKS DEFINITION 
##     Block         Type   Size   Mode
## 1     SMU    Exogenous      2      A
## 2     SIP   Endogenous      2      A
## 3      PI   Endogenous      2      A
## 
## ---------------------------------------------------------- 
## BLOCKS UNIDIMENSIONALITY 
##      Mode  MVs  C.alpha  DG.rho  eig.1st  eig.2nd
## SMU     A    2    0.499   0.800     1.33   0.6676
## SIP     A    2    0.968   0.984     1.94   0.0628
## PI      A    2    0.000   0.000     1.98   0.0190
## 
## ---------------------------------------------------------- 
## OUTER MODEL 
##                              weight  loading  communality  redundancy
## SMU                                                                  
##   1 Daily_Usage_Time_min      0.608    0.813        0.661       0.000
##   1 Posts_Per_Day             0.618    0.820        0.672       0.000
## SIP                                                                  
##   2 Likes_Received_Daily      0.502    0.984        0.968       0.585
##   2 Comments_Received_Daily   0.514    0.985        0.969       0.586
## PI                                                                   
##   3 Productivity_Loss_Score  -0.490    0.995        0.990       0.834
##   3 Mental_Health_Index       0.515   -0.995        0.991       0.835
## 
## ---------------------------------------------------------- 
## CROSSLOADINGS 
##                                 SMU     SIP      PI
## SMU                                                
##   1 Daily_Usage_Time_min      0.813   0.370   0.961
##   1 Posts_Per_Day             0.820   0.895   0.458
## SIP                                                
##   2 Likes_Received_Daily      0.747   0.984   0.479
##   2 Comments_Received_Daily   0.783   0.985   0.471
## PI                                                 
##   3 Productivity_Loss_Score   0.850   0.459   0.995
##   3 Mental_Health_Index      -0.874  -0.502  -0.995
## 
## ---------------------------------------------------------- 
## INNER MODEL 
## $SIP
##             Estimate   Std. Error    t value   Pr(>|t|)
## Intercept   9.62e-17        0.148   6.49e-16   1.00e+00
## SMU         7.77e-01        0.148   5.24e+00   5.49e-05
## 
## $PI
##              Estimate   Std. Error     t value   Pr(>|t|)
## Intercept    9.53e-17       0.0963    9.90e-16   1.00e+00
## SMU          1.24e+00       0.1531    8.10e+00   3.06e-07
## SIP         -4.82e-01       0.1531   -3.15e+00   5.89e-03
## 
## ---------------------------------------------------------- 
## CORRELATIONS BETWEEN LVs 
##        SMU    SIP     PI
## SMU  1.000  0.777  0.866
## SIP  0.777  1.000  0.483
## PI   0.866  0.483  1.000
## 
## ---------------------------------------------------------- 
## SUMMARY INNER MODEL 
##            Type     R2  Block_Communality  Mean_Redundancy    AVE
## SMU   Exogenous  0.000              0.666            0.000  0.666
## SIP  Endogenous  0.604              0.969            0.585  0.969
## PI   Endogenous  0.842              0.991            0.834  0.991
## 
## ---------------------------------------------------------- 
## GOODNESS-OF-FIT 
## [1]  0.7956
## 
## ---------------------------------------------------------- 
## TOTAL EFFECTS 
##    relationships  direct  indirect   total
## 1     SMU -> SIP   0.777     0.000   0.777
## 2      SMU -> PI   1.241    -0.374   0.866
## 3      SIP -> PI  -0.482     0.000  -0.482

12. OUTER MODEL

pls_model$outer_model
##                      name block     weight    loading communality redundancy
## 1    Daily_Usage_Time_min   SMU  0.6076327  0.8129142   0.6608295  0.0000000
## 2           Posts_Per_Day   SMU  0.6175039  0.8195038   0.6715864  0.0000000
## 3    Likes_Received_Daily   SIP  0.5023403  0.9838068   0.9678758  0.5849943
## 4 Comments_Received_Daily   SIP  0.5137452  0.9845234   0.9692863  0.5858468
## 5 Productivity_Loss_Score    PI -0.4897566  0.9950039   0.9900328  0.8339840
## 6     Mental_Health_Index    PI  0.5150165 -0.9954831   0.9909866  0.8347874

13. PATH COEFFICIENT

pls_model$path_coefs
##           SMU        SIP PI
## SMU 0.0000000  0.0000000  0
## SIP 0.7774384  0.0000000  0
## PI  1.2408106 -0.4816153  0

14. GOODNESS OF FIT

pls_model$gof
## [1] 0.7956399

15. VISUALISASI MODEL SEM

plot(pls_model)