INSTALL (jalankan sekali saja)

install.packages(“readr”)

install.packages(“dplyr”)

install.packages(“plspm”)

library(readr)
## Warning: package 'readr' was built under R version 4.5.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.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(plspm)
## Warning: package 'plspm' was built under R version 4.5.3

IMPORT DATA

data <- read_csv(
"online_learning_engagement_dataset.csv"
)
## Rows: 50000 Columns: 18
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (3): gender, country, device_type
## dbl (15): student_id, age, internet_speed_mbps, study_hours_weekly, login_fr...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

PILIH VARIABEL

sem_data <- data %>%
select(

study_hours_weekly,
login_frequency_weekly,
avg_session_duration_min,
video_watch_time_min,

assignments_submitted,
forum_posts,
quiz_attempts,
attendance_rate,

engagement_score,

avg_quiz_score,
final_grade

)

INNER MODEL (BENAR)

path_matrix <- rbind(

LA   = c(0,0,0,0),
AP   = c(0,0,0,0),
ENG  = c(1,1,0,0),
PERF = c(0,0,1,0)

)

colnames(path_matrix) <-
c(
"LA",
"AP",
"ENG",
"PERF"
)

path_matrix
##      LA AP ENG PERF
## LA    0  0   0    0
## AP    0  0   0    0
## ENG   1  1   0    0
## PERF  0  0   1    0

OUTER MODEL

blocks <- list(

c(
"study_hours_weekly",
"login_frequency_weekly",
"avg_session_duration_min",
"video_watch_time_min"
),

c(
"assignments_submitted",
"forum_posts",
"quiz_attempts",
"attendance_rate"
),

c(
"engagement_score"
),

c(
"avg_quiz_score",
"final_grade"
)

)

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

JALANKAN PLS

hasil <- plspm(

Data = sem_data,
path_matrix = path_matrix,
blocks = blocks,
modes = modes

)
## Warning: Setting row names on a tibble is deprecated.

OUTPUT

cat("=== PATH COEFFICIENT ===\n")
## === PATH COEFFICIENT ===
print(hasil$path_coefs)
##              LA        AP        ENG PERF
## LA    0.0000000 0.0000000 0.00000000    0
## AP    0.0000000 0.0000000 0.00000000    0
## ENG  -0.8882082 0.4638818 0.00000000    0
## PERF  0.0000000 0.0000000 0.05029914    0
cat("\n=== OUTER MODEL ===\n")
## 
## === OUTER MODEL ===
print(hasil$outer_model)
##                        name block       weight       loading  communality
## 1        study_hours_weekly    LA  0.893626347 -0.8947208032 8.005253e-01
## 2    login_frequency_weekly    LA -0.001802545  0.0004651787 2.163912e-07
## 3  avg_session_duration_min    LA -0.004963035  0.0077276938 5.971725e-05
## 4      video_watch_time_min    LA  0.446604051 -0.4487525915 2.013789e-01
## 5     assignments_submitted    AP  0.822295001  0.8238763351 6.787722e-01
## 6               forum_posts    AP  0.005100383  0.0090628779 8.213576e-05
## 7             quiz_attempts    AP  0.566558816  0.5688503758 3.235908e-01
## 8           attendance_rate    AP  0.011398762  0.0172991273 2.992598e-04
## 9          engagement_score   ENG  1.000000000  1.0000000000 1.000000e+00
## 10           avg_quiz_score  PERF  0.002143986  0.8311390634 6.907921e-01
## 11              final_grade  PERF  0.998218762  0.9999992868 9.999986e-01
##     redundancy
## 1  0.000000000
## 2  0.000000000
## 3  0.000000000
## 4  0.000000000
## 5  0.000000000
## 6  0.000000000
## 7  0.000000000
## 8  0.000000000
## 9  0.999936680
## 10 0.001747706
## 11 0.002530000
cat("\n=== INNER MODEL ===\n")
## 
## === INNER MODEL ===
print(hasil$inner_model)
## $ENG
##                Estimate   Std. Error       t value Pr(>|t|)
## Intercept -1.930854e-16 3.558752e-05 -5.425650e-12        1
## LA        -8.882082e-01 3.558797e-05 -2.495810e+04        0
## AP         4.638818e-01 3.558797e-05  1.303479e+04        0
## 
## $PERF
##                Estimate  Std. Error       t value     Pr(>|t|)
## Intercept -3.537947e-16 0.004466564 -7.920959e-14 1.000000e+00
## ENG        5.029914e-02 0.004466564  1.126126e+01 2.211429e-29
cat("\n=== GOF ===\n")
## 
## === GOF ===
print(hasil$gof)
## [1] 0.4303844
plot(hasil)