#install.packages("seminr")
#install.packages("readr")
library(seminr)
library(readr)
library(psych)
library(corrplot)
data <- read.csv("D:/SEMESTER 4/Materi Sofia/AnMul/Modul 5_SEM PLS/StressLevelDataset.csv")
# Melihat data awal
head(data)
## anxiety_level self_esteem mental_health_history depression headache
## 1 14 20 0 11 2
## 2 15 8 1 15 5
## 3 12 18 1 14 2
## 4 16 12 1 15 4
## 5 16 28 0 7 2
## 6 20 13 1 21 3
## blood_pressure sleep_quality breathing_problem noise_level living_conditions
## 1 1 2 4 2 3
## 2 3 1 4 3 1
## 3 1 2 2 2 2
## 4 3 1 3 4 2
## 5 3 5 1 3 2
## 6 3 1 4 3 2
## safety basic_needs academic_performance study_load
## 1 3 2 3 2
## 2 2 2 1 4
## 3 3 2 2 3
## 4 2 2 2 4
## 5 4 3 4 3
## 6 2 1 2 5
## teacher_student_relationship future_career_concerns social_support
## 1 3 3 2
## 2 1 5 1
## 3 3 2 2
## 4 1 4 1
## 5 1 2 1
## 6 2 5 1
## peer_pressure extracurricular_activities bullying stress_level
## 1 3 3 2 1
## 2 4 5 5 2
## 3 3 2 2 1
## 4 4 4 5 2
## 5 5 0 5 1
## 6 4 4 5 2
#cek missing value
colSums(is.na(data))
## anxiety_level self_esteem
## 0 0
## mental_health_history depression
## 0 0
## headache blood_pressure
## 0 0
## sleep_quality breathing_problem
## 0 0
## noise_level living_conditions
## 0 0
## safety basic_needs
## 0 0
## academic_performance study_load
## 0 0
## teacher_student_relationship future_career_concerns
## 0 0
## social_support peer_pressure
## 0 0
## extracurricular_activities bullying
## 0 0
## stress_level
## 0
summary(data)
## anxiety_level self_esteem mental_health_history depression
## Min. : 0.00 Min. : 0.00 Min. :0.0000 Min. : 0.00
## 1st Qu.: 6.00 1st Qu.:11.00 1st Qu.:0.0000 1st Qu.: 6.00
## Median :11.00 Median :19.00 Median :0.0000 Median :12.00
## Mean :11.06 Mean :17.78 Mean :0.4927 Mean :12.56
## 3rd Qu.:16.00 3rd Qu.:26.00 3rd Qu.:1.0000 3rd Qu.:19.00
## Max. :21.00 Max. :30.00 Max. :1.0000 Max. :27.00
## headache blood_pressure sleep_quality breathing_problem
## Min. :0.000 Min. :1.000 Min. :0.00 Min. :0.000
## 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:1.00 1st Qu.:2.000
## Median :3.000 Median :2.000 Median :2.50 Median :3.000
## Mean :2.508 Mean :2.182 Mean :2.66 Mean :2.754
## 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:4.00 3rd Qu.:4.000
## Max. :5.000 Max. :3.000 Max. :5.00 Max. :5.000
## noise_level living_conditions safety basic_needs
## Min. :0.000 Min. :0.000 Min. :0.000 Min. :0.000
## 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000
## Median :3.000 Median :2.000 Median :2.000 Median :3.000
## Mean :2.649 Mean :2.518 Mean :2.737 Mean :2.773
## 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:4.000 3rd Qu.:4.000
## Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
## academic_performance study_load teacher_student_relationship
## Min. :0.000 Min. :0.000 Min. :0.000
## 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000
## Median :2.000 Median :2.000 Median :2.000
## Mean :2.773 Mean :2.622 Mean :2.648
## 3rd Qu.:4.000 3rd Qu.:3.000 3rd Qu.:4.000
## Max. :5.000 Max. :5.000 Max. :5.000
## future_career_concerns social_support peer_pressure
## Min. :0.000 Min. :0.000 Min. :0.000
## 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:2.000
## Median :2.000 Median :2.000 Median :2.000
## Mean :2.649 Mean :1.882 Mean :2.735
## 3rd Qu.:4.000 3rd Qu.:3.000 3rd Qu.:4.000
## Max. :5.000 Max. :3.000 Max. :5.000
## extracurricular_activities bullying stress_level
## Min. :0.000 Min. :0.000 Min. :0.0000
## 1st Qu.:2.000 1st Qu.:1.000 1st Qu.:0.0000
## Median :2.500 Median :3.000 Median :1.0000
## Mean :2.767 Mean :2.617 Mean :0.9964
## 3rd Qu.:4.000 3rd Qu.:4.000 3rd Qu.:2.0000
## Max. :5.000 Max. :5.000 Max. :2.0000
cor_matrix <- cor(data)
corrplot(
cor_matrix,
method = "color",
tl.cex = 0.7
)
boxplot(data)
measurement_model <- constructs(
# Psychological Factors
reflective(
"Psychological_Factors",
c(
"anxiety_level",
"depression"
# "self_esteem"
)
),
# Academic Factors
reflective(
"Academic_Factors",
c(
"study_load",
"future_career_concerns"
)
),
# Social Factors
reflective(
"Social_Factors",
c(
# "social_support"
"peer_pressure",
"bullying"
)
),
# Stress Level
reflective(
"Stress_Level",
c("stress_level")
)
)
structural_model <- relationships(
paths(
from = c(
"Psychological_Factors",
"Academic_Factors",
"Social_Factors"
),
to = "Stress_Level"
)
)
pls_model <- estimate_pls(
data = data,
measurement_model = measurement_model,
structural_model = structural_model
)
summary(pls_model)
##
## Results from package seminr (2.4.2)
##
## Path Coefficients:
## Stress_Level
## R^2 0.790
## AdjR^2 0.789
## Psychological_Factors 0.255
## Academic_Factors 0.133
## Social_Factors 0.502
##
## Reliability:
## alpha rhoA rhoC AVE
## Psychological_Factors 0.820 0.820 0.820 0.694
## Academic_Factors 0.731 0.744 0.736 0.583
## Social_Factors 0.796 0.800 0.797 0.663
## Stress_Level 1.000 1.000 1.000 1.000
##
## Alpha, rhoA, and rhoC should exceed 0.7 while AVE should exceed 0.5
# COMPOSITE RELIABILITY
summary(pls_model)$reliability
## alpha rhoA rhoC AVE
## Psychological_Factors 0.820 0.820 0.820 0.694
## Academic_Factors 0.731 0.744 0.736 0.583
## Social_Factors 0.796 0.800 0.797 0.663
## Stress_Level 1.000 1.000 1.000 1.000
##
## Alpha, rhoA, and rhoC should exceed 0.7 while AVE should exceed 0.5
Semua konstruk memiliki nilai CR lebih besar dari 0,7. Jadi dapat dikatakan bahwa konstruk tersebut reliabel dan dapat digunakan dalam proses analisis berikutnya.
pls_model$outer_loadings
## Psychological_Factors Academic_Factors Social_Factors
## anxiety_level 0.8346409 0.0000000 0.0000000
## depression 0.8319031 0.0000000 0.0000000
## study_load 0.0000000 0.7013837 0.0000000
## future_career_concerns 0.0000000 0.8213453 0.0000000
## peer_pressure 0.0000000 0.0000000 0.7796371
## bullying 0.0000000 0.0000000 0.8479044
## stress_level 0.0000000 0.0000000 0.0000000
## Stress_Level
## anxiety_level 0
## depression 0
## study_load 0
## future_career_concerns 0
## peer_pressure 0
## bullying 0
## stress_level 1
diketahui bahwa semua indikator reflektif pada semua konstruk memiliki nilai outer loading di atas 0,7. Jadi dapat dikatakan bahwa semua indikator reflektif dapat diandalkan untuk mengukur konstruk laten tersebut.
summary(pls_model)$validity$fl_criteria
## Psychological_Factors Academic_Factors Social_Factors
## Psychological_Factors 0.833 . .
## Academic_Factors 0.804 0.764 .
## Social_Factors 0.792 0.782 0.814
## Stress_Level 0.799 0.780 0.792
## Stress_Level
## Psychological_Factors .
## Academic_Factors .
## Social_Factors .
## Stress_Level 1.000
##
## FL Criteria table reports square root of AVE on the diagonal and construct correlations on the lower triangle.
vif < 5
summary(pls_model)$vif_antecedents
## Stress_Level :
## Psychological_Factors Academic_Factors Social_Factors
## 3.515 3.366 3.192
mendekati 1 semakin kuat
pls_model$rSquared
## Stress_Level
## Rsq 0.7897286
## AdjRsq 0.7891531
fSquared(pls_model,
iv = "Academic_Factors",
dv = "Stress_Level")
## [1] -0.005222557
fSquared(pls_model,
iv = "Social_Factors",
dv = "Stress_Level")
## [1] 0.05186596
fSquared(pls_model,
iv = "Psychological_Factors",
dv = "Stress_Level")
## [1] 0.02989112
boot_model <- bootstrap_model(
seminr_model = pls_model,
nboot = 5000,
cores = 1,
seed = 123
)
summary(boot_model)
##
## Results from Bootstrap resamples: 5000
##
## Bootstrapped Structural Paths:
## Original Est. Bootstrap Mean
## Psychological_Factors -> Stress_Level 0.255 2.620
## Academic_Factors -> Stress_Level 0.133 1.454
## Social_Factors -> Stress_Level 0.502 -3.224
## Bootstrap SD T Stat. 2.5% CI 97.5% CI
## Psychological_Factors -> Stress_Level 143.755 0.002 -3.332 4.400
## Academic_Factors -> Stress_Level 71.312 0.002 -2.003 2.488
## Social_Factors -> Stress_Level 211.370 0.002 -3.352 4.192
## Bootstrap P Val
## Psychological_Factors -> Stress_Level 0.626
## Academic_Factors -> Stress_Level 0.620
## Social_Factors -> Stress_Level 0.449
##
## Bootstrapped Weights:
## Original Est. Bootstrap Mean
## anxiety_level -> Psychological_Factors 0.544 0.544
## depression -> Psychological_Factors 0.542 0.542
## study_load -> Academic_Factors 0.518 0.519
## future_career_concerns -> Academic_Factors 0.607 0.607
## peer_pressure -> Social_Factors 0.526 0.525
## bullying -> Social_Factors 0.572 0.571
## stress_level -> Stress_Level 1.000 1.000
## Bootstrap SD T Stat. 2.5% CI
## anxiety_level -> Psychological_Factors 0.009 61.019 0.527
## depression -> Psychological_Factors 0.009 63.185 0.526
## study_load -> Academic_Factors 0.012 43.263 0.495
## future_career_concerns -> Academic_Factors 0.011 53.922 0.585
## peer_pressure -> Social_Factors 0.010 54.720 0.507
## bullying -> Social_Factors 0.010 54.850 0.552
## stress_level -> Stress_Level 0.000 . 1.000
## 97.5% CI Bootstrap P Val
## anxiety_level -> Psychological_Factors 0.562 0.000
## depression -> Psychological_Factors 0.560 0.000
## study_load -> Academic_Factors 0.542 0.000
## future_career_concerns -> Academic_Factors 0.630 0.000
## peer_pressure -> Social_Factors 0.544 0.000
## bullying -> Social_Factors 0.593 0.000
## stress_level -> Stress_Level 1.000 0.000
##
## Bootstrapped Loadings:
## Original Est. Bootstrap Mean
## anxiety_level -> Psychological_Factors 0.835 0.835
## depression -> Psychological_Factors 0.832 0.832
## study_load -> Academic_Factors 0.701 0.702
## future_career_concerns -> Academic_Factors 0.821 0.821
## peer_pressure -> Social_Factors 0.780 0.780
## bullying -> Social_Factors 0.848 0.848
## stress_level -> Stress_Level 1.000 1.000
## Bootstrap SD T Stat. 2.5% CI
## anxiety_level -> Psychological_Factors 0.017 49.017 0.801
## depression -> Psychological_Factors 0.018 46.420 0.796
## study_load -> Academic_Factors 0.020 34.335 0.661
## future_career_concerns -> Academic_Factors 0.026 32.097 0.770
## peer_pressure -> Social_Factors 0.021 37.928 0.738
## bullying -> Social_Factors 0.020 42.358 0.808
## stress_level -> Stress_Level 0.000 . 1.000
## 97.5% CI Bootstrap P Val
## anxiety_level -> Psychological_Factors 0.867 0.000
## depression -> Psychological_Factors 0.866 0.000
## study_load -> Academic_Factors 0.741 0.000
## future_career_concerns -> Academic_Factors 0.870 0.000
## peer_pressure -> Social_Factors 0.819 0.000
## bullying -> Social_Factors 0.886 0.000
## stress_level -> Stress_Level 1.000 0.000
##
## Bootstrapped HTMT:
## Original Est. Bootstrap Mean
## Psychological_Factors -> Academic_Factors 1.033 1.033
## Psychological_Factors -> Social_Factors 0.979 0.980
## Psychological_Factors -> Stress_Level 0.883 0.884
## Academic_Factors -> Social_Factors 1.016 1.017
## Academic_Factors -> Stress_Level 0.907 0.908
## Social_Factors -> Stress_Level 0.887 0.887
## Bootstrap SD 2.5% CI 97.5% CI
## Psychological_Factors -> Academic_Factors 0.023 0.988 1.080
## Psychological_Factors -> Social_Factors 0.022 0.936 1.022
## Psychological_Factors -> Stress_Level 0.019 0.846 0.918
## Academic_Factors -> Social_Factors 0.029 0.961 1.073
## Academic_Factors -> Stress_Level 0.023 0.862 0.952
## Social_Factors -> Stress_Level 0.020 0.847 0.925
## Bootstrap P Val
## Psychological_Factors -> Academic_Factors 0.147
## Psychological_Factors -> Social_Factors 0.356
## Psychological_Factors -> Stress_Level 0.000
## Academic_Factors -> Social_Factors 0.571
## Academic_Factors -> Stress_Level 0.000
## Social_Factors -> Stress_Level 0.000
##
## Bootstrapped Total Paths:
## Original Est. Bootstrap Mean
## Psychological_Factors -> Stress_Level 0.255 2.620
## Academic_Factors -> Stress_Level 0.133 1.454
## Social_Factors -> Stress_Level 0.502 -3.224
## Bootstrap SD 2.5% CI 97.5% CI
## Psychological_Factors -> Stress_Level 143.755 -3.332 4.400
## Academic_Factors -> Stress_Level 71.312 -2.003 2.488
## Social_Factors -> Stress_Level 211.370 -3.352 4.192
plot(pls_model)