####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>
####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
####3.Missing value
cat("Jumlah Missing Value:",
sum(is.na(data)), "\n")
## Jumlah Missing Value: 0
####4.Data duplikat
cat("Jumlah Data Duplikat:",
sum(duplicated(data)), "\n")
## Jumlah Data Duplikat: 34
data_clean <- data %>%
distinct()
###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()
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
sma_blocks <- list(
Social_Media_Addiction = 1:6,
Addiction_Level = 7
)
sma_modes <- c("A", "A")
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
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
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)
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)
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
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
names(model_plspm)
## [1] "outer_model" "inner_model" "path_coefs" "scores"
## [5] "crossloadings" "inner_summary" "effects" "unidim"
## [9] "gof" "boot" "data" "manifests"
## [13] "model"
###R-SQUARE
r2 <- model_plspm$inner_summary$R2[2]
r2
## [1] 0.5940892
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"
str(data_pls)
## 'data.frame': 995 obs. of 7 variables:
## $ SMAQ2 : num 5 2 2 5 4 3 5 4 5 2 ...
## $ SMAQ3 : num 1 1 1 5 3 4 2 3 2 1 ...
## $ SMAQ4 : num 3 5 1 2 1 1 2 3 1 1 ...
## $ SMAQ7 : num 2 1 1 3 1 3 1 2 1 1 ...
## $ SMAQ8 : num 4 2 1 4 1 3 1 1 3 1 ...
## $ SMAQ9 : num 5 5 1 4 1 3 2 3 4 1 ...
## $ Class_Label: num 2 2 1 2 1 2 2 2 2 1 ...