Veri setinin yüklenmesi ve düzenlenmesi

library(lavaan)
## This is lavaan 0.6-19
## lavaan is FREE software! Please report any bugs.
library(psych)
## 
## Attaching package: 'psych'
## The following object is masked from 'package:lavaan':
## 
##     cor2cov
library (tidyverse)
## ── 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() ──
## ✖ ggplot2::%+%()   masks psych::%+%()
## ✖ ggplot2::alpha() masks psych::alpha()
## ✖ 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
data("HolzingerSwineford1939")
dat<- HolzingerSwineford1939
dfa <- dat[, c("x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9")] 

Model kurulumu

model_1 <- 
  
"
 visual  =~ x1 + x2 + x3
  textual =~ x4+ x5 + x6
speed =~ x7 + x8 + x9"

Modelin test edilmesi

model_1_fit <- cfa(model_1, data = dfa)
summary(model_1_fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6-19 ended normally after 35 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        21
## 
##   Number of observations                           301
## 
## Model Test User Model:
##                                                       
##   Test statistic                                85.306
##   Degrees of freedom                                24
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                               918.852
##   Degrees of freedom                                36
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.931
##   Tucker-Lewis Index (TLI)                       0.896
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3737.745
##   Loglikelihood unrestricted model (H1)      -3695.092
##                                                       
##   Akaike (AIC)                                7517.490
##   Bayesian (BIC)                              7595.339
##   Sample-size adjusted Bayesian (SABIC)       7528.739
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.092
##   90 Percent confidence interval - lower         0.071
##   90 Percent confidence interval - upper         0.114
##   P-value H_0: RMSEA <= 0.050                    0.001
##   P-value H_0: RMSEA >= 0.080                    0.840
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.065
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               0.900    0.772
##     x2                0.554    0.100    5.554    0.000    0.498    0.424
##     x3                0.729    0.109    6.685    0.000    0.656    0.581
##   textual =~                                                            
##     x4                1.000                               0.990    0.852
##     x5                1.113    0.065   17.014    0.000    1.102    0.855
##     x6                0.926    0.055   16.703    0.000    0.917    0.838
##   speed =~                                                              
##     x7                1.000                               0.619    0.570
##     x8                1.180    0.165    7.152    0.000    0.731    0.723
##     x9                1.082    0.151    7.155    0.000    0.670    0.665
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.408    0.074    5.552    0.000    0.459    0.459
##     speed             0.262    0.056    4.660    0.000    0.471    0.471
##   textual ~~                                                            
##     speed             0.173    0.049    3.518    0.000    0.283    0.283
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.549    0.114    4.833    0.000    0.549    0.404
##    .x2                1.134    0.102   11.146    0.000    1.134    0.821
##    .x3                0.844    0.091    9.317    0.000    0.844    0.662
##    .x4                0.371    0.048    7.779    0.000    0.371    0.275
##    .x5                0.446    0.058    7.642    0.000    0.446    0.269
##    .x6                0.356    0.043    8.277    0.000    0.356    0.298
##    .x7                0.799    0.081    9.823    0.000    0.799    0.676
##    .x8                0.488    0.074    6.573    0.000    0.488    0.477
##    .x9                0.566    0.071    8.003    0.000    0.566    0.558
##     visual            0.809    0.145    5.564    0.000    1.000    1.000
##     textual           0.979    0.112    8.737    0.000    1.000    1.000
##     speed             0.384    0.086    4.451    0.000    1.000    1.000
devtools::install_github("dr-JT/semoutput")
## Skipping install of 'semoutput' from a github remote, the SHA1 (0eb4f0de) has not changed since last install.
##   Use `force = TRUE` to force installation
library(semoutput)

sem_sig(model_1_fit)
Model Significance
N χ2 df p
301  85.306 24  <0.001
fitmeasures(model_1_fit,fit.measures = c("chisq" ,"df" , "pvalue","cfi","tli","rmsea","rmsea.ci.lower",   
"rmsea.ci.upper","srmr"))
##          chisq             df         pvalue            cfi            tli 
##         85.306         24.000          0.000          0.931          0.896 
##          rmsea rmsea.ci.lower rmsea.ci.upper           srmr 
##          0.092          0.071          0.114          0.065

# ki kare anlamlı model ile veri seti arasında farklılık mevcut. CFİ yeterli, TLİ kabul edilebilir, rmsea biraz yüksek, srmr yeterli ancak esnek uyum indekslerini de inceleyelim

library(FCO)
fits.esnek <- gen_fit(mod1 = model_1, x = dfa[,1:9], rep = 500)
## Warning in pop_mod(mod = mod1, x = x, type = type, standardized =
## standardized): At least one loading is > 1. Consider revision of standardized.
flex_co(fits = fits.esnek, index = c("CFI", "SRMR"))$cutoff
##        CFI       SRMR 
## 0.95230514 0.04564984
recommend(fits.esnek)$cutoffs
##               SRMR
## cutoff 0.001 0.060
## cutoff 0.01  0.052
## cutoff 0.05  0.046
## cutoff 0.1   0.044

# Esnek uyum indeksleri incelendiğinde CFI değeri beklenenin altında çıkmış SRMR 0,001 anlamlılık düzeyinde kabul edilebilir düzeyde.

sem_factorloadings(model_1_fit,standardized = FALSE)
Factor Loadings
Latent Factor Indicator Loading 95% CI ci.upper_unstd sig SE z p Loading 95% CI ci.upper_std sig SE z p
speed x7 1.000 1.000 1.000
0.000

0.570 0.465 0.674 *** 0.053 10.714     0.000
speed x8 1.180 0.857 1.503 *** 0.165  7.152 0.000 0.723 0.624 0.822 *** 0.051 14.309     0.000
speed x9 1.082 0.785 1.378 *** 0.151  7.155 0.000 0.665 0.565 0.765 *** 0.051 13.015     0.000
textual x4 1.000 1.000 1.000
0.000

0.852 0.807 0.896 *** 0.023 37.776     0.000
textual x5 1.113 0.985 1.241 *** 0.065 17.014 0.000 0.855 0.811 0.899 *** 0.022 38.273     0.000
textual x6 0.926 0.817 1.035 *** 0.055 16.703 0.000 0.838 0.792 0.884 *** 0.023 35.881     0.000
visual x1 1.000 1.000 1.000
0.000

0.772 0.664 0.880 *** 0.055 14.041     0.000
visual x2 0.554 0.358 0.749 *** 0.100  5.554 0.000 0.424 0.307 0.540 *** 0.060  7.105 <0.001
visual x3 0.729 0.516 0.943 *** 0.109  6.685 0.000 0.581 0.473 0.689 *** 0.055 10.539     0.000
* p < .05; ** p < .01; *** p < .001
sem_factorloadings(model_1_fit,standardized = TRUE)
Factor Loadings
Latent Factor Indicator
Standardized
Loading 95% CI sig SE z p
speed x7 0.570 0.465 — 0.674 *** 0.053 10.714     0.000
speed x8 0.723 0.624 — 0.822 *** 0.051 14.309     0.000
speed x9 0.665 0.565 — 0.765 *** 0.051 13.015     0.000
textual x4 0.852 0.807 — 0.896 *** 0.023 37.776     0.000
textual x5 0.855 0.811 — 0.899 *** 0.022 38.273     0.000
textual x6 0.838 0.792 — 0.884 *** 0.023 35.881     0.000
visual x1 0.772 0.664 — 0.880 *** 0.055 14.041     0.000
visual x2 0.424 0.307 — 0.540 *** 0.060  7.105 <0.001
visual x3 0.581 0.473 — 0.689 *** 0.055 10.539     0.000
* p < .05; ** p < .01; *** p < .001

# standartlaştırılmış faktör yükleri incelendiğinde faktö yükleri yeterli ve anlamlı bulunmuş

Kestirimler

sem_factorvar(model_1_fit)
Latent Factor Variance/Residual Variance
Factor Variance Std. Variance sig p
visual 0.809 1.000 *** <0.001
textual 0.979 1.000 ***     0.000
speed 0.384 1.000 *** <0.001
fitted(model_1_fit) 
## $cov
##       x1    x2    x3    x4    x5    x6    x7    x8    x9
## x1 1.358                                                
## x2 0.448 1.382                                          
## x3 0.590 0.327 1.275                                    
## x4 0.408 0.226 0.298 1.351                              
## x5 0.454 0.252 0.331 1.090 1.660                        
## x6 0.378 0.209 0.276 0.907 1.010 1.196                  
## x7 0.262 0.145 0.191 0.173 0.193 0.161 1.183            
## x8 0.309 0.171 0.226 0.205 0.228 0.190 0.453 1.022      
## x9 0.284 0.157 0.207 0.188 0.209 0.174 0.415 0.490 1.015
resid(model_1_fit, type = "normalized")
## $type
## [1] "normalized"
## 
## $cov
##        x1     x2     x3     x4     x5     x6     x7     x8     x9
## x1  0.000                                                        
## x2 -0.493  0.000                                                 
## x3 -0.125  1.539  0.000                                          
## x4  1.159 -0.214 -1.170  0.000                                   
## x5 -0.153 -0.459 -2.606  0.070  0.000                            
## x6  0.983  0.507 -0.436 -0.130  0.048  0.000                     
## x7 -2.423 -3.273 -1.450  0.625 -0.617 -0.240  0.000              
## x8 -0.655 -0.896 -0.200 -1.162 -0.624 -0.375  1.170  0.000       
## x9  2.405  1.249  2.420  0.808  1.126  0.958 -0.625 -0.504  0.000

2.58’i gecen değerler p<0.01 için,

1.96’yı gecen değerler ise p<0.05 için anlamlıdır.

Artık varyanslar ve R’2

var(dfa$x2)
## [1] 1.38639

x2 değişkenin varyansı 1.36 olarak kestirilmiştir.

pars <- parameterEstimates(model_1_fit,standardized = TRUE)
pars[11,]
##    lhs op rhs   est    se      z pvalue ci.lower ci.upper std.lv std.all
## 11  x2 ~~  x2 1.134 0.102 11.146      0    0.934    1.333  1.134   0.821

# x2 değişkeninin açıklanmayan varyans miktarı 1.134 olarak bulunmuştur.

Faktör yüklerinden geçerlik ve güvenirlik

semTools::reliability(model_1_fit)
## Warning in semTools::reliability(model_1_fit): 
## The reliability() function was deprecated in 2022 and will cease to be included in future versions of semTools. See help('semTools-deprecated) for details.
## 
## It is replaced by the compRelSEM() function, which can estimate alpha and model-based reliability in an even wider variety of models and data types, with greater control in specifying the desired type of reliability coefficient (i.e., more explicitly choosing assumptions). 
## 
## The average variance extracted should never have been included because it is not a reliability coefficient. It is now available from the AVE() function.
##           visual   textual     speed
## alpha  0.6261171 0.8827069 0.6884550
## omega  0.6253180 0.8851754 0.6877600
## omega2 0.6253180 0.8851754 0.6877600
## omega3 0.6120052 0.8850608 0.6858417
## avevar 0.3705589 0.7210163 0.4244883

semTools paketinin reliability fonkisyonu AVE, alpha ve omega değerlerini vermektedir. omega1 ve omega2 model kovaryans modelini dikkate alır. Modifikasyon yapılmadığı durumda aynı çıkar. omega2 ilişkilendirilmiş hataları hesaba katar. omega3 ise hiyerarşik omega olarak bilinir ve gözlenenkovarynas matrisini kullanır.

 standartlaştırılmamış çözümler
library(semPlot)
semPaths(model_1_fit, what="par",
style="lisrel",layout="tree",residuals = TRUE,rotation = 2 )

standartlaştırılmış çözümler

semPaths(model_1_fit, what="std",
style="lisrel",layout="tree",residuals = TRUE,rotation = 2)

Faktorler arası korelasyon

sem_factorcor(model_1_fit)
Latent Factor Correlations
Factor Factor r 95% CI sig SE p
visual textual 0.459 0.334 — 0.584 *** 0.064 <0.001
visual speed 0.471 0.328 — 0.613 *** 0.073 <0.001
textual speed 0.283 0.148 — 0.418 *** 0.069 <0.001
* p < .05; ** p < .01; *** p < .001

Modifikasyon indeksleri

modindices(model_1_fit, sort=TRUE, standardized=FALSE) %>%  head(6)
##        lhs op rhs     mi    epc
## 30  visual =~  x9 36.411  0.577
## 76      x7 ~~  x8 34.145  0.536
## 28  visual =~  x7 18.631 -0.422
## 78      x8 ~~  x9 14.946 -0.423
## 33 textual =~  x3  9.151 -0.272
## 55      x2 ~~  x7  8.918 -0.183

# modelin yanlış tanımlandığı düşünülebilir. speed faktörünün maddeleri ile visual faktörünün maddeleri yer değiştirerek model tekrar kuralım

model_2 <- "

  
 visual  =~ x7 + x8 + x9
  textual =~ x4+ x5 + x6
speed =~ x1 + x2 + x3"

model_2_fit <- cfa(model_2, data = dfa)
sem_sig(model_2_fit)
Model Significance
N χ2 df p
301  85.306 24  <0.001
sem_fitmeasures(model_2_fit)
Model Fit
CFI RMSEA 90% CI TLI SRMR AIC BIC
0.931 0.092 0.071 — 0.114 0.896 0.065 7517.490 7595.339
flex_co(fits = fits.esnek, index = c("CFI", "SRMR", "RMSEA", "TLI"))$cutoff
##        CFI       SRMR      RMSEA        TLI 
## 0.95230514 0.04564984 0.04520126 0.92845771

#modifikasyonlar sonucu elde edilen model standart kestirim değerlerini sağlıyor ancak esnek uyum indeksleri için beklenenin biraz altında.

sem_factorloadings(model_2_fit)
Factor Loadings
Latent Factor Indicator
Standardized
Loading 95% CI sig SE z p
speed x1 0.772 0.664 — 0.880 *** 0.055 14.041     0.000
speed x2 0.424 0.307 — 0.540 *** 0.060  7.105 <0.001
speed x3 0.581 0.473 — 0.689 *** 0.055 10.539     0.000
textual x4 0.852 0.807 — 0.896 *** 0.023 37.776     0.000
textual x5 0.855 0.811 — 0.899 *** 0.022 38.273     0.000
textual x6 0.838 0.792 — 0.884 *** 0.023 35.881     0.000
visual x7 0.570 0.465 — 0.674 *** 0.053 10.714     0.000
visual x8 0.723 0.624 — 0.822 *** 0.051 14.309     0.000
visual x9 0.665 0.565 — 0.765 *** 0.051 13.015     0.000
* p < .05; ** p < .01; *** p < .001

Model karşılaştırması

anova(model_1_fit,model_2_fit )
## Warning: lavaan->lavTestLRT():  
##    some models have the same degrees of freedom
## 
## Chi-Squared Difference Test
## 
##             Df    AIC    BIC  Chisq Chisq diff RMSEA Df diff Pr(>Chisq)
## model_1_fit 24 7517.5 7595.3 85.305                                    
## model_2_fit 24 7517.5 7595.3 85.305  5.258e-13     0       0

#modeller arasında anlamlı bir farklılık yoktur.

Daha Yüksek Dereceli Faktör Modelleri

model_3 <- 
  
"
 visual  =~ x1 + x2 + x3
  textual =~ x4+ x5 + x6
speed =~ x7 + x8 + x9
 Genel zihinsel yetenek =~ visual + textual + speed"
fit_model_3 <- cfa(model_3, dfa)
## Warning: lavaan->ldw_parse_model_string():  
##    having identifiers with spaces ('Genel zihinsel yetenek') is deprecated at 
##    line 4, pos 2
##  Genel zihinsel yetenek =~ visual + textual + speed
##  ^
## Warning: lavaan->ldw_parse_model_string():  
##    having identifiers with spaces ('Genel zihinsel yetenek') is deprecated at 
##    line 4, pos 2
##  Genel zihinsel yetenek =~ visual + textual + speed
##  ^
## Warning: lavaan->ldw_parse_model_string():  
##    having identifiers with spaces ('Genel zihinsel yetenek') is deprecated at 
##    line 4, pos 2
##  Genel zihinsel yetenek =~ visual + textual + speed
##  ^
summary(fit_model_3, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6-19 ended normally after 34 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        21
## 
##   Number of observations                           301
## 
## Model Test User Model:
##                                                       
##   Test statistic                                85.306
##   Degrees of freedom                                24
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                               918.852
##   Degrees of freedom                                36
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.931
##   Tucker-Lewis Index (TLI)                       0.896
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3737.745
##   Loglikelihood unrestricted model (H1)      -3695.092
##                                                       
##   Akaike (AIC)                                7517.490
##   Bayesian (BIC)                              7595.339
##   Sample-size adjusted Bayesian (SABIC)       7528.739
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.092
##   90 Percent confidence interval - lower         0.071
##   90 Percent confidence interval - upper         0.114
##   P-value H_0: RMSEA <= 0.050                    0.001
##   P-value H_0: RMSEA >= 0.080                    0.840
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.065
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                                        Estimate  Std.Err  z-value  P(>|z|)
##   visual =~                                                               
##     x1                                    1.000                           
##     x2                                    0.554    0.100    5.554    0.000
##     x3                                    0.729    0.109    6.685    0.000
##   textual =~                                                              
##     x4                                    1.000                           
##     x5                                    1.113    0.065   17.014    0.000
##     x6                                    0.926    0.055   16.703    0.000
##   speed =~                                                                
##     x7                                    1.000                           
##     x8                                    1.180    0.165    7.152    0.000
##     x9                                    1.082    0.151    7.155    0.000
##   Genel     zihinsel        yetenek =~                                    
##     visual                                1.000                           
##     textual                               0.662    0.173    3.826    0.000
##     speed                                 0.425    0.118    3.602    0.000
##    Std.lv  Std.all
##                   
##     0.900    0.772
##     0.498    0.424
##     0.656    0.581
##                   
##     0.990    0.852
##     1.102    0.855
##     0.917    0.838
##                   
##     0.619    0.570
##     0.731    0.723
##     0.670    0.665
##                   
##     0.873    0.873
##     0.525    0.525
##     0.539    0.539
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.549    0.114    4.833    0.000    0.549    0.404
##    .x2                1.134    0.102   11.146    0.000    1.134    0.821
##    .x3                0.844    0.091    9.317    0.000    0.844    0.662
##    .x4                0.371    0.048    7.778    0.000    0.371    0.275
##    .x5                0.446    0.058    7.642    0.000    0.446    0.269
##    .x6                0.356    0.043    8.277    0.000    0.356    0.298
##    .x7                0.799    0.081    9.823    0.000    0.799    0.676
##    .x8                0.488    0.074    6.573    0.000    0.488    0.477
##    .x9                0.566    0.071    8.003    0.000    0.566    0.558
##    .visual            0.192    0.170    1.128    0.259    0.238    0.238
##    .textual           0.709    0.107    6.626    0.000    0.724    0.724
##    .speed             0.272    0.069    3.954    0.000    0.710    0.710
##     Genelzhnslytnk    0.617    0.183    3.372    0.001    1.000    1.000
sem_factorloadings(fit_model_3,standardized = TRUE)
Factor Loadings
Latent Factor Indicator
Standardized
Loading 95% CI sig SE z p
Genel zihinsel yetenek speed 0.539 0.372 — 0.706 *** 0.085  6.326 <0.001
Genel zihinsel yetenek textual 0.525 0.370 — 0.680 *** 0.079  6.625 <0.001
Genel zihinsel yetenek visual 0.873 0.648 — 1.098 *** 0.115  7.615 <0.001
speed x7 0.570 0.465 — 0.674 *** 0.053 10.714     0.000
speed x8 0.723 0.624 — 0.822 *** 0.051 14.309     0.000
speed x9 0.665 0.565 — 0.765 *** 0.051 13.015     0.000
textual x4 0.852 0.807 — 0.896 *** 0.023 37.776     0.000
textual x5 0.855 0.811 — 0.899 *** 0.022 38.273     0.000
textual x6 0.838 0.792 — 0.884 *** 0.023 35.881     0.000
visual x1 0.772 0.664 — 0.880 *** 0.055 14.041     0.000
visual x2 0.424 0.307 — 0.540 *** 0.060  7.105 <0.001
visual x3 0.581 0.473 — 0.689 *** 0.055 10.539     0.000
* p < .05; ** p < .01; *** p < .001
anova(fit_model_3, model_1, model_1_fit )
## Warning: lavaan->lavTestLRT():  
##    some models have the same degrees of freedom
## 
## Chi-Squared Difference Test
## 
##             Df    AIC    BIC  Chisq  Chisq diff RMSEA Df diff Pr(>Chisq)
## fit_model_3 24 7517.5 7595.3 85.305                                     
## model_1_fit 24 7517.5 7595.3 85.305 -1.4164e-09     0       0

Model 3 ile model 1 arasında anlamlı bir farklılık yoktur.

semPaths(fit_model_3, "std", weighted = FALSE, nCharNodes = 7, 
         shapeMan = "rectangle", sizeMan = 8, sizeMan2 = 5)

semPaths(model_1_fit, "std", weighted = FALSE, nCharNodes = 7, 
         shapeMan = "rectangle", sizeMan = 8, sizeMan2 = 5)

ÖLÇME DEĞİŞMEZLİĞİ

# okullar arasında sonuçların deüğişip değişmediğini test edelim.

olcme <- dat[, c( "school", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9")] 

Yapısal değişmezlik

fit_1 <- cfa(model_1,
           data = olcme,
           group = "school",
           # group.equal = c(),    # Şimdilik herhangi bir eşitlik kısıtlaması koymuyoruz
           estimator = "ML",
           missing = "fiml")


summary(fit_1, standardized = TRUE, fit.measures = TRUE)
## lavaan 0.6-19 ended normally after 67 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        60
## 
##   Number of observations per group:                   
##     Pasteur                                        156
##     Grant-White                                    145
##   Number of missing patterns per group:               
##     Pasteur                                          1
##     Grant-White                                      1
## 
## Model Test User Model:
##                                                       
##   Test statistic                               115.851
##   Degrees of freedom                                48
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     Pasteur                                     64.309
##     Grant-White                                 51.542
## 
## Model Test Baseline Model:
## 
##   Test statistic                               957.769
##   Degrees of freedom                                72
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.923
##   Tucker-Lewis Index (TLI)                       0.885
##                                                       
##   Robust Comparative Fit Index (CFI)             0.923
##   Robust Tucker-Lewis Index (TLI)                0.885
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3682.198
##   Loglikelihood unrestricted model (H1)      -3624.272
##                                                       
##   Akaike (AIC)                                7484.395
##   Bayesian (BIC)                              7706.822
##   Sample-size adjusted Bayesian (SABIC)       7516.536
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.097
##   90 Percent confidence interval - lower         0.075
##   90 Percent confidence interval - upper         0.120
##   P-value H_0: RMSEA <= 0.050                    0.001
##   P-value H_0: RMSEA >= 0.080                    0.897
##                                                       
##   Robust RMSEA                                   0.097
##   90 Percent confidence interval - lower         0.075
##   90 Percent confidence interval - upper         0.120
##   P-value H_0: Robust RMSEA <= 0.050             0.001
##   P-value H_0: Robust RMSEA >= 0.080             0.897
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.068
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [Pasteur]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               1.047    0.887
##     x2                0.394    0.145    2.706    0.007    0.412    0.336
##     x3                0.570    0.154    3.690    0.000    0.597    0.515
##   textual =~                                                            
##     x4                1.000                               0.946    0.823
##     x5                1.183    0.100   11.788    0.000    1.119    0.856
##     x6                0.875    0.079   11.051    0.000    0.827    0.838
##   speed =~                                                              
##     x7                1.000                               0.591    0.547
##     x8                1.125    0.260    4.323    0.000    0.665    0.682
##     x9                0.922    0.252    3.656    0.000    0.545    0.551
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.479    0.114    4.205    0.000    0.484    0.484
##     speed             0.185    0.076    2.423    0.015    0.299    0.299
##   textual ~~                                                            
##     speed             0.182    0.071    2.546    0.011    0.325    0.325
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                4.941    0.095   52.249    0.000    4.941    4.183
##    .x2                5.984    0.098   60.949    0.000    5.984    4.880
##    .x3                2.487    0.093   26.778    0.000    2.487    2.144
##    .x4                2.823    0.092   30.689    0.000    2.823    2.457
##    .x5                3.995    0.105   38.183    0.000    3.995    3.057
##    .x6                1.922    0.079   24.321    0.000    1.922    1.947
##    .x7                4.432    0.087   51.181    0.000    4.432    4.098
##    .x8                5.563    0.078   71.214    0.000    5.563    5.702
##    .x9                5.418    0.079   68.440    0.000    5.418    5.480
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.298    0.254    1.176    0.240    0.298    0.214
##    .x2                1.334    0.164    8.125    0.000    1.334    0.887
##    .x3                0.989    0.144    6.874    0.000    0.989    0.735
##    .x4                0.425    0.070    6.042    0.000    0.425    0.322
##    .x5                0.456    0.085    5.332    0.000    0.456    0.267
##    .x6                0.290    0.051    5.641    0.000    0.290    0.297
##    .x7                0.820    0.126    6.510    0.000    0.820    0.701
##    .x8                0.510    0.118    4.333    0.000    0.510    0.535
##    .x9                0.680    0.112    6.075    0.000    0.680    0.696
##     visual            1.097    0.295    3.718    0.000    1.000    1.000
##     textual           0.894    0.150    5.943    0.000    1.000    1.000
##     speed             0.350    0.127    2.749    0.006    1.000    1.000
## 
## 
## Group 2 [Grant-White]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               0.777    0.677
##     x2                0.736    0.163    4.504    0.000    0.572    0.517
##     x3                0.925    0.179    5.179    0.000    0.719    0.694
##   textual =~                                                            
##     x4                1.000                               0.971    0.866
##     x5                0.990    0.087   11.409    0.000    0.961    0.829
##     x6                0.963    0.085   11.361    0.000    0.935    0.826
##   speed =~                                                              
##     x7                1.000                               0.679    0.659
##     x8                1.226    0.172    7.110    0.000    0.833    0.796
##     x9                1.058    0.198    5.332    0.000    0.719    0.701
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.408    0.101    4.026    0.000    0.541    0.541
##     speed             0.276    0.080    3.464    0.001    0.523    0.523
##   textual ~~                                                            
##     speed             0.222    0.076    2.906    0.004    0.336    0.336
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                4.930    0.095   51.696    0.000    4.930    4.293
##    .x2                6.200    0.092   67.416    0.000    6.200    5.599
##    .x3                1.996    0.086   23.195    0.000    1.996    1.926
##    .x4                3.317    0.093   35.625    0.000    3.317    2.959
##    .x5                4.712    0.096   48.986    0.000    4.712    4.068
##    .x6                2.469    0.094   26.277    0.000    2.469    2.182
##    .x7                3.921    0.086   45.819    0.000    3.921    3.805
##    .x8                5.488    0.087   63.174    0.000    5.488    5.246
##    .x9                5.327    0.085   62.571    0.000    5.327    5.196
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.715    0.131    5.445    0.000    0.715    0.542
##    .x2                0.899    0.124    7.258    0.000    0.899    0.733
##    .x3                0.557    0.108    5.140    0.000    0.557    0.519
##    .x4                0.315    0.065    4.862    0.000    0.315    0.251
##    .x5                0.419    0.072    5.794    0.000    0.419    0.312
##    .x6                0.406    0.069    5.867    0.000    0.406    0.317
##    .x7                0.600    0.095    6.294    0.000    0.600    0.566
##    .x8                0.401    0.113    3.543    0.000    0.401    0.367
##    .x9                0.535    0.110    4.873    0.000    0.535    0.509
##     visual            0.604    0.165    3.666    0.000    1.000    1.000
##     textual           0.942    0.153    6.175    0.000    1.000    1.000
##     speed             0.461    0.121    3.804    0.000    1.000    1.000
library(semPlot)
semPaths(fit_1
         , "std", whatLabels = "std", edge.label.cex = 0.8)

# Her iki gruptada maddelerin aynı faktörlere yüklendiği görüldüğü için metrik değişmezliğe geçilebilr.

Metrik değişmezlik

fit_2 <- cfa(model_1
                  
                  ,
                  data = olcme,
                  group = "school",          # Gruplama değişkeni
                  group.equal = c("loadings"),  # Yalnızca faktör yükleri eşit kısıtlanıyor
                  estimator = "ML",
                  missing = "fiml")

# Sonuçları yazdır
summary(fit_2, standardized = TRUE, fit.measures = TRUE)
## lavaan 0.6-19 ended normally after 51 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        60
##   Number of equality constraints                     6
## 
##   Number of observations per group:                   
##     Pasteur                                        156
##     Grant-White                                    145
##   Number of missing patterns per group:               
##     Pasteur                                          1
##     Grant-White                                      1
## 
## Model Test User Model:
##                                                       
##   Test statistic                               124.044
##   Degrees of freedom                                54
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     Pasteur                                     68.825
##     Grant-White                                 55.219
## 
## Model Test Baseline Model:
## 
##   Test statistic                               957.769
##   Degrees of freedom                                72
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.921
##   Tucker-Lewis Index (TLI)                       0.895
##                                                       
##   Robust Comparative Fit Index (CFI)             0.921
##   Robust Tucker-Lewis Index (TLI)                0.895
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3686.294
##   Loglikelihood unrestricted model (H1)      -3624.272
##                                                       
##   Akaike (AIC)                                7480.587
##   Bayesian (BIC)                              7680.771
##   Sample-size adjusted Bayesian (SABIC)       7509.514
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.093
##   90 Percent confidence interval - lower         0.071
##   90 Percent confidence interval - upper         0.114
##   P-value H_0: RMSEA <= 0.050                    0.001
##   P-value H_0: RMSEA >= 0.080                    0.845
##                                                       
##   Robust RMSEA                                   0.093
##   90 Percent confidence interval - lower         0.071
##   90 Percent confidence interval - upper         0.114
##   P-value H_0: Robust RMSEA <= 0.050             0.001
##   P-value H_0: Robust RMSEA >= 0.080             0.845
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.072
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [Pasteur]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               0.897    0.771
##     x2      (.p2.)    0.599    0.112    5.327    0.000    0.537    0.432
##     x3      (.p3.)    0.784    0.121    6.508    0.000    0.704    0.600
##   textual =~                                                            
##     x4                1.000                               0.956    0.823
##     x5      (.p5.)    1.083    0.067   16.077    0.000    1.035    0.824
##     x6      (.p6.)    0.912    0.059   15.410    0.000    0.871    0.860
##   speed =~                                                              
##     x7                1.000                               0.552    0.514
##     x8      (.p8.)    1.201    0.143    8.380    0.000    0.663    0.679
##     x9      (.p9.)    1.038    0.164    6.331    0.000    0.573    0.577
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.416    0.108    3.843    0.000    0.485    0.485
##     speed             0.169    0.065    2.604    0.009    0.340    0.340
##   textual ~~                                                            
##     speed             0.176    0.062    2.855    0.004    0.333    0.333
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                4.941    0.093   52.991    0.000    4.941    4.243
##    .x2                5.984    0.100   60.096    0.000    5.984    4.812
##    .x3                2.487    0.094   26.465    0.000    2.487    2.119
##    .x4                2.823    0.093   30.371    0.000    2.823    2.432
##    .x5                3.995    0.101   39.714    0.000    3.995    3.180
##    .x6                1.922    0.081   23.711    0.000    1.922    1.898
##    .x7                4.432    0.086   51.540    0.000    4.432    4.126
##    .x8                5.563    0.078   71.088    0.000    5.563    5.692
##    .x9                5.418    0.079   68.153    0.000    5.418    5.457
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.551    0.151    3.647    0.000    0.551    0.406
##    .x2                1.258    0.157    8.009    0.000    1.258    0.813
##    .x3                0.882    0.133    6.636    0.000    0.882    0.640
##    .x4                0.434    0.072    6.006    0.000    0.434    0.322
##    .x5                0.508    0.085    5.980    0.000    0.508    0.322
##    .x6                0.266    0.052    5.139    0.000    0.266    0.260
##    .x7                0.849    0.116    7.305    0.000    0.849    0.736
##    .x8                0.515    0.100    5.128    0.000    0.515    0.539
##    .x9                0.658    0.102    6.475    0.000    0.658    0.667
##     visual            0.805    0.186    4.325    0.000    1.000    1.000
##     textual           0.913    0.138    6.619    0.000    1.000    1.000
##     speed             0.305    0.080    3.816    0.000    1.000    1.000
## 
## 
## Group 2 [Grant-White]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               0.850    0.727
##     x2      (.p2.)    0.599    0.112    5.327    0.000    0.509    0.466
##     x3      (.p3.)    0.784    0.121    6.508    0.000    0.667    0.651
##   textual =~                                                            
##     x4                1.000                               0.952    0.857
##     x5      (.p5.)    1.083    0.067   16.077    0.000    1.031    0.857
##     x6      (.p6.)    0.912    0.059   15.410    0.000    0.868    0.795
##   speed =~                                                              
##     x7                1.000                               0.689    0.665
##     x8      (.p8.)    1.201    0.143    8.380    0.000    0.828    0.793
##     x9      (.p9.)    1.038    0.164    6.331    0.000    0.715    0.700
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.437    0.100    4.382    0.000    0.540    0.540
##     speed             0.314    0.081    3.889    0.000    0.536    0.536
##   textual ~~                                                            
##     speed             0.226    0.074    3.049    0.002    0.345    0.345
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                4.930    0.097   50.763    0.000    4.930    4.216
##    .x2                6.200    0.091   68.379    0.000    6.200    5.679
##    .x3                1.996    0.085   23.455    0.000    1.996    1.948
##    .x4                3.317    0.092   35.950    0.000    3.317    2.985
##    .x5                4.712    0.100   47.173    0.000    4.712    3.918
##    .x6                2.469    0.091   27.248    0.000    2.469    2.263
##    .x7                3.921    0.086   45.555    0.000    3.921    3.783
##    .x8                5.488    0.087   63.257    0.000    5.488    5.253
##    .x9                5.327    0.085   62.786    0.000    5.327    5.214
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.645    0.127    5.073    0.000    0.645    0.472
##    .x2                0.933    0.124    7.532    0.000    0.933    0.783
##    .x3                0.605    0.103    5.902    0.000    0.605    0.577
##    .x4                0.329    0.064    5.173    0.000    0.329    0.266
##    .x5                0.384    0.073    5.281    0.000    0.384    0.265
##    .x6                0.437    0.068    6.426    0.000    0.437    0.367
##    .x7                0.599    0.093    6.414    0.000    0.599    0.558
##    .x8                0.406    0.104    3.912    0.000    0.406    0.372
##    .x9                0.532    0.102    5.215    0.000    0.532    0.510
##     visual            0.722    0.159    4.538    0.000    1.000    1.000
##     textual           0.906    0.138    6.570    0.000    1.000    1.000
##     speed             0.475    0.112    4.256    0.000    1.000    1.000
library(semPlot)
semPaths(fit_2, "std", whatLabels = "std", edge.label.cex = 0.8)

#standartlaştırılmış aldığımız için farklı çıktı katsayılar

semPaths(fit_2, "par", whatLabels = "par", edge.label.cex = 0.8)

#Metrik model, zorlanmış faktör yükleri ile birlikte iki grup (Pasteur, Grant-White) için kısmen kabul edilebilir bir uyum göstermektedir, ancak TLI ve RMSEA biraz zayıftır.

Bu noktada, katı modele geçmeden önce modifikasyon indeksleri, model iyileştirmeleri ve özellikle veri yapısının teoriyle uyumu da göz önünde bulundurulmalıdır.

Ölçek değişmezlik

fit_3 <- cfa(model_1,
                 data = olcme
                 ,
                 group = "school",              
                 group.equal = c("loadings", "intercepts"),  # Yüklemeler ve sabit terimler eşit
                 estimator = "ML",
                 missing = "fiml")

# Sonuçları yazdır
summary(fit_3, standardized = TRUE, fit.measures = TRUE)
## lavaan 0.6-19 ended normally after 60 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        63
##   Number of equality constraints                    15
## 
##   Number of observations per group:                   
##     Pasteur                                        156
##     Grant-White                                    145
##   Number of missing patterns per group:               
##     Pasteur                                          1
##     Grant-White                                      1
## 
## Model Test User Model:
##                                                       
##   Test statistic                               164.103
##   Degrees of freedom                                60
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     Pasteur                                     90.210
##     Grant-White                                 73.892
## 
## Model Test Baseline Model:
## 
##   Test statistic                               957.769
##   Degrees of freedom                                72
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.882
##   Tucker-Lewis Index (TLI)                       0.859
##                                                       
##   Robust Comparative Fit Index (CFI)             0.882
##   Robust Tucker-Lewis Index (TLI)                0.859
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3706.323
##   Loglikelihood unrestricted model (H1)      -3624.272
##                                                       
##   Akaike (AIC)                                7508.647
##   Bayesian (BIC)                              7686.588
##   Sample-size adjusted Bayesian (SABIC)       7534.359
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.107
##   90 Percent confidence interval - lower         0.088
##   90 Percent confidence interval - upper         0.127
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.989
##                                                       
##   Robust RMSEA                                   0.107
##   90 Percent confidence interval - lower         0.088
##   90 Percent confidence interval - upper         0.127
##   P-value H_0: Robust RMSEA <= 0.050             0.000
##   P-value H_0: Robust RMSEA >= 0.080             0.989
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.082
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [Pasteur]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               0.892    0.768
##     x2      (.p2.)    0.576    0.109    5.262    0.000    0.514    0.411
##     x3      (.p3.)    0.798    0.130    6.140    0.000    0.712    0.591
##   textual =~                                                            
##     x4                1.000                               0.938    0.815
##     x5      (.p5.)    1.120    0.066   16.962    0.000    1.050    0.829
##     x6      (.p6.)    0.932    0.057   16.315    0.000    0.874    0.862
##   speed =~                                                              
##     x7                1.000                               0.568    0.516
##     x8      (.p8.)    1.130    0.137    8.258    0.000    0.641    0.657
##     x9      (.p9.)    1.009    0.160    6.325    0.000    0.573    0.578
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.410    0.107    3.844    0.000    0.490    0.490
##     speed             0.178    0.067    2.657    0.008    0.351    0.351
##   textual ~~                                                            
##     speed             0.180    0.063    2.867    0.004    0.338    0.338
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1      (.25.)    5.001    0.092   54.423    0.000    5.001    4.302
##    .x2      (.26.)    6.151    0.079   77.428    0.000    6.151    4.925
##    .x3      (.27.)    2.271    0.089   25.636    0.000    2.271    1.885
##    .x4      (.28.)    2.778    0.087   31.956    0.000    2.778    2.413
##    .x5      (.29.)    4.035    0.097   41.681    0.000    4.035    3.184
##    .x6      (.30.)    1.926    0.079   24.409    0.000    1.926    1.900
##    .x7      (.31.)    4.242    0.077   55.383    0.000    4.242    3.855
##    .x8      (.32.)    5.630    0.073   77.378    0.000    5.630    5.771
##    .x9      (.33.)    5.465    0.070   78.027    0.000    5.465    5.516
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.555    0.157    3.539    0.000    0.555    0.411
##    .x2                1.296    0.161    8.071    0.000    1.296    0.831
##    .x3                0.944    0.148    6.399    0.000    0.944    0.650
##    .x4                0.445    0.072    6.209    0.000    0.445    0.336
##    .x5                0.502    0.086    5.859    0.000    0.502    0.313
##    .x6                0.263    0.051    5.124    0.000    0.263    0.256
##    .x7                0.888    0.127    7.006    0.000    0.888    0.734
##    .x8                0.541    0.099    5.483    0.000    0.541    0.568
##    .x9                0.654    0.101    6.476    0.000    0.654    0.666
##     visual            0.796    0.192    4.146    0.000    1.000    1.000
##     textual           0.879    0.132    6.654    0.000    1.000    1.000
##     speed             0.322    0.085    3.786    0.000    1.000    1.000
## 
## 
## Group 2 [Grant-White]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               0.841    0.721
##     x2      (.p2.)    0.576    0.109    5.262    0.000    0.484    0.442
##     x3      (.p3.)    0.798    0.130    6.140    0.000    0.672    0.643
##   textual =~                                                            
##     x4                1.000                               0.933    0.847
##     x5      (.p5.)    1.120    0.066   16.962    0.000    1.045    0.862
##     x6      (.p6.)    0.932    0.057   16.315    0.000    0.869    0.796
##   speed =~                                                              
##     x7                1.000                               0.711    0.668
##     x8      (.p8.)    1.130    0.137    8.258    0.000    0.803    0.773
##     x9      (.p9.)    1.009    0.160    6.325    0.000    0.717    0.704
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.427    0.098    4.366    0.000    0.544    0.544
##     speed             0.329    0.084    3.932    0.000    0.550    0.550
##   textual ~~                                                            
##     speed             0.236    0.075    3.154    0.002    0.356    0.356
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1      (.25.)    5.001    0.092   54.423    0.000    5.001    4.286
##    .x2      (.26.)    6.151    0.079   77.428    0.000    6.151    5.618
##    .x3      (.27.)    2.271    0.089   25.636    0.000    2.271    2.174
##    .x4      (.28.)    2.778    0.087   31.956    0.000    2.778    2.522
##    .x5      (.29.)    4.035    0.097   41.681    0.000    4.035    3.330
##    .x6      (.30.)    1.926    0.079   24.409    0.000    1.926    1.763
##    .x7      (.31.)    4.242    0.077   55.383    0.000    4.242    3.991
##    .x8      (.32.)    5.630    0.073   77.378    0.000    5.630    5.422
##    .x9      (.33.)    5.465    0.070   78.027    0.000    5.465    5.369
##     visual           -0.148    0.127   -1.164    0.244   -0.176   -0.176
##     textual           0.576    0.117    4.935    0.000    0.618    0.618
##     speed            -0.177    0.094   -1.884    0.060   -0.250   -0.250
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.654    0.131    4.973    0.000    0.654    0.480
##    .x2                0.964    0.127    7.573    0.000    0.964    0.804
##    .x3                0.641    0.113    5.685    0.000    0.641    0.587
##    .x4                0.343    0.064    5.397    0.000    0.343    0.283
##    .x5                0.376    0.074    5.101    0.000    0.376    0.256
##    .x6                0.437    0.068    6.389    0.000    0.437    0.366
##    .x7                0.625    0.103    6.078    0.000    0.625    0.553
##    .x8                0.434    0.101    4.308    0.000    0.434    0.403
##    .x9                0.522    0.101    5.191    0.000    0.522    0.504
##     visual            0.708    0.162    4.382    0.000    1.000    1.000
##     textual           0.870    0.133    6.550    0.000    1.000    1.000
##     speed             0.505    0.119    4.249    0.000    1.000    1.000
library(semPlot)
semPaths(fit_3, "par", whatLabels = "par", edge.label.cex = 0.8)

#CFI ve TLI: Modeller arasında karşılaştırma yapıldığında, elde edilen CFI (0.882) ve TLI (0.859) değerleri, genellikle tatmin edici ancak katı değişmezlik için biraz daha yüksek bir uyum sağlanması tercih edilebilir. Genellikle, CFI’nin 0.90’ın üzerinde olması iyi bir uyum göstergesi olarak kabul edilir.

RMSEA: 0.107’lik RMSEA değeri, modelin çok iyi uyum sağlamadığını gösteriyor çünkü bu değer 0.08’in üzerinde ve genellikle 0.05’in altına çekilmesi beklenir.

Katı değişmezlik

fit_4 <- cfa(model_1,
                 data = olcme,
                 group = "school",              
                 group.equal = c("loadings", "intercepts","residuals"),  # Yüklemeler ve sabit terimler eşit
                 estimator = "ML",
                 missing = "fiml")

# Sonuçları yazdır
summary(fit_4, standardized = TRUE, fit.measures = TRUE)
## lavaan 0.6-19 ended normally after 59 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        63
##   Number of equality constraints                    24
## 
##   Number of observations per group:                   
##     Pasteur                                        156
##     Grant-White                                    145
##   Number of missing patterns per group:               
##     Pasteur                                          1
##     Grant-White                                      1
## 
## Model Test User Model:
##                                                       
##   Test statistic                               181.511
##   Degrees of freedom                                69
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     Pasteur                                     93.093
##     Grant-White                                 88.419
## 
## Model Test Baseline Model:
## 
##   Test statistic                               957.769
##   Degrees of freedom                                72
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.873
##   Tucker-Lewis Index (TLI)                       0.867
##                                                       
##   Robust Comparative Fit Index (CFI)             0.873
##   Robust Tucker-Lewis Index (TLI)                0.867
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3715.028
##   Loglikelihood unrestricted model (H1)      -3624.272
##                                                       
##   Akaike (AIC)                                7508.055
##   Bayesian (BIC)                              7652.632
##   Sample-size adjusted Bayesian (SABIC)       7528.947
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.104
##   90 Percent confidence interval - lower         0.086
##   90 Percent confidence interval - upper         0.123
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.984
##                                                       
##   Robust RMSEA                                   0.104
##   90 Percent confidence interval - lower         0.086
##   90 Percent confidence interval - upper         0.123
##   P-value H_0: Robust RMSEA <= 0.050             0.000
##   P-value H_0: Robust RMSEA >= 0.080             0.984
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.088
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [Pasteur]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               0.876    0.739
##     x2      (.p2.)    0.591    0.113    5.240    0.000    0.518    0.438
##     x3      (.p3.)    0.837    0.143    5.856    0.000    0.733    0.641
##   textual =~                                                            
##     x4                1.000                               0.945    0.837
##     x5      (.p5.)    1.125    0.065   17.222    0.000    1.064    0.850
##     x6      (.p6.)    0.933    0.056   16.596    0.000    0.882    0.829
##   speed =~                                                              
##     x7                1.000                               0.583    0.554
##     x8      (.p8.)    1.121    0.142    7.904    0.000    0.654    0.678
##     x9      (.p9.)    1.028    0.171    6.017    0.000    0.600    0.620
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.367    0.107    3.425    0.001    0.444    0.444
##     speed             0.174    0.066    2.628    0.009    0.341    0.341
##   textual ~~                                                            
##     speed             0.176    0.063    2.789    0.005    0.319    0.319
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1      (.25.)    5.012    0.092   54.442    0.000    5.012    4.227
##    .x2      (.26.)    6.133    0.078   78.664    0.000    6.133    5.186
##    .x3      (.27.)    2.314    0.086   26.925    0.000    2.314    2.023
##    .x4      (.28.)    2.784    0.086   32.240    0.000    2.784    2.464
##    .x5      (.29.)    4.029    0.097   41.723    0.000    4.029    3.219
##    .x6      (.30.)    1.927    0.081   23.728    0.000    1.927    1.811
##    .x7      (.31.)    4.271    0.074   57.437    0.000    4.271    4.056
##    .x8      (.32.)    5.622    0.072   78.050    0.000    5.622    5.834
##    .x9      (.33.)    5.461    0.070   77.984    0.000    5.461    5.644
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1      (.10.)    0.638    0.119    5.368    0.000    0.638    0.454
##    .x2      (.11.)    1.130    0.103   10.970    0.000    1.130    0.808
##    .x3      (.12.)    0.771    0.105    7.374    0.000    0.771    0.589
##    .x4      (.13.)    0.383    0.047    8.096    0.000    0.383    0.300
##    .x5      (.14.)    0.435    0.058    7.535    0.000    0.435    0.278
##    .x6      (.15.)    0.354    0.043    8.187    0.000    0.354    0.312
##    .x7      (.16.)    0.769    0.087    8.875    0.000    0.769    0.693
##    .x8      (.17.)    0.501    0.079    6.334    0.000    0.501    0.540
##    .x9      (.18.)    0.576    0.081    7.147    0.000    0.576    0.616
##     visual            0.767    0.173    4.443    0.000    1.000    1.000
##     textual           0.894    0.132    6.782    0.000    1.000    1.000
##     speed             0.340    0.089    3.812    0.000    1.000    1.000
## 
## 
## Group 2 [Grant-White]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual =~                                                             
##     x1                1.000                               0.810    0.712
##     x2      (.p2.)    0.591    0.113    5.240    0.000    0.479    0.411
##     x3      (.p3.)    0.837    0.143    5.856    0.000    0.678    0.611
##   textual =~                                                            
##     x4                1.000                               0.936    0.834
##     x5      (.p5.)    1.125    0.065   17.222    0.000    1.053    0.847
##     x6      (.p6.)    0.933    0.056   16.596    0.000    0.874    0.827
##   speed =~                                                              
##     x7                1.000                               0.692    0.619
##     x8      (.p8.)    1.121    0.142    7.904    0.000    0.775    0.738
##     x9      (.p9.)    1.028    0.171    6.017    0.000    0.711    0.684
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.422    0.096    4.384    0.000    0.556    0.556
##     speed             0.331    0.082    4.030    0.000    0.590    0.590
##   textual ~~                                                            
##     speed             0.236    0.075    3.161    0.002    0.364    0.364
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1      (.25.)    5.012    0.092   54.442    0.000    5.012    4.404
##    .x2      (.26.)    6.133    0.078   78.664    0.000    6.133    5.260
##    .x3      (.27.)    2.314    0.086   26.925    0.000    2.314    2.086
##    .x4      (.28.)    2.784    0.086   32.240    0.000    2.784    2.481
##    .x5      (.29.)    4.029    0.097   41.723    0.000    4.029    3.243
##    .x6      (.30.)    1.927    0.081   23.728    0.000    1.927    1.824
##    .x7      (.31.)    4.271    0.074   57.437    0.000    4.271    3.825
##    .x8      (.32.)    5.622    0.072   78.050    0.000    5.622    5.356
##    .x9      (.33.)    5.461    0.070   77.984    0.000    5.461    5.249
##     visual           -0.157    0.125   -1.258    0.208   -0.194   -0.194
##     textual           0.575    0.117    4.904    0.000    0.614    0.614
##     speed            -0.176    0.094   -1.868    0.062   -0.255   -0.255
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1      (.10.)    0.638    0.119    5.368    0.000    0.638    0.493
##    .x2      (.11.)    1.130    0.103   10.970    0.000    1.130    0.831
##    .x3      (.12.)    0.771    0.105    7.374    0.000    0.771    0.626
##    .x4      (.13.)    0.383    0.047    8.096    0.000    0.383    0.304
##    .x5      (.14.)    0.435    0.058    7.535    0.000    0.435    0.282
##    .x6      (.15.)    0.354    0.043    8.187    0.000    0.354    0.317
##    .x7      (.16.)    0.769    0.087    8.875    0.000    0.769    0.616
##    .x8      (.17.)    0.501    0.079    6.334    0.000    0.501    0.455
##    .x9      (.18.)    0.576    0.081    7.147    0.000    0.576    0.533
##     visual            0.657    0.168    3.912    0.000    1.000    1.000
##     textual           0.876    0.133    6.570    0.000    1.000    1.000
##     speed             0.478    0.119    4.013    0.000    1.000    1.000
library(semPlot)
semPaths(fit_4, "par", whatLabels = "par", edge.label.cex = 0.8)

anova(fit_1,fit_2,fit_3,fit_4)
## 
## Chi-Squared Difference Test
## 
##       Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)    
## fit_1 48 7484.4 7706.8 115.85                                           
## fit_2 54 7480.6 7680.8 124.04      8.192 0.049272       6    0.22436    
## fit_3 60 7508.6 7686.6 164.10     40.059 0.194211       6  4.435e-07 ***
## fit_4 69 7508.1 7652.6 181.51     17.409 0.078790       9    0.04269 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit <- c("chisq", "df", "pvalue","rmsea", "srmr","cfi")
fitmeasures(fit_1,fit.measures = fit)
##   chisq      df  pvalue   rmsea    srmr     cfi 
## 115.851  48.000   0.000   0.097   0.068   0.923
fitmeasures(fit_2,fit.measures = fit)
##   chisq      df  pvalue   rmsea    srmr     cfi 
## 124.044  54.000   0.000   0.093   0.072   0.921
fitmeasures(fit_3,fit.measures = fit)
##   chisq      df  pvalue   rmsea    srmr     cfi 
## 164.103  60.000   0.000   0.107   0.082   0.882
fitmeasures(fit_4,fit.measures = fit)
##   chisq      df  pvalue   rmsea    srmr     cfi 
## 181.511  69.000   0.000   0.104   0.088   0.873

Model uyum indeksleri için aşağıdaki değerler uygundur: RMSEA: < 0,05 veya 0,08 CFI: > 0,95 veya 0,90 SRMR: < 0,08 veya 0,10

Modeldeki kısıtlamalar arttıkça, özellikle fit_3 modeli, anlamlı bir iyileşme sağlıyor. Ancak fit_4’teki iyileşme daha sınırlı ve anlamlı olsa da daha düşük bir düzeyde kalıyor. Bu, modelin artık daha fazla parametre eklemek yerine mevcut yapı ile uyum sağladığını ve fazla kısıtlamalar eklemek yerine mevcut parametrelerle devam etmenin daha mantıklı olabileceğini gösteriyor.

Dolayısıyla, fit_3 (ölçek değişmezliği) modeli en uygun seçenek gibi görünüyor.