library(readxl)
library(seminr)
library(readxlsb)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.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(tidyverse)
## Warning: package 'readr' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats   1.0.0     ✔ readr     2.1.5
## ✔ ggplot2   3.4.2     ✔ stringr   1.5.0
## ✔ lubridate 1.9.2     ✔ tibble    3.2.1
## ✔ purrr     1.0.1     ✔ tidyr     1.3.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ✖ purrr::rerun()  masks seminr::rerun()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.3.2

dat <- read_excel("D:/artikel - game online caraka/Data_Visualisasi.xlsx")
dat
## # A tibble: 97 × 42
##    Angkatan Asal_Universitas Jenis_Univ Jenis_Prodi           Umur Jenis_Kelamin
##       <dbl> <chr>            <chr>      <chr>                <dbl> <chr>        
##  1       20 UNIPA            SWASTA     Ilmu Sosial dan Hum…    23 LAKI-LAKI    
##  2       20 UNIPA            SWASTA     Ilmu Sosial dan Hum…    22 LAKI-LAKI    
##  3       20 UNIPA            SWASTA     Ilmu Sosial dan Hum…    22 PEREMPUAN    
##  4       20 UNIPA            SWASTA     Ilmu Sosial dan Hum…    22 LAKI-LAKI    
##  5       20 UNIPA            SWASTA     Ilmu Sosial dan Hum…    22 LAKI-LAKI    
##  6       21 UNIPA            SWASTA     Ilmu Sosial dan Hum…    20 LAKI-LAKI    
##  7       21 UNIPA            SWASTA     Ilmu Sosial dan Hum…    22 LAKI-LAKI    
##  8       20 UNIPA            SWASTA     Ilmu Sosial dan Hum…    23 LAKI-LAKI    
##  9       20 UNIPA            SWASTA     Ilmu Sosial dan Hum…    21 PEREMPUAN    
## 10       20 UNIPA            SWASTA     Ilmu Sosial dan Hum…    21 PEREMPUAN    
## # ℹ 87 more rows
## # ℹ 36 more variables: Game_Online <chr>, Average_Playing <chr>, Y1 <chr>,
## #   Y2 <chr>, Y3 <chr>, Y4 <chr>, Y5 <chr>, Y6 <chr>, Y7 <chr>, Y8 <chr>,
## #   Y9 <chr>, Y10 <chr>, Y <chr>, X11 <chr>, X12 <chr>, X13 <chr>, X14 <chr>,
## #   X15 <chr>, X16 <chr>, X21 <chr>, X22 <chr>, X23 <chr>, X24 <chr>,
## #   X25 <chr>, X26 <chr>, X27 <chr>, X28 <chr>, X31 <chr>, X32 <chr>,
## #   X33 <chr>, X34 <chr>, X35 <chr>, X36 <chr>, X37 <chr>, X38 <chr>, …

#visual cross tab

#Depresi x Jenis Universitas
cross_1 <- dat %>%
  count(Y, Jenis_Univ) %>%
  spread(key = Y, value = n, fill = 0)
cross_1
## # A tibble: 2 × 5
##   Jenis_Univ `Gangguan Depresi Rendah` `Gangguan Depresi Sedang`
##   <chr>                          <dbl>                     <dbl>
## 1 NEGERI                             3                         5
## 2 SWASTA                            15                        49
## # ℹ 2 more variables: `Gangguan Depresi Tinggi` <dbl>,
## #   `Tidak Ada Gangguan Depresi` <dbl>
#Depresi x Game Online
cross_2 <- dat %>%
  count(Y, Game_Online) %>%
  spread(key = Y, value = n, fill = 0)
cross_2
## # A tibble: 3 × 5
##   Game_Online `Gangguan Depresi Rendah` `Gangguan Depresi Sedang`
##   <chr>                           <dbl>                     <dbl>
## 1 FF                                  0                         4
## 2 MLBB                               13                        40
## 3 PUBG                                5                        10
## # ℹ 2 more variables: `Gangguan Depresi Tinggi` <dbl>,
## #   `Tidak Ada Gangguan Depresi` <dbl>
#Depresi x Umur
cross_3 <- dat %>%
  count(Y, Umur) %>%
  spread(key = Y, value = n, fill = 0)
cross_3
## # A tibble: 5 × 5
##    Umur `Gangguan Depresi Rendah` Gangguan Depresi Seda…¹ Gangguan Depresi Tin…²
##   <dbl>                     <dbl>                   <dbl>                  <dbl>
## 1    19                         3                       9                      5
## 2    20                         9                      17                      7
## 3    21                         2                      11                      6
## 4    22                         1                      11                      0
## 5    23                         3                       6                      2
## # ℹ abbreviated names: ¹​`Gangguan Depresi Sedang`, ²​`Gangguan Depresi Tinggi`
## # ℹ 1 more variable: `Tidak Ada Gangguan Depresi` <dbl>
min(dat$Umur)
## [1] 19
max(dat$Umur)
## [1] 23
#Depresi x Gender
cross_4 <- dat %>%
  count(Y, Jenis_Kelamin) %>%
  spread(key = Y, value = n, fill = 0)
cross_4
## # A tibble: 2 × 5
##   Jenis_Kelamin `Gangguan Depresi Rendah` `Gangguan Depresi Sedang`
##   <chr>                             <dbl>                     <dbl>
## 1 LAKI-LAKI                            14                        45
## 2 PEREMPUAN                             4                         9
## # ℹ 2 more variables: `Gangguan Depresi Tinggi` <dbl>,
## #   `Tidak Ada Gangguan Depresi` <dbl>
#Depresi x Avg
cross_5 <- dat %>%
  count(Y, Average_Playing) %>%
  spread(key = Y, value = n, fill = 0)
cross_5
## # A tibble: 4 × 5
##   Average_Playing          `Gangguan Depresi Rendah` `Gangguan Depresi Sedang`
##   <chr>                                        <dbl>                     <dbl>
## 1 2 jam lebih hingga 4 jam                         5                        14
## 2 4 jam lebih hingga 6 jam                         4                        23
## 3 6 Jam Lebih                                      4                         5
## 4 Kurang lebih 2 jam                               5                        12
## # ℹ 2 more variables: `Gangguan Depresi Tinggi` <dbl>,
## #   `Tidak Ada Gangguan Depresi` <dbl>

### visual diagram lingkaran x1
ubaha <- c(2,3,1,4)
ubahb <- c(2,4,1,5,3)
#warna mulai dari kategori 5~1
#sangat setuju(5), setuju(4), kurang setuju(3), tidak setuju(2), sangat tidak setuju (1)
colors <- c("pink", "lightblue", "lightgreen", "yellow","purple")
#x11
ct11 <- table(dat$X11)
dfct11 <- as.data.frame(ct11)
names(dfct11) <- c("Category", "Count")
dfct11 <- dfct11[ubaha,]
piepercent11<- round(100*dfct11$Count/sum(dfct11$Count), 0)
pie(dfct11$Count, labels = paste0(piepercent11, "%"), main = "Indikator X11", col = colors)
legend("right",legend = dfct11$Category, fill = colors[1:length(dfct11$Category)] ,cex = 0.6)

#x12
ct12 <- table(dat$X12)
dfct12 <- as.data.frame(ct12)
names(dfct12) <- c("Category", "Count")
dfct12 <- dfct12[ubaha,]
piepercent12<- round(100*dfct12$Count/sum(dfct12$Count), 0)
pie(dfct12$Count, labels = paste0(piepercent12, "%"), 
    main = "Indikator X12", col = colors)
legend("right",legend = dfct12$Category, fill = colors[1:length(dfct12$Category)] ,cex = 0.6)

#x13
ct13 <- table(dat$X13)
dfct13 <- as.data.frame(ct13)
names(dfct13) <- c("Category", "Count")
dfct13 <- dfct13[ubaha,]
piepercent13<- round(100*dfct13$Count/sum(dfct13$Count), 0)
pie(dfct13$Count, labels = paste0(piepercent13, "%"), 
    main = "Indikator X13", col = colors)
legend("right",legend = dfct13$Category, fill = colors[1:length(dfct13$Category)] ,cex = 0.6)

#x14
ct14 <- table(dat$X14)
dfct14 <- as.data.frame(ct14)
names(dfct14) <- c("Category", "Count")
dfct14 <- dfct14[ubaha,]
piepercent14<- round(100*dfct14$Count/sum(dfct14$Count), 0)
pie(dfct14$Count, labels = paste0(piepercent14, "%"), 
    main = "Indikator X14", col = colors)
legend("right",legend = dfct14$Category, fill = colors[1:length(dfct14$Category)] ,cex = 0.6)

#x15
ct15 <- table(dat$X15)
dfct15 <- as.data.frame(ct15)
names(dfct15) <- c("Category", "Count")
dfct15 <- dfct15[ubahb,]
piepercent15<- round(100*dfct15$Count/sum(dfct15$Count), 0)
pie(dfct15$Count, labels = paste0(piepercent15, "%"), 
    main = "Indikator X15", col = colors)
legend("right",legend = dfct15$Category, fill = colors[1:length(dfct15$Category)] ,cex = 0.6)

#x16
ct16 <- table(dat$X16)
dfct16 <- as.data.frame(ct16)
names(dfct16) <- c("Category", "Count")
dfct16 <- dfct16[ubahb,]
piepercent16<- round(100*dfct16$Count/sum(dfct16$Count), 0)
pie(dfct16$Count, labels = paste0(piepercent16, "%"), 
    main = "Indikator X16", col = colors)
legend("right",legend = dfct16$Category, fill = colors[1:length(dfct16$Category)] ,cex = 0.6)

### visual diagram lingkaran x2
ubaha <- c(2,3,1,4)
ubahb <- c(2,4,1,5,3)
ubahc <- c(2,4,1,3)
#warna mulai dari kategori 5~1
#sangat setuju(5), setuju(4), kurang setuju(3), tidak setuju(2), sangat tidak setuju (1)
colors <- c("pink", "lightblue", "lightgreen", "yellow","purple")
colorsc <- c("pink", "lightblue", "lightgreen","purple")
#x21
ct21 <- table(dat$X21)
dfct21 <- as.data.frame(ct21)
names(dfct21) <- c("Category", "Count")
dfct21 <- dfct21[ubaha,]
piepercent21<- round(100*dfct21$Count/sum(dfct21$Count), 0)
pie(dfct21$Count, labels = paste0(piepercent21, "%"), 
    main = "Indikator X21", col = colors)
legend("right",legend = dfct21$Category, fill = colors[1:length(dfct21$Category)] ,cex = 0.6)

#x22
ct22 <- table(dat$X22)
dfct22 <- as.data.frame(ct22)
names(dfct22) <- c("Category", "Count")
dfct22 <- dfct22[ubahc,]
piepercent22<- round(100*dfct22$Count/sum(dfct22$Count), 0)
pie(dfct22$Count, labels = paste0(piepercent22, "%"), 
    main = "Indikator X22", col = colorsc)
legend("right",legend = dfct22$Category, fill = colorsc[1:length(dfct22$Category)] ,cex = 0.6)

#x23
ct23 <- table(dat$X23)
dfct23 <- as.data.frame(ct23)
names(dfct23) <- c("Category", "Count")
dfct23 <- dfct23[ubahc,]
piepercent23<- round(100*dfct23$Count/sum(dfct23$Count), 0)
pie(dfct23$Count, labels = paste0(piepercent23, "%"), 
    main = "Indikator X23", col = colorsc)
legend("right",legend = dfct23$Category, fill = colorsc[1:length(dfct23$Category)] ,cex = 0.6)

#x24
ct24 <- table(dat$X24)
dfct24 <- as.data.frame(ct24)
names(dfct24) <- c("Category", "Count")
dfct24 <- dfct24[ubaha,]
piepercent24<- round(100*dfct24$Count/sum(dfct24$Count), 0)
pie(dfct24$Count, labels = paste0(piepercent24, "%"), 
    main = "Indikator X24", col = colors)
legend("right",legend = dfct24$Category, fill = colors[1:length(dfct24$Category)] ,cex = 0.6)

#x25
ct25 <- table(dat$X25)
dfct25 <- as.data.frame(ct25)
names(dfct25) <- c("Category", "Count")
dfct25 <- dfct25[ubaha,]
piepercent25<- round(100*dfct25$Count/sum(dfct25$Count), 0)
pie(dfct25$Count, labels = paste0(piepercent25, "%"), 
    main = "Indikator X25", col = colors)
legend("right",legend = dfct25$Category, fill = colors[1:length(dfct25$Category)] ,cex = 0.6)

#x26
ct26 <- table(dat$X26)
dfct26 <- as.data.frame(ct26)
names(dfct26) <- c("Category", "Count")
dfct26 <- dfct26[ubahb,]
piepercent26<- round(100*dfct26$Count/sum(dfct26$Count), 0)
pie(dfct26$Count, labels = paste0(piepercent26, "%"), 
    main = "Indikator X26", col = colors)
legend("right",legend = dfct26$Category, fill = colors[1:length(dfct26$Category)] ,cex = 0.6)

#x27
ct27 <- table(dat$X27)
dfct27 <- as.data.frame(ct27)
names(dfct27) <- c("Category", "Count")
dfct27 <- dfct27[ubahb,]
piepercent27<- round(100*dfct27$Count/sum(dfct27$Count), 0)
pie(dfct27$Count, labels = paste0(piepercent27, "%"), 
    main = "Indikator X27", col = colors)
legend("right",legend = dfct27$Category, fill = colors[1:length(dfct27$Category)] ,cex = 0.6)

#x28
ct28 <- table(dat$X28)
dfct28 <- as.data.frame(ct28)
names(dfct28) <- c("Category", "Count")
dfct28 <- dfct28[ubahc,]
piepercent28<- round(100*dfct28$Count/sum(dfct28$Count), 0)
pie(dfct28$Count, labels = paste0(piepercent28, "%"), 
    main = "Indikator X28", col = colorsc)
legend("right",legend = dfct28$Category, fill = colorsc[1:length(dfct28$Category)] ,cex = 0.6)

### visual diagram lingkaran x3
ubaha <- c(2,3,1,4)
ubahb <- c(2,4,1,5,3)
ubahc <- c(2,4,1,3)
#warna mulai dari kategori 5~1
#sangat setuju(5), setuju(4), kurang setuju(3), tidak setuju(2), sangat tidak setuju (1)
colors <- c("pink", "lightblue", "lightgreen", "yellow","purple")
colorsc <- c("pink", "lightblue", "lightgreen","purple")
#x31
ct31 <- table(dat$X31)
dfct31 <- as.data.frame(ct31)
names(dfct31) <- c("Category", "Count")
dfct31 <- dfct31[ubaha,]
piepercent31<- round(100*dfct31$Count/sum(dfct31$Count), 0)
pie(dfct31$Count, labels = paste0(piepercent31, "%"), 
    main = "Indikator X31", col = colors)
legend("right",legend = dfct31$Category, fill = colors[1:length(dfct31$Category)] ,cex = 0.6)

#x32
ct32 <- table(dat$X32)
dfct32 <- as.data.frame(ct32)
names(dfct32) <- c("Category", "Count")
dfct32 <- dfct32[ubahc,]
piepercent32<- round(100*dfct32$Count/sum(dfct32$Count), 0)
pie(dfct32$Count, labels = paste0(piepercent32, "%"), 
    main = "Indikator X32", col = colorsc)
legend("right",legend = dfct32$Category, fill = colorsc[1:length(dfct32$Category)] ,cex = 0.6)

#x33
ct33 <- table(dat$X33)
dfct33 <- as.data.frame(ct33)
names(dfct33) <- c("Category", "Count")
dfct33 <- dfct33[ubahc,]
piepercent33<- round(100*dfct33$Count/sum(dfct33$Count), 0)
pie(dfct33$Count, labels = paste0(piepercent33, "%"), 
    main = "Indikator X33", col = colorsc)
legend("right",legend = dfct33$Category, fill = colorsc[1:length(dfct33$Category)] ,cex = 0.6)

#x34
ct34 <- table(dat$X34)
dfct34 <- as.data.frame(ct34)
names(dfct34) <- c("Category", "Count")
dfct34 <- dfct34[ubahc,]
piepercent34<- round(100*dfct34$Count/sum(dfct34$Count), 0)
pie(dfct34$Count, labels = paste0(piepercent34, "%"), 
    main = "Indikator X34", col = colorsc)
legend("right",legend = dfct34$Category, fill = colorsc[1:length(dfct34$Category)] ,cex = 0.6)

#x35
ct35 <- table(dat$X35)
dfct35 <- as.data.frame(ct35)
names(dfct35) <- c("Category", "Count")
dfct35 <- dfct35[ubahb,]
piepercent35<- round(100*dfct35$Count/sum(dfct35$Count), 0)
pie(dfct35$Count, labels = paste0(piepercent35, "%"), 
    main = "Indikator X35", col = colors)
legend("right",legend = dfct35$Category, fill = colors[1:length(dfct35$Category)] ,cex = 0.6)

#x36
ct36 <- table(dat$X36)
dfct36 <- as.data.frame(ct36)
names(dfct36) <- c("Category", "Count")
dfct36 <- dfct36[ubahb,]
piepercent36<- round(100*dfct36$Count/sum(dfct36$Count), 0)
pie(dfct36$Count, labels = paste0(piepercent36, "%"), 
    main = "Indikator X36", col = colors)
legend("right",legend = dfct36$Category, fill = colors[1:length(dfct36$Category)] ,cex = 0.6)

#x37
ct37 <- table(dat$X37)
dfct37 <- as.data.frame(ct37)
names(dfct37) <- c("Category", "Count")
dfct37 <- dfct37[ubahb,]
piepercent37<- round(100*dfct37$Count/sum(dfct37$Count), 0)
pie(dfct37$Count, labels = paste0(piepercent37, "%"), 
    main = "Indikator X37", col = colors)
legend("right",legend = dfct37$Category, fill = colors[1:length(dfct37$Category)] ,cex = 0.6)

#x38
ct38 <- table(dat$X38)
dfct38 <- as.data.frame(ct38)
names(dfct38) <- c("Category", "Count")
dfct38 <- dfct38[ubahb,]
piepercent38<- round(100*dfct38$Count/sum(dfct38$Count), 0)
pie(dfct38$Count, labels = paste0(piepercent38, "%"), 
    main = "Indikator X38", col = colors)
legend("right",legend = dfct38$Category, fill = colors[1:length(dfct38$Category)] ,cex = 0.6)

#x39
ct39 <- table(dat$X39)
dfct39 <- as.data.frame(ct39)
names(dfct39) <- c("Category", "Count")
dfct39 <- dfct39[ubahb,]
piepercent39<- round(100*dfct39$Count/sum(dfct39$Count), 0)
pie(dfct39$Count, labels = paste0(piepercent39, "%"), 
    main = "Indikator X39", col = colors)
legend("right",legend = dfct39$Category, fill = colors[1:length(dfct39$Category)] ,cex = 0.6)

#Visualisasai depresi
#Y
ubahy <- c(3,2,1,4)
ubahyy <- c(6,5,4,3,2,1,8,7)
cty <- table(dat$Y)
dfcty <- as.data.frame(cty)
names(dfcty) <- c("Category", "Count")
dfcty <- dfcty[ubahy,]
piepercenty<- round(100*dfcty$Count/sum(dfcty$Count), 0)
pie(dfcty$Count, labels = paste0(piepercenty, "%"), 
    main = "Kategori Y", col = rainbow(length(dfcty$Count)))
legend("right",legend = dfcty$Category, fill = rainbow(length(dfcty$Count)), cex = 0.6)

#Y1
cty1 <- table(dat$Y1,dat$Y)
dfcty1 <- as.data.frame(cty1)
names(dfcty1) <- c("K1","K", "Count")
dfcty1 <- dfcty1[ubahyy,]
dfcty1 <- dfcty1 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfcty1, aes(x = dfcty1$kategori, y = dfcty1$Count))+
  geom_bar(
    aes(fill = dfcty1$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfcty1$Count) * 1.1)) + geom_text(aes(label = dfcty1$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y1",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfcty1$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y2
ctY2 <- table(dat$Y2,dat$Y)
dfctY2 <- as.data.frame(ctY2)
names(dfctY2) <- c("K1","K", "Count")
dfctY2 <- dfctY2[ubahyy,]
dfctY2 <- dfctY2 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY2, aes(x = dfctY2$kategori, y = dfctY2$Count))+
  geom_bar(
    aes(fill = dfctY2$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY2$Count) * 1.1)) + geom_text(aes(label = dfctY2$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y2",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY2$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y3
ctY3 <- table(dat$Y3,dat$Y)
dfctY3 <- as.data.frame(ctY3)
names(dfctY3) <- c("K1","K", "Count")
dfctY3 <- dfctY3[ubahyy,]
dfctY3 <- dfctY3 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY3, aes(x = dfctY3$kategori, y = dfctY3$Count))+
  geom_bar(
    aes(fill = dfctY3$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY3$Count) * 1.1)) + geom_text(aes(label = dfctY3$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y3",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY3$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y4
ctY4 <- table(dat$Y4,dat$Y)
dfctY4 <- as.data.frame(ctY4)
names(dfctY4) <- c("K1","K", "Count")
dfctY4 <- dfctY4[ubahyy,]
dfctY4 <- dfctY4 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY4, aes(x = dfctY4$kategori, y = dfctY4$Count))+
  geom_bar(
    aes(fill = dfctY4$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY4$Count) * 1.1)) + geom_text(aes(label = dfctY4$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y4",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY4$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y5
ctY5 <- table(dat$Y5,dat$Y)
dfctY5 <- as.data.frame(ctY5)
names(dfctY5) <- c("K1","K", "Count")
dfctY5 <- dfctY5[ubahyy,]
dfctY5 <- dfctY5 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY5, aes(x = dfctY5$kategori, y = dfctY5$Count))+
  geom_bar(
    aes(fill = dfctY5$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY5$Count) * 1.1)) + geom_text(aes(label = dfctY5$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y5",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY5$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y6
ctY6 <- table(dat$Y6,dat$Y)
dfctY6 <- as.data.frame(ctY6)
names(dfctY6) <- c("K1","K", "Count")
dfctY6 <- dfctY6[ubahyy,]
dfctY6 <- dfctY6 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY6, aes(x = dfctY6$kategori, y = dfctY6$Count))+
  geom_bar(
    aes(fill = dfctY6$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY6$Count) * 1.1)) + geom_text(aes(label = dfctY6$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y6",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY6$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y7
ctY7 <- table(dat$Y7,dat$Y)
dfctY7 <- as.data.frame(ctY7)
names(dfctY7) <- c("K1","K", "Count")
dfctY7 <- dfctY7[ubahyy,]
dfctY7 <- dfctY7 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY7, aes(x = dfctY7$kategori, y = dfctY7$Count))+
  geom_bar(
    aes(fill = dfctY7$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY7$Count) * 1.1)) + geom_text(aes(label = dfctY7$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y7",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY7$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y8
ctY8 <- table(dat$Y8,dat$Y)
dfctY8 <- as.data.frame(ctY8)
names(dfctY8) <- c("K1","K", "Count")
dfctY8 <- dfctY8[ubahyy,]
dfctY8 <- dfctY8 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY8, aes(x = dfctY8$kategori, y = dfctY8$Count))+
  geom_bar(
    aes(fill = dfctY8$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY8$Count) * 1.1)) + geom_text(aes(label = dfctY8$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y8",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY8$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y9
ctY9 <- table(dat$Y9,dat$Y)
dfctY9 <- as.data.frame(ctY9)
names(dfctY9) <- c("K1","K", "Count")
dfctY9 <- dfctY9[ubahyy,]
dfctY9 <- dfctY9 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY9, aes(x = dfctY9$kategori, y = dfctY9$Count))+
  geom_bar(
    aes(fill = dfctY9$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY9$Count) * 1.1)) + geom_text(aes(label = dfctY9$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y9",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY9$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

#Y10
ctY10 <- table(dat$Y10,dat$Y)
dfctY10 <- as.data.frame(ctY10)
names(dfctY10) <- c("K1","K", "Count")
dfctY10 <- dfctY10[ubahyy,]
dfctY10 <- dfctY10 %>%
  mutate(kategori = c(4, 4, 3, 3, 2, 2, 1, 1))
ggplot(dfctY10, aes(x = dfctY10$kategori, y = dfctY10$Count))+
  geom_bar(
    aes(fill = dfctY10$K), stat = "identity",color = "black",
    position = position_dodge(0.9)
    )+ coord_cartesian(ylim = c(0, max(dfctY10$Count) * 1.1)) + geom_text(aes(label = dfctY10$Count), vjust = -0.5) +
  labs(
    title = "Indikator Y10",
    x = "Tingkat Depresi",
    y = "Jumlah Indikator Tiap Tingkatan",
    fill = "Tingkatan Depresi"
  ) +
  facet_wrap(dfctY10$K1) +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "gray90", color = "gray50")
  )

data <- read_excel("D:/artikel - game online caraka/Data_Skripsi_Analisis.xlsx")
data
## # A tibble: 97 × 24
##        Y   X11   X12   X13   X14   X15   X16   X21   X22   X23   X24   X25   X26
##    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1     3     4     4     5     4     4     5     4     5     5     4     4     5
##  2     3     3     5     5     5     5     4     5     4     5     5     4     5
##  3     3     4     5     3     4     5     5     4     3     4     4     3     4
##  4     3     5     4     5     4     5     5     5     3     5     3     3     2
##  5     3     5     5     5     5     1     1     5     3     1     2     5     2
##  6     3     4     4     4     4     4     4     4     4     4     4     4     4
##  7     3     4     3     4     3     3     4     4     4     3     4     3     4
##  8     3     5     5     5     5     5     5     3     5     5     5     4     1
##  9     2     5     5     5     4     5     4     5     4     4     5     4     4
## 10     3     4     4     4     5     4     5     5     5     4     4     5     4
## # ℹ 87 more rows
## # ℹ 11 more variables: X27 <dbl>, X28 <dbl>, X31 <dbl>, X32 <dbl>, X33 <dbl>,
## #   X34 <dbl>, X35 <dbl>, X36 <dbl>, X37 <dbl>, X38 <dbl>, X39 <dbl>
attach(data)

memanggil data

#data model Depresi X Game Online
model_SEM <- constructs(composite("X1", multi_items("X1", 1:6)), composite("X2", multi_items("X2", 1:8)), composite("X3", multi_items("X3", 1:9)), composite("Y", single_item("Y")))
#path SEm
model_SEM_PLS_Skrip <- relationships(paths(from = c("X1","X2","X3"), to = c("Y")))
#estimasi PLS
PLS_Skrip <- estimate_pls(data=data, measurement_model = model_SEM, structural_model = model_SEM_PLS_Skrip)
## Generating the seminr model
## All 97 observations are valid.
pls_model_Skrip <- summary(PLS_Skrip)

#setelah model pls didapatkan maka kita akan melakukan uji validitas data outer loading 1

pls_model_Skrip$loadings
##         X1     X2     X3     Y
## X11  0.903  0.000  0.000 0.000
## X12  0.894  0.000  0.000 0.000
## X13  0.839  0.000  0.000 0.000
## X14  0.899  0.000  0.000 0.000
## X15 -0.145 -0.000 -0.000 0.000
## X16  0.552  0.000  0.000 0.000
## X21  0.000  0.476  0.000 0.000
## X22  0.000  0.733  0.000 0.000
## X23  0.000  0.428  0.000 0.000
## X24  0.000  0.886  0.000 0.000
## X25  0.000  0.796  0.000 0.000
## X26  0.000  0.760  0.000 0.000
## X27  0.000  0.845  0.000 0.000
## X28  0.000  0.708  0.000 0.000
## X31  0.000  0.000  0.238 0.000
## X32  0.000  0.000  0.223 0.000
## X33  0.000  0.000  0.688 0.000
## X34  0.000  0.000  0.757 0.000
## X35  0.000  0.000  0.824 0.000
## X36  0.000  0.000  0.815 0.000
## X37  0.000  0.000  0.711 0.000
## X38  0.000  0.000  0.343 0.000
## X39  0.000  0.000  0.692 0.000
## Y    0.000  0.000  0.000 1.000

karena ini menggunakan model reflektif maka setiap perubahan indikator var laten eksogen tidak mempengaruhi var laten eksogen yang lain. hasilnya (x15, x21, x32) dikeluarkan.

#data model Depresi X Game Online
model_SEM <- constructs(composite("X1", multi_items("X1", c(1,2,3,4,6))), composite("X2", multi_items("X2", c(2,3,4,5,6,7,8))), composite("X3", multi_items("X3", c(1,3,4,5,6,7,8,9))), composite("Y", single_item("Y")))
#path SEm
model_SEM_PLS_Skrip <- relationships(paths(from = c("X1","X2","X3"), to = c("Y")))
#estimasi PLS
PLS_Skrip <- estimate_pls(data=data, measurement_model = model_SEM, structural_model = model_SEM_PLS_Skrip)
## Generating the seminr model
## All 97 observations are valid.
pls_model_Skrip <- summary(PLS_Skrip)

#setelah model pls didapatkan maka kita akan melakukan uji validitas data outer loading 2

pls_model_Skrip$loadings
##        X1    X2    X3     Y
## X11 0.903 0.000 0.000 0.000
## X12 0.894 0.000 0.000 0.000
## X13 0.839 0.000 0.000 0.000
## X14 0.899 0.000 0.000 0.000
## X16 0.551 0.000 0.000 0.000
## X22 0.000 0.775 0.000 0.000
## X23 0.000 0.459 0.000 0.000
## X24 0.000 0.900 0.000 0.000
## X25 0.000 0.809 0.000 0.000
## X26 0.000 0.773 0.000 0.000
## X27 0.000 0.845 0.000 0.000
## X28 0.000 0.660 0.000 0.000
## X31 0.000 0.000 0.236 0.000
## X33 0.000 0.000 0.705 0.000
## X34 0.000 0.000 0.760 0.000
## X35 0.000 0.000 0.832 0.000
## X36 0.000 0.000 0.813 0.000
## X37 0.000 0.000 0.710 0.000
## X38 0.000 0.000 0.331 0.000
## X39 0.000 0.000 0.681 0.000
## Y   0.000 0.000 0.000 1.000

karena ini menggunakan model reflektif maka setiap perubahan indikator var laten eksogen tidak mempengaruhi var laten eksogen yang lain. hasilnya (x23 dan x31) dikeluarkan.

#data model Depresi X Game Online
model_SEM <- constructs(composite("X1", multi_items("X1", c(1,2,3,4,6))), composite("X2", multi_items("X2", c(2,4,5,6,7,8))), composite("X3", multi_items("X3", c(3,4,5,6,7,8,9))), composite("Y", single_item("Y")))
#path SEm
model_SEM_PLS_Skrip <- relationships(paths(from = c("X1","X2","X3"), to = c("Y")))
#estimasi PLS
PLS_Skrip <- estimate_pls(data=data, measurement_model = model_SEM, structural_model = model_SEM_PLS_Skrip)
## Generating the seminr model
## All 97 observations are valid.
pls_model_Skrip <- summary(PLS_Skrip)

#setelah model pls didapatkan maka kita akan melakukan uji validitas data outer loading 3

pls_model_Skrip$loadings
##        X1    X2    X3     Y
## X11 0.903 0.000 0.000 0.000
## X12 0.894 0.000 0.000 0.000
## X13 0.839 0.000 0.000 0.000
## X14 0.899 0.000 0.000 0.000
## X16 0.551 0.000 0.000 0.000
## X22 0.000 0.770 0.000 0.000
## X24 0.000 0.900 0.000 0.000
## X25 0.000 0.815 0.000 0.000
## X26 0.000 0.773 0.000 0.000
## X27 0.000 0.846 0.000 0.000
## X28 0.000 0.666 0.000 0.000
## X33 0.000 0.000 0.710 0.000
## X34 0.000 0.000 0.760 0.000
## X35 0.000 0.000 0.834 0.000
## X36 0.000 0.000 0.817 0.000
## X37 0.000 0.000 0.710 0.000
## X38 0.000 0.000 0.321 0.000
## X39 0.000 0.000 0.679 0.000
## Y   0.000 0.000 0.000 1.000

karena ini menggunakan model reflektif maka setiap perubahan indikator var laten eksogen tidak mempengaruhi var laten eksogen yang lain. hasilnya (x38) dikeluarkan.

#data model Depresi X Game Online
model_SEM <- constructs(composite("X1", multi_items("X1", c(1,2,3,4,6))), composite("X2", multi_items("X2", c(2,4,5,6,7,8))), composite("X3", multi_items("X3", c(3,4,5,6,7,9))), composite("Y", single_item("Y")))
#path SEm
model_SEM_PLS_Skrip <- relationships(paths(from = c("X1","X2","X3"), to = c("Y")))
#estimasi PLS
PLS_Skrip <- estimate_pls(data=data, measurement_model = model_SEM, structural_model = model_SEM_PLS_Skrip)
## Generating the seminr model
## All 97 observations are valid.
pls_model_Skrip <- summary(PLS_Skrip)
PLS_Skrip$construct_scores
##                 X1          X2          X3          Y
##  [1,] -0.252592036  0.34712914  0.98264341  0.1067147
##  [2,] -0.181054481  0.60254383  1.21595914  0.1067147
##  [3,] -0.476928584 -0.91506259  0.04117420  0.1067147
##  [4,]  0.179391485 -2.10401526 -0.42960631  0.1067147
##  [5,]  0.152220633 -1.42028370  0.54772767  0.1067147
##  [6,] -0.715308732 -0.26196094  0.21820873  0.1067147
##  [7,] -1.395727116 -0.57067637  0.21820873  0.1067147
##  [8,]  0.859809870  0.03524541  0.33756275  0.1067147
##  [9,]  0.349796400  0.18625057  0.39524326 -1.1872010
## [10,] -0.205295262  0.23955131  0.67086760  0.1067147
## [11,] -1.225322201 -1.18620976  1.25827321  0.1067147
## [12,]  0.179391485  0.45095444  1.21595914  0.1067147
## [13,] -2.304613398 -2.55222678  0.03360684 -1.1872010
## [14,]  0.002494176 -0.05700112 -1.89503523  0.1067147
## [15,] -1.457352419  0.59038083 -0.05110320  0.1067147
## [16,] -0.429489345 -1.15786098 -1.28597606  0.1067147
## [17,]  0.573990484  0.64375126  1.21595914  1.4006304
## [18,]  0.859809870  1.10405608  1.63010076  1.4006304
## [19,] -0.538411422 -3.00755968  0.09001947  0.1067147
## [20,] -0.283325211 -0.26196094  0.21820873  1.4006304
## [21,] -0.082187121  1.10405608 -1.36166558 -1.1872010
## [22,] -1.001128118  0.60254383  0.71708666  1.4006304
## [23,]  0.002494176  0.62801878  0.60426384  0.1067147
## [24,] -0.793338680 -0.05062751 -1.68603002  0.1067147
## [25,] -1.827710637 -1.88339265 -1.86306455 -1.1872010
## [26,]  0.397093174 -2.06852753 -1.33597112  0.1067147
## [27,]  0.179391485 -0.02449863 -1.01412772  0.1067147
## [28,] -3.579726548 -2.59623834 -2.20175627 -2.4811168
## [29,] -3.688648625 -2.54578347 -4.01746735 -2.4811168
## [30,]  0.226688259  0.13579571 -1.23737586  0.1067147
## [31,] -0.106427901  0.20191336 -0.85132075  0.1067147
## [32,] -0.824230808  0.23955131 -0.70903292 -1.1872010
## [33,] -2.545513545 -2.99399499 -2.60557532 -2.4811168
## [34,]  0.512507645 -0.06916412 -1.19368329 -1.1872010
## [35,]  0.512507645  1.10405608  1.37876611  0.1067147
## [36,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [37,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [38,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [39,]  0.859809870  0.60254383  0.63235035  0.1067147
## [40,]  0.859809870  0.62801878  0.95419375  1.4006304
## [41,] -0.538411422 -0.78060737  0.21820873  0.1067147
## [42,] -0.283325211 -0.26196094  0.38101570  1.4006304
## [43,] -0.082187121  1.10405608 -1.69396053 -1.1872010
## [44,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [45,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [46,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [47,]  0.859809870  0.60254383  0.63235035  0.1067147
## [48,]  0.859809870  0.62801878  0.95419375  1.4006304
## [49,] -1.001128118  0.60254383  0.63235035  1.4006304
## [50,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [51,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [52,]  0.859809870  1.10405608  0.21820873  0.1067147
## [53,]  0.859809870  0.60254383  0.63235035  0.1067147
## [54,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [55,]  0.002494176  0.62801878  0.95419375  0.1067147
## [56,] -0.538411422 -0.78060737  0.21820873  0.1067147
## [57,] -0.283325211 -0.26196094  0.38101570  1.4006304
## [58,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [59,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [60,]  0.859809870  0.62801878  0.95419375  1.4006304
## [61,]  0.859809870  0.60254383  0.63235035  0.1067147
## [62,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [63,]  0.859809870  0.62801878  0.95419375  1.4006304
## [64,]  0.512507645 -0.26196094  0.38101570  0.1067147
## [65,]  0.859809870  1.10405608  0.21820873  0.1067147
## [66,]  0.859809870  0.60254383  0.63235035  0.1067147
## [67,]  0.859809870  0.62801878  0.95419375  1.4006304
## [68,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [69,]  0.512507645 -0.26196094  0.38101570  0.1067147
## [70,]  0.859809870  1.10405608  0.21820873  0.1067147
## [71,]  0.859809870  0.60254383  0.63235035  0.1067147
## [72,]  0.859809870  0.62801878  0.95419375  1.4006304
## [73,] -1.001128118 -0.65971759 -0.57052110 -2.4811168
## [74,]  0.512507645 -0.26196094  0.38101570  0.1067147
## [75,]  0.859809870  1.10405608  0.21820873  0.1067147
## [76,]  0.859809870  0.60254383  0.63235035  0.1067147
## [77,]  0.859809870  0.62801878  0.95419375  1.4006304
## [78,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [79,]  0.859809870  0.62801878  0.95419375  1.4006304
## [80,]  0.859809870  0.62801878  0.95419375  1.4006304
## [81,]  0.859809870  0.60254383  0.63235035  0.1067147
## [82,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [83,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [84,] -1.001128118 -0.65971759 -0.57052110 -2.4811168
## [85,]  0.859809870  1.10405608  0.21820873  0.1067147
## [86,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [87,]  0.859809870  0.62801878  0.95419375  1.4006304
## [88,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [89,]  0.859809870  0.62801878  0.95419375  1.4006304
## [90,]  0.859809870  1.10405608  0.21820873  0.1067147
## [91,] -1.490463129 -3.26507246 -2.12469550  0.1067147
## [92,]  0.859809870  0.62801878  0.95419375  1.4006304
## [93,]  0.859809870 -0.20221690  0.21820873  0.1067147
## [94,] -0.824230808  0.23955131 -0.85384179 -1.1872010
## [95,]  0.859809870  1.10405608  0.21820873  0.1067147
## [96,]  0.859809870  0.62801878  0.95419375  1.4006304
## [97,]  0.859809870  1.10405608  0.21820873  0.1067147

#setelah model pls didapatkan maka kita akan melakukan uji validitas data outer loading 4

pls_model_Skrip$loadings
##        X1    X2    X3     Y
## X11 0.903 0.000 0.000 0.000
## X12 0.894 0.000 0.000 0.000
## X13 0.839 0.000 0.000 0.000
## X14 0.899 0.000 0.000 0.000
## X16 0.551 0.000 0.000 0.000
## X22 0.000 0.770 0.000 0.000
## X24 0.000 0.900 0.000 0.000
## X25 0.000 0.815 0.000 0.000
## X26 0.000 0.773 0.000 0.000
## X27 0.000 0.846 0.000 0.000
## X28 0.000 0.666 0.000 0.000
## X33 0.000 0.000 0.724 0.000
## X34 0.000 0.000 0.769 0.000
## X35 0.000 0.000 0.838 0.000
## X36 0.000 0.000 0.818 0.000
## X37 0.000 0.000 0.711 0.000
## X39 0.000 0.000 0.661 0.000
## Y   0.000 0.000 0.000 1.000
pls_model_Skrip$validity
## $vif_items
## X1 :
##   X11   X12   X13   X14   X16 
## 2.971 3.191 2.605 3.398 1.477 
## 
## X2 :
##   X22   X24   X25   X26   X27   X28 
## 2.287 2.521 2.663 2.162 2.835 1.798 
## 
## X3 :
##   X33   X34   X35   X36   X37   X39 
## 2.872 2.830 2.769 2.631 1.442 1.531 
## 
## Y :
## Y 
## 1 
## 
## 
## $htmt
##       X1    X2    X3 Y
## X1     .     .     . .
## X2 0.704     .     . .
## X3 0.737 0.577     . .
## Y  0.652 0.343 0.746 .
## 
## $fl_criteria
##       X1    X2    X3     Y
## X1 0.828     .     .     .
## X2 0.630 0.798     .     .
## X3 0.664 0.527 0.756     .
## Y  0.630 0.384 0.718 1.000
## 
## FL Criteria table reports square root of AVE on the diagonal and construct correlations on the lower triangle.
## 
## $cross_loadings
##        X1    X2    X3     Y
## X11 0.903 0.557 0.591 0.653
## X12 0.894 0.592 0.566 0.530
## X13 0.839 0.412 0.558 0.542
## X14 0.899 0.612 0.667 0.521
## X16 0.551 0.466 0.301 0.268
## X22 0.417 0.770 0.269 0.239
## X24 0.667 0.900 0.557 0.486
## X25 0.478 0.815 0.405 0.264
## X26 0.417 0.773 0.417 0.259
## X27 0.507 0.846 0.454 0.247
## X28 0.446 0.666 0.286 0.070
## X33 0.503 0.442 0.724 0.429
## X34 0.413 0.375 0.769 0.402
## X35 0.579 0.437 0.838 0.634
## X36 0.414 0.408 0.818 0.445
## X37 0.512 0.304 0.711 0.672
## X39 0.524 0.438 0.661 0.539
## Y   0.630 0.384 0.718 1.000

karena seluruh nilai loading sudah berada diatas atau lebih dari sama dengan 0,7 maka kita lanjut ke metode selanjunya

#uji reliabilitas

pls_model_Skrip$reliability
##    alpha  rhoC   AVE  rhoA
## X1 0.880 0.914 0.686 0.922
## X2 0.891 0.913 0.638 0.995
## X3 0.850 0.888 0.572 0.860
## Y  1.000 1.000 1.000 1.000
## 
## Alpha, rhoC, and rhoA should exceed 0.7 while AVE should exceed 0.5
pls_model_Skrip$paths
##             Y
## R^2     0.567
## AdjR^2  0.553
## X1      0.335
## X2     -0.123
## X3      0.561

Nilai Uji Coba Resampling

#test 1
boot_skrip1 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 20, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls1 <- summary(boot_skrip1)
boot_pls1$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.307        0.122   2.738   0.126    0.518
## X2  ->  Y        -0.123         -0.086        0.074  -1.662  -0.215    0.022
## X3  ->  Y         0.561          0.558        0.075   7.519   0.432    0.675
print("resampling 20")
## [1] "resampling 20"
#test 2
boot_skrip2 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 40, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls2 <- summary(boot_skrip2)
boot_pls2$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.342        0.123   2.729   0.135    0.544
## X2  ->  Y        -0.123         -0.111        0.086  -1.436  -0.253    0.044
## X3  ->  Y         0.561          0.554        0.076   7.348   0.424    0.690
print("resampling 40")
## [1] "resampling 40"
#test 3
boot_skrip3 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 60, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls3 <- summary(boot_skrip3)
boot_pls3$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.327        0.121   2.756   0.109    0.572
## X2  ->  Y        -0.123         -0.111        0.094  -1.308  -0.275    0.050
## X3  ->  Y         0.561          0.567        0.078   7.147   0.422    0.709
print("resampling 60")
## [1] "resampling 60"
#test 4
boot_skrip4 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 80, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls4 <- summary(boot_skrip4)
boot_pls4$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.325        0.115   2.906   0.110    0.544
## X2  ->  Y        -0.123         -0.113        0.094  -1.304  -0.276    0.044
## X3  ->  Y         0.561          0.569        0.077   7.280   0.419    0.701
print("resampling 80")
## [1] "resampling 80"
#test 5
boot_skrip5 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 100, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls5 <- summary(boot_skrip5)
boot_pls5$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.330        0.109   3.072   0.113    0.535
## X2  ->  Y        -0.123         -0.119        0.089  -1.383  -0.271    0.042
## X3  ->  Y         0.561          0.569        0.078   7.167   0.422    0.709
print("resampling 100")
## [1] "resampling 100"
#test 6
boot_skrip6 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 120, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls6 <- summary(boot_skrip6)
boot_pls6$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.330        0.111   3.003   0.110    0.526
## X2  ->  Y        -0.123         -0.118        0.095  -1.290  -0.284    0.044
## X3  ->  Y         0.561          0.568        0.081   6.909   0.424    0.717
print("resampling 120")
## [1] "resampling 120"
#test 7
boot_skrip7 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 140, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls7 <- summary(boot_skrip7)
boot_pls7$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.327        0.116   2.891   0.106    0.562
## X2  ->  Y        -0.123         -0.116        0.099  -1.239  -0.287    0.050
## X3  ->  Y         0.561          0.568        0.085   6.611   0.406    0.720
print("resampling 140")
## [1] "resampling 140"
#test 8
boot_skrip8 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 160, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls8 <- summary(boot_skrip8)
boot_pls8$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.334        0.113   2.966   0.110    0.544
## X2  ->  Y        -0.123         -0.117        0.098  -1.252  -0.291    0.057
## X3  ->  Y         0.561          0.563        0.085   6.628   0.394    0.717
print("resampling 160")
## [1] "resampling 160"
#test 9
boot_skrip9 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 180, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls9 <- summary(boot_skrip9)
boot_pls9$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.331        0.112   2.986   0.113    0.537
## X2  ->  Y        -0.123         -0.111        0.101  -1.214  -0.293    0.082
## X3  ->  Y         0.561          0.562        0.084   6.680   0.400    0.714
print("resampling 180")
## [1] "resampling 180"
#test 10
boot_skrip10 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 200, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls10 <- summary(boot_skrip10)
boot_pls10$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.331        0.114   2.939   0.105    0.544
## X2  ->  Y        -0.123         -0.111        0.101  -1.220  -0.291    0.082
## X3  ->  Y         0.561          0.562        0.083   6.762   0.406    0.711
print("resampling 200")
## [1] "resampling 200"
#test 11
boot_skrip11 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 220, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls11 <- summary(boot_skrip11)
boot_pls11$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.331        0.117   2.859   0.103    0.571
## X2  ->  Y        -0.123         -0.113        0.100  -1.228  -0.293    0.077
## X3  ->  Y         0.561          0.563        0.086   6.561   0.400    0.714
print("resampling 220")
## [1] "resampling 220"
#test 12
boot_skrip12 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 240, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls12 <- summary(boot_skrip12)
boot_pls12$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.329        0.117   2.868   0.102    0.570
## X2  ->  Y        -0.123         -0.108        0.102  -1.199  -0.291    0.084
## X3  ->  Y         0.561          0.563        0.086   6.544   0.406    0.714
print("resampling 240")
## [1] "resampling 240"
#test 13
boot_skrip13 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 260, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls13 <- summary(boot_skrip13)
boot_pls13$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.327        0.115   2.904   0.103    0.557
## X2  ->  Y        -0.123         -0.108        0.101  -1.221  -0.287    0.082
## X3  ->  Y         0.561          0.565        0.084   6.655   0.409    0.712
print("resampling 260")
## [1] "resampling 260"
#test 14
boot_skrip14 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 280, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls14 <- summary(boot_skrip14)
boot_pls14$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.327        0.115   2.903   0.105    0.570
## X2  ->  Y        -0.123         -0.108        0.101  -1.216  -0.291    0.083
## X3  ->  Y         0.561          0.566        0.083   6.775   0.412    0.711
print("resampling 280")
## [1] "resampling 280"
#test 15
boot_skrip15 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 300, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls15 <- summary(boot_skrip15)
boot_pls15$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.329        0.117   2.861   0.103    0.571
## X2  ->  Y        -0.123         -0.110        0.102  -1.208  -0.293    0.086
## X3  ->  Y         0.561          0.563        0.082   6.834   0.409    0.711
print("resampling 300")
## [1] "resampling 300"
#test 16
boot_skrip16 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 320, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls16 <- summary(boot_skrip16)
boot_pls16$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.331        0.117   2.868   0.102    0.570
## X2  ->  Y        -0.123         -0.111        0.101  -1.220  -0.291    0.083
## X3  ->  Y         0.561          0.563        0.081   6.901   0.412    0.710
print("resampling 320")
## [1] "resampling 320"
#test 17
boot_skrip17 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 340, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls17 <- summary(boot_skrip17)
boot_pls17$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.328        0.117   2.861   0.101    0.557
## X2  ->  Y        -0.123         -0.110        0.101  -1.215  -0.293    0.082
## X3  ->  Y         0.561          0.564        0.081   6.954   0.412    0.711
print("resampling 340")
## [1] "resampling 340"
#test 18
boot_skrip18 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 360, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls18 <- summary(boot_skrip18)
boot_pls18$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.326        0.117   2.860   0.092    0.544
## X2  ->  Y        -0.123         -0.110        0.100  -1.234  -0.291    0.082
## X3  ->  Y         0.561          0.566        0.081   6.930   0.412    0.714
print("resampling 360")
## [1] "resampling 360"
#test 19
boot_skrip19 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 380, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls19 <- summary(boot_skrip19)
boot_pls19$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.326        0.118   2.837   0.091    0.553
## X2  ->  Y        -0.123         -0.110        0.099  -1.237  -0.288    0.082
## X3  ->  Y         0.561          0.565        0.081   6.905   0.409    0.712
print("resampling 380")
## [1] "resampling 380"
#test 20
boot_skrip20 <- bootstrap_model(seminr_model = PLS_Skrip, nboot = 400, cores = 2, seed = 29)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
boot_pls20 <- summary(boot_skrip20)
boot_pls20$bootstrapped_paths
##           Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## X1  ->  Y         0.335          0.325        0.118   2.834   0.092    0.558
## X2  ->  Y        -0.123         -0.108        0.101  -1.220  -0.285    0.097
## X3  ->  Y         0.561          0.565        0.081   6.937   0.412    0.714
print("resampling 400")
## [1] "resampling 400"

Dari hasil resampling diatas di dapat nilai original estimate dan bootstrap mean paling mendekati pada resampling sebesar 160. maka digunakan resampling sebanyak 160 sebagai hasil penelitian ini