list.files()
##  [1] "~$Data Penelitian R.xlsx"                                            
##  [2] "19 Mei 2025, SEM PLS with R, Laifa"                                  
##  [3] "bang darma vicarious shame"                                          
##  [4] "dat.txt"                                                             
##  [5] "dat_pls_untuk_R.txt"                                                 
##  [6] "DATA PENELITIAN OKk.xlsx"                                            
##  [7] "Data Penelitian R.xlsx"                                              
##  [8] "KODE-R-PLS-SEM.Rmd"                                                  
##  [9] "KODE-R-PLS-SEM_files"                                                
## [10] "KODE R PLS SEM.Rmd"                                                  
## [11] "Pengaruh Destination Image terhadap Revisit Intention"               
## [12] "Pengaruh E Tourism Quality terhadap Tourist Satisfaction dan Revisit"
## [13] "project smartpls.rar"                                                
## [14] "Rizki et al revisi"                                                  
## [15] "Vicarious Shame and Brand Unfollow Behavior"                         
## [16] "Vicarious Shame and Brand Unfollow.docx"

Link referensi PLS SEM dengan R:

https://rpubs.com/Thoriqalayubi12/SEM-PLS

https://sem-in-r.github.io/seminr/

dat <- read.table("dat_pls_untuk_R.txt", header = T, sep = "\t")


dat <- as.data.frame(dat)


dat
library(seminr)
library(readxl)
library(openxlsx)
model_pengukuran <- constructs(
  composite("BI", multi_items("BI_", 1:4)),
  
  composite("SBC", multi_items("SBC_", 1:3)),
  
  composite("BO", multi_items("BO_", 1:3)),
  
  composite("VS", multi_items("VS_", 1:5)),
  
  composite("BD", multi_items("BD_", 1:6)),
  
  
  composite("UI", multi_items("UI_", 1:4)),
  
  composite("SBCxBI", single_item("BIxSBC")),
    composite("BOxVS", single_item("VSxBO"))
  
  
   # composite("SBCxBI", multi_items("BIxSBC_", 1:1)),
  
  
      #composite("BOxVS", multi_items("VSxBO_", 1:1))
  
  
  
  
  )
model_struktural <- relationships(paths(from="BI",
                                   to=c("VS","UI")),
                                   
                             paths(from="VS",
                                   to=c("BD")),
                             
                               paths(from="BD",
                                   to=c("UI")),
                                   
                                   
                                   paths(from="SBC",
                                   to=c("VS")),
                             
                             
                                   
                                   
                                   paths(from="BO",
                                   to=c("BD"))
                             
                             
                             
                                                                
                                   #paths(from="SBCxBI",
                                   #to=c("VS")),
                             
                             
                                   #paths(from="BOxVS",
                                   #to=c("BD"))
                                   
                                   

                             
                             )
hasil_PLS <- estimate_pls(data = dat,
  measurement_model = model_pengukuran,
  structural_model  = model_struktural,
  inner_weights = path_weighting,
  missing = mean_replacement,
  missing_value = "-99")
## Generating the seminr model
## All 384 observations are valid.
## Generating the seminr model
## All 344 observations are valid.
ringkasan_hasil_PLS <- summary(hasil_PLS)

ringkasan_hasil_PLS
## 
## Results from  package seminr (2.3.6)
## 
## Path Coefficients:
##           VS    UI    BD
## R^2    0.454 0.487 0.074
## AdjR^2 0.451 0.485 0.070
## BI     0.351 0.498     .
## VS         .     . 0.234
## BD         . 0.358     .
## SBC    0.543     .     .
## BO         .     . 0.059
## 
## Reliability:
##     alpha  rhoC   AVE  rhoA
## BI  0.842 0.894 0.679 0.845
## VS  0.868 0.905 0.655 0.869
## BD  0.809 0.863 0.512 0.811
## SBC 0.771 0.867 0.685 0.773
## BO  0.837 0.902 0.754 0.840
## UI  0.863 0.907 0.708 0.863
## 
## Alpha, rhoC, and rhoA should exceed 0.7 while AVE should exceed 0.5
names(ringkasan_hasil_PLS)
##  [1] "meta"                   "iterations"             "paths"                 
##  [4] "total_effects"          "total_indirect_effects" "loadings"              
##  [7] "weights"                "validity"               "reliability"           
## [10] "composite_scores"       "vif_antecedents"        "fSquare"               
## [13] "descriptives"           "it_criteria"
cetak_outer_loading <- ringkasan_hasil_PLS$loadings

cetak_outer_loading
##          BI    VS    BD   SBC    BO    UI
## BI_1  0.826 0.000 0.000 0.000 0.000 0.000
## BI_2  0.806 0.000 0.000 0.000 0.000 0.000
## BI_3  0.843 0.000 0.000 0.000 0.000 0.000
## BI_4  0.819 0.000 0.000 0.000 0.000 0.000
## SBC_1 0.000 0.000 0.000 0.834 0.000 0.000
## SBC_2 0.000 0.000 0.000 0.818 0.000 0.000
## SBC_3 0.000 0.000 0.000 0.831 0.000 0.000
## BO_1  0.000 0.000 0.000 0.000 0.870 0.000
## BO_2  0.000 0.000 0.000 0.000 0.863 0.000
## BO_3  0.000 0.000 0.000 0.000 0.872 0.000
## VS_1  0.000 0.807 0.000 0.000 0.000 0.000
## VS_2  0.000 0.829 0.000 0.000 0.000 0.000
## VS_3  0.000 0.802 0.000 0.000 0.000 0.000
## VS_4  0.000 0.807 0.000 0.000 0.000 0.000
## VS_5  0.000 0.802 0.000 0.000 0.000 0.000
## BD_1  0.000 0.000 0.731 0.000 0.000 0.000
## BD_2  0.000 0.000 0.703 0.000 0.000 0.000
## BD_3  0.000 0.000 0.704 0.000 0.000 0.000
## BD_4  0.000 0.000 0.709 0.000 0.000 0.000
## BD_5  0.000 0.000 0.708 0.000 0.000 0.000
## BD_6  0.000 0.000 0.736 0.000 0.000 0.000
## UI_1  0.000 0.000 0.000 0.000 0.000 0.858
## UI_2  0.000 0.000 0.000 0.000 0.000 0.838
## UI_3  0.000 0.000 0.000 0.000 0.000 0.828
## UI_4  0.000 0.000 0.000 0.000 0.000 0.841
ringkasan_hasil_PLS$validity
## $vif_items
## BI :
##  BI_1  BI_2  BI_3  BI_4 
## 1.874 1.764 1.897 1.860 
## 
## VS :
##  VS_1  VS_2  VS_3  VS_4  VS_5 
## 1.904 2.068 1.853 1.898 1.894 
## 
## BD :
##  BD_1  BD_2  BD_3  BD_4  BD_5  BD_6 
## 1.534 1.489 1.464 1.446 1.490 1.519 
## 
## SBC :
## SBC_1 SBC_2 SBC_3 
## 1.573 1.599 1.557 
## 
## BO :
##  BO_1  BO_2  BO_3 
## 2.013 1.987 1.889 
## 
## UI :
##  UI_1  UI_2  UI_3  UI_4 
## 2.198 2.098 1.938 2.045 
## 
## 
## $htmt
##        BI    VS    BD   SBC    BO UI
## BI      .     .     .     .     .  .
## VS  0.468     .     .     .     .  .
## BD  0.375 0.318     .     .     .  .
## SBC 0.115 0.703 0.428     .     .  .
## BO  0.324 0.688 0.236 0.606     .  .
## UI  0.714 0.309 0.613 0.348 0.205  .
## 
## $fl_criteria
##        BI    VS    BD   SBC    BO    UI
## BI  0.824     .     .     .     .     .
## VS  0.403 0.809     .     .     .     .
## BD  0.313 0.268 0.715     .     .     .
## SBC 0.096 0.576 0.338 0.828     .     .
## BO  0.275 0.588 0.196 0.487 0.868     .
## UI  0.610 0.267 0.514 0.284 0.174 0.841
## 
## FL Criteria table reports square root of AVE on the diagonal and construct correlations on the lower triangle.
## 
## $cross_loadings
##          BI    VS    BD   SBC    BO    UI
## BI_1  0.826 0.298 0.265 0.055 0.210 0.516
## BI_2  0.806 0.319 0.220 0.089 0.255 0.476
## BI_3  0.843 0.391 0.312 0.126 0.265 0.532
## BI_4  0.819 0.311 0.227 0.040 0.172 0.481
## SBC_1 0.091 0.494 0.296 0.834 0.339 0.244
## SBC_2 0.052 0.441 0.262 0.818 0.428 0.233
## SBC_3 0.092 0.493 0.280 0.831 0.444 0.228
## BO_1  0.233 0.521 0.167 0.427 0.870 0.165
## BO_2  0.207 0.496 0.161 0.402 0.863 0.128
## BO_3  0.273 0.513 0.182 0.437 0.872 0.160
## VS_1  0.330 0.807 0.226 0.457 0.492 0.221
## VS_2  0.324 0.829 0.264 0.457 0.456 0.232
## VS_3  0.338 0.802 0.203 0.480 0.513 0.241
## VS_4  0.358 0.807 0.214 0.454 0.478 0.195
## VS_5  0.276 0.802 0.177 0.486 0.436 0.190
## BD_1  0.240 0.196 0.731 0.261 0.155 0.374
## BD_2  0.227 0.146 0.703 0.213 0.108 0.349
## BD_3  0.238 0.172 0.704 0.218 0.105 0.370
## BD_4  0.197 0.180 0.709 0.265 0.164 0.386
## BD_5  0.181 0.229 0.708 0.280 0.137 0.321
## BD_6  0.257 0.224 0.736 0.218 0.167 0.399
## UI_1  0.533 0.216 0.437 0.232 0.149 0.858
## UI_2  0.499 0.259 0.406 0.245 0.160 0.838
## UI_3  0.525 0.172 0.425 0.235 0.137 0.828
## UI_4  0.494 0.255 0.462 0.244 0.142 0.841
cetak_reliabilitas <- ringkasan_hasil_PLS$reliability

cetak_reliabilitas
##     alpha  rhoC   AVE  rhoA
## BI  0.842 0.894 0.679 0.845
## VS  0.868 0.905 0.655 0.869
## BD  0.809 0.863 0.512 0.811
## SBC 0.771 0.867 0.685 0.773
## BO  0.837 0.902 0.754 0.840
## UI  0.863 0.907 0.708 0.863
## 
## Alpha, rhoC, and rhoA should exceed 0.7 while AVE should exceed 0.5
ringkasan_hasil_PLS$paths
##           VS    UI    BD
## R^2    0.454 0.487 0.074
## AdjR^2 0.451 0.485 0.070
## BI     0.351 0.498     .
## VS         .     . 0.234
## BD         . 0.358     .
## SBC    0.543     .     .
## BO         .     . 0.059
ringkasan_hasil_PLS$fSquare
##        BI    VS    BD   SBC    BO    UI
## BI  0.000 0.222 0.000 0.000 0.000 0.434
## VS  0.000 0.000 0.039 0.000 0.000 0.000
## BD  0.000 0.000 0.000 0.000 0.000 0.225
## SBC 0.000 0.532 0.000 0.000 0.000 0.000
## BO  0.000 0.000 0.002 0.000 0.000 0.000
## UI  0.000 0.000 0.000 0.000 0.000 0.000
plot(model_struktural)
plot(hasil_PLS)
plot(ringkasan_hasil_PLS$reliability)

Copyboot_corp_rep <- bootstrap_model(seminr_model = hasil_PLS,
  nboot = 1000,
  cores = NULL,
  seed = 123)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
sum_boot_corp_rep <- summary(Copyboot_corp_rep)

print(sum_boot_corp_rep$bootstrapped_paths)
##             Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI 97.5% CI
## BI  ->  VS          0.351          0.352        0.058   6.057   0.241    0.464
## BI  ->  UI          0.498          0.492        0.063   7.913   0.369    0.612
## VS  ->  BD          0.234          0.235        0.056   4.198   0.134    0.348
## BD  ->  UI          0.358          0.365        0.066   5.409   0.246    0.499
## SBC  ->  VS         0.543          0.546        0.057   9.580   0.429    0.651
## BO  ->  BD          0.059          0.063        0.047   1.258  -0.028    0.159
X <- specific_effect_significance(boot_seminr_model = Copyboot_corp_rep, 
  from = "BI", 
  through = "VS", 
  to = "BD", 
  alpha = 0.05)

print(X)
##  Original Est. Bootstrap Mean   Bootstrap SD        T Stat.        2.5% CI 
##     0.08195385     0.08267741     0.02431619     3.37034072     0.04245274 
##       97.5% CI 
##     0.13665941
X <- specific_effect_significance(boot_seminr_model = Copyboot_corp_rep, 
  from = "VS", 
  through = "BD", 
  to = "UI", 
  alpha = 0.05)

print(X)
##  Original Est. Bootstrap Mean   Bootstrap SD        T Stat.        2.5% CI 
##     0.08371870     0.08646818     0.02842429     2.94532221     0.03966043 
##       97.5% CI 
##     0.14615188
X <- specific_effect_significance(boot_seminr_model = Copyboot_corp_rep, 
  from = "BI", 
  through = c("VS","BD"), 

  to = "UI", 
  alpha = 0.05)

print(X)
##  Original Est. Bootstrap Mean   Bootstrap SD        T Stat.        2.5% CI 
##     0.02934783     0.03075531     0.01233948     2.37836796     0.01246017 
##       97.5% CI 
##     0.05961543
data_cetak <- cetak_outer_loading

data_cetak <- as.data.frame(data_cetak)

      
      wb <- openxlsx::createWorkbook()
      
      
      hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
                                   border = "Bottom")
      
      
      hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
                                   halign = "center", valign = "center", textDecoration = "bold",
                                   border = "TopBottomLeftRight")
      
      openxlsx::addWorksheet(wb, "Outer Loading", gridLines = TRUE)
      
      openxlsx::writeDataTable(wb, "Outer Loading", data_cetak, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
      
      
      
      openxlsx::openXL(wb)
data_cetak <- cetak_reliabilitas

data_cetak <- as.data.frame(data_cetak)

      
      wb <- openxlsx::createWorkbook()
      
      
      hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
                                   border = "Bottom")
      
      
      hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
                                   halign = "center", valign = "center", textDecoration = "bold",
                                   border = "TopBottomLeftRight")
      
      openxlsx::addWorksheet(wb, "Reliabilitas", gridLines = TRUE)
      
      openxlsx::writeDataTable(wb, "Reliabilitas", data_cetak, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
      
      
      
      openxlsx::openXL(wb)
hasil_htmt <- ringkasan_hasil_PLS$validity$htmt

hasil_htmt <- as.data.frame(hasil_htmt)

hasil_htmt
data_cetak <- hasil_htmt

data_cetak <- as.data.frame(data_cetak)

      
      wb <- openxlsx::createWorkbook()
      
      
      hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
                                   border = "Bottom")
      
      
      hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
                                   halign = "center", valign = "center", textDecoration = "bold",
                                   border = "TopBottomLeftRight")
      
      openxlsx::addWorksheet(wb, "HTMT", gridLines = TRUE)
      
      openxlsx::writeDataTable(wb, "HTMT", data_cetak, rowNames = TRUE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
      
      
      
      openxlsx::openXL(wb)
hasil_fl <- ringkasan_hasil_PLS$validity$fl_criteria


hasil_fl
##        BI    VS    BD   SBC    BO    UI
## BI  0.824     .     .     .     .     .
## VS  0.403 0.809     .     .     .     .
## BD  0.313 0.268 0.715     .     .     .
## SBC 0.096 0.576 0.338 0.828     .     .
## BO  0.275 0.588 0.196 0.487 0.868     .
## UI  0.610 0.267 0.514 0.284 0.174 0.841
## 
## FL Criteria table reports square root of AVE on the diagonal and construct correlations on the lower triangle.
data_cetak <- hasil_fl

data_cetak <- as.data.frame(data_cetak)

      
      wb <- openxlsx::createWorkbook()
      
      
      hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
                                   border = "Bottom")
      
      
      hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
                                   halign = "center", valign = "center", textDecoration = "bold",
                                   border = "TopBottomLeftRight")
      
      openxlsx::addWorksheet(wb, "Fornel-Larcker", gridLines = TRUE)
      
      openxlsx::writeDataTable(wb, "Fornel-Larcker", data_cetak, rowNames = TRUE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
data_cetak <- as.data.frame(data_cetak)

data_cetak
      wb <- openxlsx::createWorkbook()
      
      
      hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
                                   border = "Bottom")
      
      
      hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
                                   halign = "center", valign = "center", textDecoration = "bold",
                                   border = "TopBottomLeftRight")
      
      openxlsx::addWorksheet(wb, "Fornel-Larcker", gridLines = TRUE)
      
      openxlsx::writeDataTable(wb, "Fornel-Larcker", data_cetak, rowNames = TRUE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
      
      
      openxlsx::openXL(wb)
hasil_hipotesis <- sum_boot_corp_rep$bootstrapped_paths

hasil_hipotesis <- as.data.frame(hasil_hipotesis)


hasil_hipotesis
data_cetak <- hasil_hipotesis

      wb <- openxlsx::createWorkbook()
      
      
      hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
                                   border = "Bottom")
      
      
      hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
                                   halign = "center", valign = "center", textDecoration = "bold",
                                   border = "TopBottomLeftRight")
      
      openxlsx::addWorksheet(wb, "Hipotesis", gridLines = TRUE)
      
      openxlsx::writeDataTable(wb, "Hipotesis", data_cetak, rowNames = TRUE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
      
      
      openxlsx::openXL(wb)
hasil_fsquare <- ringkasan_hasil_PLS$fSquare

hasil_fsquare <- as.data.frame(hasil_fsquare)





data_cetak <- hasil_fsquare

      wb <- openxlsx::createWorkbook()
      
      
      hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
                                   border = "Bottom")
      
      
      hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
                                   halign = "center", valign = "center", textDecoration = "bold",
                                   border = "TopBottomLeftRight")
      
      openxlsx::addWorksheet(wb, "F-Square", gridLines = TRUE)
      
      openxlsx::writeDataTable(wb, "F-Square", data_cetak, rowNames = TRUE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
      
      
      openxlsx::openXL(wb)
model_struktural_moderasi_sbc <- relationships(
  
  
  
                                    paths(from="BI",
                                   to=c("VS")),
                                   
                            # paths(from="VS",
                                #   to=c("BD")),
                             
                              # paths(from="BD",
                                 #  to=c("UI")),
                                   
                                   
                                   paths(from="SBC",
                                   to=c("VS")),
                             
                             
                                   
                                   
                                  # paths(from="BO",
                                  # to=c("BD"))
                             
                             
                             
                                                                
                                   paths(from="SBCxBI",
                                   to=c("VS"))
                             
                             
                                   #paths(from="BOxVS",
                                   #to=c("BD"))
                                   
                                   

                             
                             )
hasil_PLS_moderasi_sbc <- estimate_pls(data = dat,
  measurement_model = model_pengukuran,
  structural_model  = model_struktural_moderasi_sbc,
  inner_weights = path_weighting,
  missing = mean_replacement,
  missing_value = "-99")
## Generating the seminr model
## All 384 observations are valid.
## Generating the seminr model
## All 344 observations are valid.
Copyboot_corp_rep <- bootstrap_model(seminr_model = hasil_PLS_moderasi_sbc,
  nboot = 1000,
  cores = NULL,
  seed = 123)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
sum_boot_corp_rep <- summary(Copyboot_corp_rep)

print(sum_boot_corp_rep$bootstrapped_paths)
##                Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI
## BI  ->  VS            -0.008          0.050        0.199  -0.039  -0.337
## SBC  ->  VS            0.186          0.240        0.211   0.881  -0.208
## SBCxBI  ->  VS         0.536          0.457        0.315   1.700  -0.111
##                97.5% CI
## BI  ->  VS        0.446
## SBC  ->  VS       0.641
## SBCxBI  ->  VS    1.095
model_struktural_moderasi_bo <- relationships(
  
  
  
                                    #paths(from="BI",
                                   #to=c("VS")),
                                   
                             paths(from="VS",
                                   to=c("BD")),
                             
                              # paths(from="BD",
                                 #  to=c("UI")),
                                   
                                   
                                   #paths(from="SBC",
                                   #to=c("VS")),
                             
                             
                                   
                                   
                                   paths(from="BO",
                                   to=c("BD")),
                             
                             
                             
                                                                
                                  # paths(from="SBCxBI",
                                  # to=c("VS"))
                             
                             
                                   paths(from="BOxVS",
                                   to=c("BD"))
                                   
                                   

                             
                             )
hasil_PLS_moderasi_bo <- estimate_pls(data = dat,
  measurement_model = model_pengukuran,
  structural_model  = model_struktural_moderasi_bo,
  inner_weights = path_weighting,
  missing = mean_replacement,
  missing_value = "-99")
## Generating the seminr model
## All 384 observations are valid.
## Generating the seminr model
## All 344 observations are valid.
Copyboot_corp_rep <- bootstrap_model(seminr_model = hasil_PLS_moderasi_bo,
  nboot = 1000,
  cores = NULL,
  seed = 123)
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
## Bootstrapping model using seminr...
## SEMinR Model successfully bootstrapped
sum_boot_corp_rep <- summary(Copyboot_corp_rep)

print(sum_boot_corp_rep$bootstrapped_paths)
##               Original Est. Bootstrap Mean Bootstrap SD T Stat. 2.5% CI
## VS  ->  BD           -0.243         -0.193        0.139  -1.744  -0.485
## BO  ->  BD           -0.680         -0.631        0.300  -2.267  -1.271
## BOxVS  ->  BD         1.113          1.035        0.393   2.831   0.324
##               97.5% CI
## VS  ->  BD       0.069
## BO  ->  BD      -0.135
## BOxVS  ->  BD    1.869