Nama Aggota Kelompok:

1. Christine Aprilia Putri (24031554046)

2. Fridania Nisa Calita (24031554208)

Load Dataset

data <- read_csv("SMA.csv")
## Rows: 1029 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (15): Q1_Gender, Q2_Living_Area, Q3_Maritial_Status, SMAQ1, SMAQ2, SMAQ3...
## 
## ℹ 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.

EDA

1.Struktur Data

str(data)
## spc_tbl_ [1,029 × 15] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ Q1_Gender              : num [1:1029] 1 1 2 1 1 2 1 2 2 2 ...
##  $ Q2_Living_Area         : num [1:1029] 1 1 1 2 1 2 2 1 2 1 ...
##  $ Q3_Maritial_Status     : num [1:1029] 2 2 2 2 2 2 2 2 2 2 ...
##  $ SMAQ1                  : num [1:1029] 4 3 3 2 1 3 4 5 4 2 ...
##  $ SMAQ2                  : num [1:1029] 5 2 2 5 4 3 5 4 5 2 ...
##  $ SMAQ3                  : num [1:1029] 1 1 1 5 3 4 2 3 2 1 ...
##  $ SMAQ4                  : num [1:1029] 3 5 1 2 1 1 2 3 1 1 ...
##  $ SMAQ5                  : num [1:1029] 5 5 1 3 2 5 1 4 3 1 ...
##  $ SMAQ6                  : num [1:1029] 2 1 1 1 1 1 4 4 1 1 ...
##  $ SMAQ7                  : num [1:1029] 2 1 1 3 1 3 1 2 1 1 ...
##  $ SMAQ8                  : num [1:1029] 4 2 1 4 1 3 1 1 3 1 ...
##  $ SMAQ9                  : num [1:1029] 5 5 1 4 1 3 2 3 4 1 ...
##  $ SMAQ10                 : num [1:1029] 3 1 1 1 1 1 1 1 1 1 ...
##  $ SMA_Scale_value        : num [1:1029] 34 26 13 30 16 27 23 30 25 12 ...
##  $ SMA_Scale (Class_Lebel): num [1:1029] 2 2 1 2 1 2 2 2 2 1 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   Q1_Gender = col_double(),
##   ..   Q2_Living_Area = col_double(),
##   ..   Q3_Maritial_Status = col_double(),
##   ..   SMAQ1 = col_double(),
##   ..   SMAQ2 = col_double(),
##   ..   SMAQ3 = col_double(),
##   ..   SMAQ4 = col_double(),
##   ..   SMAQ5 = col_double(),
##   ..   SMAQ6 = col_double(),
##   ..   SMAQ7 = col_double(),
##   ..   SMAQ8 = col_double(),
##   ..   SMAQ9 = col_double(),
##   ..   SMAQ10 = col_double(),
##   ..   SMA_Scale_value = col_double(),
##   ..   `SMA_Scale (Class_Lebel)` = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>

Menampilkan karakteristik dasar dari dataset sebelum dimanipulasi yang memperlihatkan jumlah baris (observasi), jumlah kolom (variabel), serta tipe data dari masing-masing kolom (seperti character, numeric, atau integer).

2.Ringkasan data

summary(data)
##    Q1_Gender     Q2_Living_Area  Q3_Maritial_Status     SMAQ1      
##  Min.   :1.000   Min.   :1.000   Min.   :1.00       Min.   :1.000  
##  1st Qu.:1.000   1st Qu.:1.000   1st Qu.:2.00       1st Qu.:3.000  
##  Median :1.000   Median :1.000   Median :2.00       Median :4.000  
##  Mean   :1.364   Mean   :1.291   Mean   :1.94       Mean   :3.926  
##  3rd Qu.:2.000   3rd Qu.:2.000   3rd Qu.:2.00       3rd Qu.:5.000  
##  Max.   :2.000   Max.   :2.000   Max.   :2.00       Max.   :5.000  
##      SMAQ2           SMAQ3           SMAQ4           SMAQ5           SMAQ6     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.00  
##  1st Qu.:3.000   1st Qu.:1.000   1st Qu.:1.000   1st Qu.:2.000   1st Qu.:1.00  
##  Median :3.000   Median :3.000   Median :2.000   Median :3.000   Median :2.00  
##  Mean   :3.335   Mean   :2.743   Mean   :2.183   Mean   :2.899   Mean   :2.39  
##  3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:3.000   3rd Qu.:4.000   3rd Qu.:3.00  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.00  
##      SMAQ7           SMAQ8           SMAQ9           SMAQ10     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:1.000   1st Qu.:1.000   1st Qu.:2.000   1st Qu.:1.000  
##  Median :2.000   Median :2.000   Median :3.000   Median :1.000  
##  Mean   :2.029   Mean   :2.492   Mean   :3.204   Mean   :1.397  
##  3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:4.000   3rd Qu.:1.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000  
##  SMA_Scale_value SMA_Scale (Class_Lebel)
##  Min.   :10.0    Min.   :1.000          
##  1st Qu.:21.0    1st Qu.:2.000          
##  Median :26.0    Median :2.000          
##  Mean   :26.6    Mean   :1.821          
##  3rd Qu.:32.0    3rd Qu.:2.000          
##  Max.   :50.0    Max.   :3.000

Berisi ringkasan statistik dasar untuk setiap variabel di dalam dataset. Untuk variabel numerik, output akan menunjukkan nilai Minimum, Kuartil 1, Median (nilai tengah), Mean (rata-rata), Kuartil 3, dan Maksimum. Informasi ini berguna untuk melihat sebaran data dan mendeteksi secara cepat jika ada keanehan pengisian data.

3.Missing value

cat("Jumlah Missing Value:",
    sum(is.na(data)), "\n")
## Jumlah Missing Value: 0

Menghitung jumlah data kosong di seluruh dataset.

4.Data duplikat

cat("Jumlah Data Duplikat:",
    sum(duplicated(data)), "\n")
## Jumlah Data Duplikat: 34

Mendeteksi apakah ada data duplikat dalam dataset.

Hapus Duplikat

data_clean <- data %>%
  distinct()

Mengahpus data duplikat agak tidak terjadi bias dalam perhitungan.

5. Visualisasi Demografi

# Distribusi Gender
ggplot(data_clean, aes(x = as.factor(Q1_Gender))) +
  geom_bar(fill = "skyblue", color = "black", alpha = 0.8) +
  labs(title = "Distribusi Gender", x = "Gender", y = "Frekuensi") +
  theme_minimal()

# Distribusi Living Area
ggplot(data_clean, aes(x = as.factor(Q2_Living_Area))) +
  geom_bar(fill = "orange", color = "black", alpha = 0.8) +
  labs(title = "Distribusi Living Area", x = "Living Area", y = "Frekuensi") +
  theme_minimal()

# Distribusi Maritial Status
ggplot(data_clean, aes(x = as.factor(Q3_Maritial_Status))) +
  geom_bar(fill = "red", color = "black", alpha = 0.8) +
  labs(title = "Distribusi Maritial Status", x = "Maritial Status", y = "Frekuensi") +
  theme_minimal()

Responden didominasi oleh kategori gender tertentu dan sebagian besar responden berasal dari kategori living area tertentu. Sementara itu, mayoritas responden berada pada kategori marital status tertentu. Analisis karakteristik data dilakukan untuk memberikan gambaran umum mengenai kondisi dataset sebelum dilakukan proses pemodelan menggunakan SEM-PLS.

Preprocessing Data

Variabel turunan tidak digunakan

data_pls <- data_clean %>%
  select(
    SMAQ2, SMAQ3, SMAQ4, SMAQ7, SMAQ8, SMAQ9,
    Class_Label = `SMA_Scale (Class_Lebel)`
  )

data_pls <- as.data.frame(data_pls)
data_pls[] <- lapply(data_pls, as.numeric)

MODEL SPECIFICATION

sma_path <- matrix(c(
  c(0, 0,
  1, 0)
), nrow = 2,ncol = 2, byrow = TRUE)

colnames(sma_path) <- 
  c("Social_Media_Addiction",
  "Addiction_Level")

rownames(sma_path) <- 
  c("Social_Media_Addiction",
  "Addiction_Level")

storage.mode(sma_path) <- "numeric"

sma_path
##                        Social_Media_Addiction Addiction_Level
## Social_Media_Addiction                      0               0
## Addiction_Level                             1               0

Menampilkan matriks biner (angka 0 dan 1) berukuran 2 x 2. Angka 1 pada posisi tertentu menunjukkan adanya arah pengaruh (hipotesis) dari variabel independen ke variabel dependen. Dalam kasus ini, model menyatakan bahwa variabel Social Media Addiction berpengaruh langsung terhadap Addiction Level.

sma_blocks <- list(
  Social_Media_Addiction = 1:6,
  Addiction_Level = 7
)

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

ESTIMASI MODEL

model_plspm <- plspm(
  Data = data_pls,
  path_matrix = sma_path,
  blocks = sma_blocks,
  modes = sma_modes
)

summary(model_plspm)
## PARTIAL LEAST SQUARES PATH MODELING (PLS-PM) 
## 
## ---------------------------------------------------------- 
## MODEL SPECIFICATION 
## 1   Number of Cases      995 
## 2   Latent Variables     2 
## 3   Manifest Variables   7 
## 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    2 
## 10  Bootstrapping        FALSE 
## 11  Bootstrap samples    NULL 
## 
## ---------------------------------------------------------- 
## BLOCKS DEFINITION 
##                      Block         Type   Size   Mode
## 1   Social_Media_Addiction    Exogenous      6      A
## 2          Addiction_Level   Endogenous      1      A
## 
## ---------------------------------------------------------- 
## BLOCKS UNIDIMENSIONALITY 
##                         Mode  MVs  C.alpha  DG.rho  eig.1st  eig.2nd
## Social_Media_Addiction     A    6    0.824   0.872      3.2    0.862
## Addiction_Level            A    1    1.000   1.000      1.0    0.000
## 
## ---------------------------------------------------------- 
## OUTER MODEL 
##                         weight  loading  communality  redundancy
## Social_Media_Addiction                                          
##   1 SMAQ2                0.228    0.708        0.501       0.000
##   1 SMAQ3                0.217    0.680        0.462       0.000
##   1 SMAQ4                0.227    0.740        0.548       0.000
##   1 SMAQ7                0.211    0.694        0.481       0.000
##   1 SMAQ8                0.248    0.806        0.649       0.000
##   1 SMAQ9                0.238    0.747        0.559       0.000
## Addiction_Level                                                 
##   2 Class_Label          1.000    1.000        1.000       0.594
## 
## ---------------------------------------------------------- 
## CROSSLOADINGS 
##                         Social_Media_Addiction  Addiction_Level
## Social_Media_Addiction                                         
##   1 SMAQ2                                0.708            0.562
##   1 SMAQ3                                0.680            0.534
##   1 SMAQ4                                0.740            0.559
##   1 SMAQ7                                0.694            0.519
##   1 SMAQ8                                0.806            0.611
##   1 SMAQ9                                0.747            0.587
## Addiction_Level                                                
##   2 Class_Label                          0.771            1.000
## 
## ---------------------------------------------------------- 
## INNER MODEL 
## $Addiction_Level
##                           Estimate   Std. Error     t value    Pr(>|t|)
## Intercept                -1.89e-16       0.0202   -9.37e-15    1.00e+00
## Social_Media_Addiction    7.71e-01       0.0202    3.81e+01   1.26e-196
## 
## ---------------------------------------------------------- 
## CORRELATIONS BETWEEN LVs 
##                         Social_Media_Addiction  Addiction_Level
## Social_Media_Addiction                   1.000            0.771
## Addiction_Level                          0.771            1.000
## 
## ---------------------------------------------------------- 
## SUMMARY INNER MODEL 
##                               Type     R2  Block_Communality  Mean_Redundancy
## Social_Media_Addiction   Exogenous  0.000              0.533            0.000
## Addiction_Level         Endogenous  0.594              1.000            0.594
##                           AVE
## Social_Media_Addiction  0.533
## Addiction_Level         1.000
## 
## ---------------------------------------------------------- 
## GOODNESS-OF-FIT 
## [1]  0.563
## 
## ---------------------------------------------------------- 
## TOTAL EFFECTS 
##                                relationships  direct  indirect  total
## 1  Social_Media_Addiction -> Addiction_Level   0.771         0  0.771

OUTER MODEL (LOADING)

loadings_sma <- model_plspm$outer_model %>%
  filter(block == "Social_Media_Addiction") %>%
  select(name, loading)

print(data.frame(
  Indikator = loadings_sma$name,
  Loading = round(loadings_sma$loading, 4)
))
##   Indikator Loading
## 1     SMAQ2  0.7081
## 2     SMAQ3  0.6799
## 3     SMAQ4  0.7405
## 4     SMAQ7  0.6939
## 5     SMAQ8  0.8055
## 6     SMAQ9  0.7474

UNIDIMENSIONALITY (ALPHA & CR)

print(model_plspm$unidim)
##                        Mode MVs   C.alpha    DG.rho eig.1st   eig.2nd
## Social_Media_Addiction    A   6 0.8241045 0.8724366 3.20117 0.8616297
## Addiction_Level           A   1 1.0000000 1.0000000 1.00000 0.0000000

EVALUASI MODEL (AVE, ALPHA, CR)

unidim <- model_plspm$unidim

alpha_final <- unidim$C.alpha[1]
cr_final    <- unidim$DG.rho[1]

# AVE dihitung manual
loadings <- model_plspm$outer_model$loading
loadings_sma <- loadings[model_plspm$outer_model$block == "Social_Media_Addiction"]
ave_final <- mean(loadings_sma^2)

VALIDITAS DISKRIMINAN (HTMT)

indikator_sma <- data_pls[, 1:6]  
indikator_y   <- data_pls[, 7, drop = FALSE]  

matriks_kor_internal <- cor(indikator_sma)
mean_kor_internal <- mean(matriks_kor_internal[lower.tri(matriks_kor_internal)])

matriks_kor_silang <- cor(indikator_sma, indikator_y)
mean_kor_silang <- mean(abs(matriks_kor_silang))

nilai_htmt <- mean_kor_silang / sqrt(mean_kor_internal * 1)

cat("Nilai HTMT Resmi Model Kamu:", round(nilai_htmt, 4), "\n")
## Nilai HTMT Resmi Model Kamu: 0.8487
cat("Ambang Batas Toleransi     : < 0.85 atau < 0.90\n")
## Ambang Batas Toleransi     : < 0.85 atau < 0.90
if (nilai_htmt < 0.85) {
  cat("Kesimpulan: VALIDITAS DISKRIMINAN TERPENUHI (Model Sangat Baik)\n")
} else {
  cat("Kesimpulan: Validitas Diskriminan Lemah\n")
}
## Kesimpulan: VALIDITAS DISKRIMINAN TERPENUHI (Model Sangat Baik)

KESIMPULAN OUTER MODEL

cat("1. AVE   :", round(ave_final, 4), " (Syarat > 0.50)\n")
## 1. AVE   : 0.5335  (Syarat > 0.50)
cat("2. Alpha :", round(alpha_final, 4), " (Syarat > 0.70)\n")
## 2. Alpha : 0.8241  (Syarat > 0.70)
cat("3. CR    :", round(cr_final, 4), " (Syarat > 0.70)\n")
## 3. CR    : 0.8724  (Syarat > 0.70)
cat("4. HTMT  :", round(nilai_htmt, 4), " (Syarat < 0.85)\n")
## 4. HTMT  : 0.8487  (Syarat < 0.85)
if (ave_final >= 0.5 & alpha_final >= 0.7 & cr_final >= 0.7 & nilai_htmt < 0.85) {
  cat("\nSTATUS FINAL: OUTER MODEL FIT, VALID, DAN RELIABEL\n")
} else {
  cat("\nSTATUS FINAL: MODEL BELUM MEMENUHI KRITERIA\n")
}
## 
## STATUS FINAL: OUTER MODEL FIT, VALID, DAN RELIABEL

INNER MODEL

VIF

vif_model <- lm(Class_Label ~ SMAQ2 + SMAQ3 + SMAQ4 +
                  SMAQ7 + SMAQ8 + SMAQ9,
                data = data_pls)

vif(vif_model)
##    SMAQ2    SMAQ3    SMAQ4    SMAQ7    SMAQ8    SMAQ9 
## 1.524530 1.534288 1.623311 1.611331 1.956912 1.714911

Kode digunakan untuk mengecek multikolinearitas antar indikator. Interpretasi: - VIF < 5 = tidak terjadi multikolinearitas - VIF > 5 = terdapat multikolinearitas

R-SQUARE

r2 <- model_plspm$inner_summary$R2[2]

r2
## [1] 0.5940892

Interpretasi:

0.75 = kuat 0.50 = sedang 0.25 = lemah

Nilai R-square menunjukkan kemampuan variabel independen menjelaskan variabel dependen.

EFFECT SIZE (F2)

f2 <- r2 / (1 - r2)

f2
## [1] 1.463595
if(f2 >= 0.35){
  print("Effect size besar")
} else if(f2 >= 0.15){
  print("Effect size sedang")
} else if(f2 >= 0.02){
  print("Effect size kecil")
} else{
  print("Effect size sangat kecil")
}
## [1] "Effect size besar"

Kode menghitung ukuran pengaruh variabel independen terhadap dependen.

BOOTSTRAPPING

set.seed(123) # Menjaga agar hasil pengacakan tetap konsisten saat di-run ulang
model_boot <- plspm(
  Data = data_pls,
  path_matrix = sma_path,
  blocks = sma_blocks,
  modes = sma_modes,
  boot.val = TRUE,
  br = 500
)

cat("--- Hasil Pengujian Signifikansi (Bootstrapping 500 Resample) ---\n")
## --- Hasil Pengujian Signifikansi (Bootstrapping 500 Resample) ---
print(model_boot$boot$paths)
##                                            Original Mean.Boot Std.Error
## Social_Media_Addiction -> Addiction_Level 0.7707718 0.7713016 0.0121492
##                                            perc.025  perc.975
## Social_Media_Addiction -> Addiction_Level 0.7471119 0.7929128

Kode melakukan bootstrapping sebanyak 500 resample untuk menguji signifikansi hubungan antar variabel.

T-STATISTIC dan P-VALUE

# Membuat data frame boot_paths dari hasil bootstrapping model_boot
boot_paths <- as.data.frame(model_boot$boot$paths)

# Menghitung T-Statistic dan P-Value sesuai rumus statistik dasar PLS-SEM
boot_paths$T_Stat <- abs(boot_paths$Original / boot_paths$Std.Error)
df_model <- nrow(data_pls) - 1
boot_paths$p_value <- 2 * (1 - pt(boot_paths$T_Stat, df = df_model))

# Membuat kolom Original_Estimate untuk keperluan pencetakan nama hubungan di kesimpulan
boot_paths$Original_Estimate <- rownames(boot_paths)

boot_paths
##                                            Original Mean.Boot Std.Error
## Social_Media_Addiction -> Addiction_Level 0.7707718 0.7713016 0.0121492
##                                            perc.025  perc.975   T_Stat p_value
## Social_Media_Addiction -> Addiction_Level 0.7471119 0.7929128 63.44217       0
##                                                                   Original_Estimate
## Social_Media_Addiction -> Addiction_Level Social_Media_Addiction -> Addiction_Level

Interpretasi:

T-statistic > 1.96 = signifikan P-value < 0.05 = signifikan

Jika syarat terpenuhi maka hipotesis diterima.

KESIMPULAN INNER MODEL

for(i in 1:nrow(boot_paths)) {

  cat("\n")
  cat("Hubungan:",
      boot_paths$Original_Estimate[i],
      "\n")

  cat("T-Statistic:",
      round(boot_paths$T_Stat[i], 4),
      "\n")

  # Proteksi jika p-value benar-benar 0 karena terlalu kecil bagi memori R
  p_val_raw <- boot_paths$p_value[i]
  
  if (p_val_raw == 0) {
    p_val_formatted <- "< 2.2e-16 (Sangat Signifikan)"
  } else if (p_val_raw < 0.0001) {
    p_val_formatted <- formatC(p_val_raw, format = "e", digits = 4)
  } else {
    p_val_formatted <- as.character(round(p_val_raw, 4))
  }

  cat("P-Value:",
      p_val_formatted,
      "\n")

  cat("Keputusan:",
      boot_paths$Keputusan[i],
      "\n")
}
## 
## Hubungan: Social_Media_Addiction -> Addiction_Level 
## T-Statistic: 63.4422 
## P-Value: < 2.2e-16 (Sangat Signifikan) 
## Keputusan:

Hipotesis: -H0 : β ≤ 0 (Variabel Social Media Addiction tidak berpengaruh positif dan signifikan terhadap Addiction Level). -H1: β > 0 (Variabel Social Media Addiction berpengaruh positif dan signifikan terhadap Addiction Level).

Berdasarkan hasil pengolahan data, diperoleh nilai Koefisien Jalur asli (Original Estimate) sebesar 0,77077. Nilai positif ini menunjukkan arah hubungan yang searah, bermakna bahwa semakin tinggi tingkat kecanduan media sosial seseorang, maka akan semakin parah pula tingkatan level kecanduan (Addiction Level) yang dialaminya. Melalui uji signifikansi berbasis parameter bootstrap, didapatkan nilai T-Statistic sebesar 63,4421, yang nilainya jauh melampaui nilai kritis tabel distribusi pada taraf nyata 5% yaitu sebesar 1,96 (63,4421 > 1,96). Didukung pula dengan perolehan nilai p-value yang sangat kecil yaitu < 2,2 x 10-16, di mana nilai tersebut jauh berada di bawah ambang batas signifikansi alpha (α = 0,05). Oleh karena nilai T-Statistik > 1,96 dan P-Value < 0,05, maka diambil keputusan statistik secara meyakinkan bahwa Hipotesis Nol (H0) Ditolak dan Hipotesis Alternatif (H1) Diterima.