title: “SEM Modeling of the Influence of Lecturer-Student Relationships on Students’ Academic Performance Using CFA Analysis” short-title: “Beamer Slides” author: “Gatiari Dwi Panefi, Metha Nailis Sa’adah, Anisa Khaynun Najwa” short-author: “J & M Doe” date: ‘June 06, 2025’ # 05 31, 2025 (Main Slide) short-date: ‘06/06/2025’ # 05/31/2025 (Lower Right) institute: “Universitas Negeri Surabaya” short-institute: “” department: “Fakultas Matematika dan Ilmu Pengetahuan Alam” # Institute must be defined license: “” section-titles: false # Provides slide headings safe-columns: true # Enables special latex macros for columns. output: uiucthemes::beamer_illinois — — title: “SEM Modeling of the Influence of Lecturer-Student Relationships on Students’ Academic Performance Using CFA Analysis” author: Gatiari Dwi Panefi; Metha Nailis Sa’adah; Anisa Khaynun Najwa; Brilliyanda Annisatulrohmah date: “2025-06-06” output: html_document: default pdf_document: default —

Load Dataset

df <-read.csv("dataset_uas_bersih (1).csv")
head(df,3)
##   AGE GDR UNAME DEPT INTRCT ASSIS AGOALS POSTV APER ONLIMP TotalSum OVRL SUPPO
## 1   2   1    16   15      3     3      3     4    4      3       54    1     5
## 2   2   2    16   15      2     4      3     4    3      1       52    1     4
## 3   2   2    16   15      1     3      2     3    3      1       49    1     4
##   ONLN
## 1    2
## 2    4
## 3    3

1) Data Understanding

# Load library
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.4.3
## Warning: package 'ggplot2' was built under R version 4.4.3
## Warning: package 'tibble' was built under R version 4.4.3
## Warning: package 'tidyr' was built under R version 4.4.3
## Warning: package 'readr' was built under R version 4.4.3
## Warning: package 'purrr' was built under R version 4.4.3
## Warning: package 'dplyr' was built under R version 4.4.3
## Warning: package 'stringr' was built under R version 4.4.3
## Warning: package 'forcats' was built under R version 4.4.3
## Warning: package 'lubridate' was built under R version 4.4.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.0.4     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(psych)
## Warning: package 'psych' was built under R version 4.4.3
## 
## Attaching package: 'psych'
## 
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
# Lihat struktur data
str(df)
## 'data.frame':    395 obs. of  14 variables:
##  $ AGE     : int  2 2 2 2 2 2 2 2 2 2 ...
##  $ GDR     : int  1 2 2 2 1 1 1 1 1 2 ...
##  $ UNAME   : int  16 16 16 21 8 16 16 26 6 17 ...
##  $ DEPT    : int  15 15 15 47 17 15 15 9 15 5 ...
##  $ INTRCT  : int  3 2 1 3 3 1 5 3 2 2 ...
##  $ ASSIS   : int  3 4 3 2 5 3 2 3 2 4 ...
##  $ AGOALS  : int  3 3 2 2 3 3 2 1 3 3 ...
##  $ POSTV   : int  4 4 3 4 4 3 2 2 3 4 ...
##  $ APER    : int  4 3 3 3 3 3 1 3 3 3 ...
##  $ ONLIMP  : int  3 1 1 1 1 3 3 3 3 3 ...
##  $ TotalSum: int  54 52 49 43 57 46 42 41 45 51 ...
##  $ OVRL    : int  1 1 1 2 0 2 2 2 2 1 ...
##  $ SUPPO   : int  5 4 4 3 5 3 2 3 3 3 ...
##  $ ONLN    : int  2 4 3 4 2 2 1 3 5 3 ...
# Statistik deskriptif
summary(df)
##       AGE            GDR            UNAME            DEPT          INTRCT     
##  Min.   :2.00   Min.   :1.000   Min.   : 0.00   Min.   : 0.0   Min.   :1.000  
##  1st Qu.:2.00   1st Qu.:1.000   1st Qu.:16.00   1st Qu.:15.0   1st Qu.:3.000  
##  Median :2.00   Median :1.000   Median :16.00   Median :18.0   Median :4.000  
##  Mean   :2.01   Mean   :1.309   Mean   :18.21   Mean   :22.6   Mean   :3.463  
##  3rd Qu.:2.00   3rd Qu.:2.000   3rd Qu.:20.00   3rd Qu.:29.0   3rd Qu.:4.000  
##  Max.   :3.00   Max.   :3.000   Max.   :45.00   Max.   :51.0   Max.   :5.000  
##      ASSIS           AGOALS          POSTV            APER      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:3.000   1st Qu.:3.000   1st Qu.:2.000  
##  Median :4.000   Median :3.000   Median :4.000   Median :2.000  
##  Mean   :3.395   Mean   :3.372   Mean   :3.552   Mean   :2.603  
##  3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:3.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000  
##      ONLIMP         TotalSum          OVRL           SUPPO      
##  Min.   :1.000   Min.   :27.00   Min.   :0.000   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:43.00   1st Qu.:0.000   1st Qu.:3.000  
##  Median :2.000   Median :53.00   Median :1.000   Median :4.000  
##  Mean   :2.314   Mean   :50.07   Mean   :1.167   Mean   :3.299  
##  3rd Qu.:3.000   3rd Qu.:57.00   3rd Qu.:2.000   3rd Qu.:4.000  
##  Max.   :5.000   Max.   :65.00   Max.   :3.000   Max.   :5.000  
##       ONLN      
##  Min.   :1.000  
##  1st Qu.:2.000  
##  Median :3.000  
##  Mean   :2.724  
##  3rd Qu.:3.000  
##  Max.   :5.000
# Cek missing value
colSums(is.na(df))
##      AGE      GDR    UNAME     DEPT   INTRCT    ASSIS   AGOALS    POSTV 
##        0        0        0        0        0        0        0        0 
##     APER   ONLIMP TotalSum     OVRL    SUPPO     ONLN 
##        0        0        0        0        0        0

install.packages(“tidyverse”)

2) Cek Deskriptif dan Korelasi antar Indikator

library(psych)

# Daftar semua indikator
indikator <- c("INTRCT", "ASSIS", "SUPPO",    # TeacherSupport
               "AGOALS", "POSTV", "APER",     # GoalOrientation
               "ONLN", "ONLIMP",              # OnlineLearningExp
               "TotalSum", "OVRL")            # AcademicPerformance

# Deskriptif
describe(df[indikator])
##          vars   n  mean   sd median trimmed  mad min max range  skew kurtosis
## INTRCT      1 395  3.46 1.15      4    3.55 1.48   1   5     4 -0.57    -0.52
## ASSIS       2 395  3.39 1.12      4    3.48 1.48   1   5     4 -0.64    -0.34
## SUPPO       3 395  3.30 1.18      4    3.37 1.48   1   5     4 -0.58    -0.60
## AGOALS      4 395  3.37 1.18      3    3.43 1.48   1   5     4 -0.28    -0.77
## POSTV       5 395  3.55 1.17      4    3.65 1.48   1   5     4 -0.58    -0.50
## APER        6 395  2.60 0.98      2    2.57 1.48   1   5     4  0.51    -0.10
## ONLN        7 395  2.72 1.03      3    2.71 1.48   1   5     4  0.31    -0.46
## ONLIMP      8 395  2.31 0.90      2    2.30 1.48   1   5     4 -0.04    -0.85
## TotalSum    9 395 50.07 8.90     53   50.69 7.41  27  65    38 -0.63    -0.76
## OVRL       10 395  1.17 0.96      1    1.09 1.48   0   3     3  0.49    -0.67
##            se
## INTRCT   0.06
## ASSIS    0.06
## SUPPO    0.06
## AGOALS   0.06
## POSTV    0.06
## APER     0.05
## ONLN     0.05
## ONLIMP   0.05
## TotalSum 0.45
## OVRL     0.05
# Korelasi antar indikator
cor(df[indikator], use = "complete.obs")
##               INTRCT       ASSIS        SUPPO     AGOALS        POSTV
## INTRCT    1.00000000  0.51607567  0.495608854  0.4857521  0.452059477
## ASSIS     0.51607567  1.00000000  0.493156549  0.4255121  0.449788847
## SUPPO     0.49560885  0.49315655  1.000000000  0.4942149  0.521719999
## AGOALS    0.48575206  0.42551215  0.494214869  1.0000000  0.479583198
## POSTV     0.45205948  0.44978885  0.521719999  0.4795832  1.000000000
## APER      0.19866187  0.14755251  0.151042828  0.1691870  0.118592442
## ONLN      0.24859880  0.22203786  0.180870163  0.1573818  0.143608285
## ONLIMP    0.01109519  0.04022891  0.007057476 -0.0336558  0.006172282
## TotalSum  0.68903554  0.68273201  0.710643708  0.6496873  0.684651704
## OVRL     -0.66798830 -0.65586027 -0.654392965 -0.6294986 -0.641065462
##                 APER       ONLN       ONLIMP   TotalSum       OVRL
## INTRCT    0.19866187  0.2485988  0.011095185  0.6890355 -0.6679883
## ASSIS     0.14755251  0.2220379  0.040228909  0.6827320 -0.6558603
## SUPPO     0.15104283  0.1808702  0.007057476  0.7106437 -0.6543930
## AGOALS    0.16918700  0.1573818 -0.033655796  0.6496873 -0.6294986
## POSTV     0.11859244  0.1436083  0.006172282  0.6846517 -0.6410655
## APER      1.00000000  0.4174204  0.083777242  0.4022924 -0.3528001
## ONLN      0.41742039  1.0000000  0.117840169  0.4403749 -0.4186176
## ONLIMP    0.08377724  0.1178402  1.000000000  0.1569401 -0.1636682
## TotalSum  0.40229245  0.4403749  0.156940058  1.0000000 -0.9489979
## OVRL     -0.35280007 -0.4186176 -0.163668156 -0.9489979  1.0000000

3) Exploratory Factor Analysis

# 1. Install & load paket yang diperlukan
install.packages("psych")
## Warning: package 'psych' is in use and will not be installed
library(psych)

# 2. Buat dataframe hanya dengan indikator yang digunakan
data_efa <- df[, c("INTRCT", "ASSIS", "SUPPO", "AGOALS", "POSTV", "ONLN", "TotalSum")]

# 3. Cek KMO dan Bartlett's Test
KMO(data_efa)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = data_efa)
## Overall MSA =  0.8
## MSA for each item = 
##   INTRCT    ASSIS    SUPPO   AGOALS    POSTV     ONLN TotalSum 
##     0.91     0.88     0.87     0.89     0.84     0.49     0.70
cortest.bartlett(cor(data_efa), n = nrow(data_efa))
## $chisq
## [1] 1389.309
## 
## $p.value
## [1] 1.835468e-281
## 
## $df
## [1] 21
# 4. Scree Plot untuk jumlah faktor optimal
fa.parallel(data_efa, fa = "fa")
## Warning in fa.stats(r = r, f = f, phi = phi, n.obs = n.obs, np.obs = np.obs, :
## The estimated weights for the factor scores are probably incorrect.  Try a
## different factor score estimation method.
## Warning in fac(r = r, nfactors = nfactors, n.obs = n.obs, rotate = rotate, : An
## ultra-Heywood case was detected.  Examine the results carefully

## Parallel analysis suggests that the number of factors =  2  and the number of components =  NA
# 5. Jalankan EFA (misal 3 faktor berdasarkan scree)
fa_result <- fa(data_efa, nfactors = 3, rotate = "varimax")
## Warning in fac(r = r, nfactors = nfactors, n.obs = n.obs, rotate = rotate, : An
## ultra-Heywood case was detected.  Examine the results carefully
print(fa_result$loadings)
## 
## Loadings:
##          MR1   MR3   MR2  
## INTRCT   0.429 0.890 0.135
## ASSIS    0.596 0.269 0.152
## SUPPO    0.702 0.206      
## AGOALS   0.623 0.232      
## POSTV    0.690 0.167      
## ONLN     0.127       0.847
## TotalSum 0.892 0.292 0.353
## 
##                  MR1   MR3   MR2
## SS loadings    2.708 1.083 0.898
## Proportion Var 0.387 0.155 0.128
## Cumulative Var 0.387 0.542 0.670
# 6. Lihat hasil dan interpretasi
fa.diagram(fa_result)

4) Measure Model CFA

library(lavaan)
## Warning: package 'lavaan' was built under R version 4.4.3
## This is lavaan 0.6-19
## lavaan is FREE software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
model_cfa <- '
  AcademicPerformance =~ ASSIS + SUPPO + AGOALS + POSTV
  TeacherInteraction =~ INTRCT
  OnlineLearningExperience =~ ONLN
'
fit_cfa <- cfa(model_cfa, data = df)

summary(fit_cfa, fit.measures=TRUE, standardized=TRUE)
## lavaan 0.6-19 ended normally after 22 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        13
## 
##   Number of observations                           395
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 9.189
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.327
## 
## Model Test Baseline Model:
## 
##   Test statistic                               653.678
##   Degrees of freedom                                15
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.998
##   Tucker-Lewis Index (TLI)                       0.997
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3343.075
##   Loglikelihood unrestricted model (H1)      -3338.481
##                                                       
##   Akaike (AIC)                                6712.150
##   Bayesian (BIC)                              6763.876
##   Sample-size adjusted Bayesian (SABIC)       6722.627
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.019
##   90 Percent confidence interval - lower         0.000
##   90 Percent confidence interval - upper         0.064
##   P-value H_0: RMSEA <= 0.050                    0.839
##   P-value H_0: RMSEA >= 0.080                    0.008
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.020
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                               Estimate  Std.Err  z-value  P(>|z|)   Std.lv
##   AcademicPerformance =~                                                  
##     ASSIS                        1.000                               0.759
##     SUPPO                        1.133    0.095   11.903    0.000    0.861
##     AGOALS                       1.048    0.094   11.190    0.000    0.796
##     POSTV                        1.049    0.093   11.298    0.000    0.796
##   TeacherInteraction =~                                                   
##     INTRCT                       1.000                               1.152
##   OnlineLearningExperience =~                                             
##     ONLN                         1.000                               1.030
##   Std.all
##          
##     0.679
##     0.731
##     0.674
##     0.682
##          
##     1.000
##          
##     1.000
## 
## Covariances:
##                          Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   AcademicPerformance ~~                                                      
##     TeacherIntrctn          0.615    0.068    9.091    0.000    0.703    0.703
##     OnlnLrnngExprn          0.199    0.047    4.247    0.000    0.254    0.254
##   TeacherInteraction ~~                                                       
##     OnlnLrnngExprn          0.295    0.062    4.795    0.000    0.249    0.249
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ASSIS             0.675    0.059   11.442    0.000    0.675    0.539
##    .SUPPO             0.644    0.061   10.516    0.000    0.644    0.465
##    .AGOALS            0.760    0.066   11.505    0.000    0.760    0.545
##    .POSTV             0.727    0.064   11.386    0.000    0.727    0.534
##    .INTRCT            0.000                               0.000    0.000
##    .ONLN              0.000                               0.000    0.000
##     AcademcPrfrmnc    0.576    0.082    6.992    0.000    1.000    1.000
##     TeacherIntrctn    1.327    0.094   14.053    0.000    1.000    1.000
##     OnlnLrnngExprn    1.061    0.075   14.053    0.000    1.000    1.000

5) Uji Kecocokan Model CFA

  1. Lihat Chi-square, CFI, TLI, RMSEA, confident interval, SRMR ## 6) Visualisasi Model CFA
library(lavaan)
library(semPlot)
## Warning: package 'semPlot' was built under R version 4.4.3
# Contoh model CFA sederhana
model <- '
  AcademicPerformance =~ ASSIS + SUPPO + AGOALS + POSTV
  TeacherInteraction =~ INTRCT
  OnlineLearningExperience =~ ONLN
'

fit <- cfa(model, data = df)

# Visualisasi path diagram
semPaths(fit, whatLabels = "std", layout = "tree", edge.label.cex = 1.2,
         sizeMan = 6, sizeLat = 10, residuals = FALSE,
         title = TRUE, curve = 1, nCharNodes = 0)

semPaths(fit,
         whatLabels = "std",        
         residuals = TRUE,          
         nCharNodes = 7,            
         edge.label.cex = 1.2,      
         layout = "spring",         
         color = list(lat = "lightblue", man = "pink"),
         sizeMan = 6, sizeLat = 10,
         edge.color = "black")

7) Evaluasi Validitas dan Reliabilitas Konstruk

  1. Validitas Konvergen
  2. Validitas Diskriminan
  3. Composite Reliablity
  4. Cronbach’s Alpha install.packages(“semTools”)
library(semTools)
## Warning: package 'semTools' was built under R version 4.4.3
## 
## ###############################################################################
## This is semTools 0.5-7
## All users of R (or SEM) are invited to submit functions or ideas for functions.
## ###############################################################################
## 
## Attaching package: 'semTools'
## The following objects are masked from 'package:psych':
## 
##     reliability, skew
## The following object is masked from 'package:readr':
## 
##     clipboard
# Hitung reliabilitas (alpha, omega, dll)
compRel <- compRelSEM(fit)

# Hitung AVE untuk tiap konstruk
ave <- AVE(fit)
# Tampilkan hasil reliabilitas
print(compRel)
## AcademicPerformance 
##               0.787
# Tampilkan hasil AVE
print(ave)
## AcademicPerformance 
##               0.479

8) SEM

library(lavaan)

model_sem <- '
  # Measurement model
  AcademicPerformance =~ ASSIS + SUPPO + AGOALS + POSTV
  TeacherInteraction =~ INTRCT
  OnlineLearningExperience =~ ONLN

  # Structural model
  TeacherInteraction ~ OnlineLearningExperience
  AcademicPerformance ~ TeacherInteraction
'

# Estimasi model SEM
fit_sem <- sem(model_sem, data = df, estimator = "ML")

# Ringkasan hasil
summary(fit_sem, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)
## lavaan 0.6-19 ended normally after 26 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        12
## 
##   Number of observations                           395
## 
## Model Test User Model:
##                                                       
##   Test statistic                                12.597
##   Degrees of freedom                                 9
##   P-value (Chi-square)                           0.182
## 
## Model Test Baseline Model:
## 
##   Test statistic                               653.678
##   Degrees of freedom                                15
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.994
##   Tucker-Lewis Index (TLI)                       0.991
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3344.779
##   Loglikelihood unrestricted model (H1)      -3338.481
##                                                       
##   Akaike (AIC)                                6713.559
##   Bayesian (BIC)                              6761.305
##   Sample-size adjusted Bayesian (SABIC)       6723.229
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.032
##   90 Percent confidence interval - lower         0.000
##   90 Percent confidence interval - upper         0.069
##   P-value H_0: RMSEA <= 0.050                    0.748
##   P-value H_0: RMSEA >= 0.080                    0.014
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.031
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                               Estimate  Std.Err  z-value  P(>|z|)   Std.lv
##   AcademicPerformance =~                                                  
##     ASSIS                        1.000                               0.756
##     SUPPO                        1.138    0.096   11.849    0.000    0.861
##     AGOALS                       1.054    0.094   11.157    0.000    0.797
##     POSTV                        1.055    0.094   11.271    0.000    0.798
##   TeacherInteraction =~                                                   
##     INTRCT                       1.000                               1.152
##   OnlineLearningExperience =~                                             
##     ONLN                         1.000                               1.030
##   Std.all
##          
##     0.676
##     0.732
##     0.675
##     0.684
##          
##     1.000
##          
##     1.000
## 
## Regressions:
##                         Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TeacherInteraction ~                                                       
##     OnlnLrnngExprn         0.278    0.055    5.101    0.000    0.249    0.249
##   AcademicPerformance ~                                                      
##     TeacherIntrctn         0.461    0.039   11.867    0.000    0.702    0.702
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ASSIS             0.680    0.059   11.465    0.000    0.680    0.543
##    .SUPPO             0.643    0.061   10.491    0.000    0.643    0.465
##    .AGOALS            0.758    0.066   11.476    0.000    0.758    0.544
##    .POSTV             0.724    0.064   11.346    0.000    0.724    0.532
##    .INTRCT            0.000                               0.000    0.000
##    .ONLN              0.000                               0.000    0.000
##    .AcademcPrfrmnc    0.290    0.046    6.363    0.000    0.507    0.507
##    .TeacherIntrctn    1.245    0.089   14.053    0.000    0.938    0.938
##     OnlnLrnngExprn    1.061    0.075   14.053    0.000    1.000    1.000
## 
## R-Square:
##                    Estimate
##     ASSIS             0.457
##     SUPPO             0.535
##     AGOALS            0.456
##     POSTV             0.468
##     INTRCT            1.000
##     ONLN              1.000
##     AcademcPrfrmnc    0.493
##     TeacherIntrctn    0.062

9) Uji Kecocokan Model SEM

Chi-Square, CFI, TLI, RMSEA ## 10) Visualisasi Plot SEM

library(semPlot)

semPaths(fit_sem,
         what = "path",
         whatLabels = "par",
         style = "ram",
         layout = "tree",
         rotation = 2,
         sizeMan = 7,
         sizeLat = 7,
         color = "lightblue",
         edge.label.cex = 1.2,
         label.cex = 1.3)

## 11) Interpretasi dan Kesimpulan