library(readxl) # For import dataset
library(lavaan) # For CFA models
## This is lavaan 0.6-7
## lavaan is BETA software! Please report any bugs.
library(knitr) # For printing out fancy tables
library(semPlot) # For printing out SEM plots
## Registered S3 methods overwritten by 'huge':
## method from
## plot.sim BDgraph
## print.sim BDgraph
library(semTools) # For measurement invariance
##
## ###############################################################################
## This is semTools 0.5-4
## All users of R (or SEM) are invited to submit functions or ideas for functions.
## ###############################################################################
library(equaltestMI) # For equal test
TL_ML <- read_excel("Teacher_Leadership_O.xlsx")
# Pooling out the data
TL_TeacherYear <- TL_ML[,-c(22,23,24)]
# Specify the data
TL_TeacherYear$Teacher_year <- factor(TL_TeacherYear$Teacher_year,
levels=c(1,2,3,4),
labels=c("1-3","4-10","11-15","15+"))
# Check the freq table
table(TL_TeacherYear$Teacher_year)
##
## 1-3 4-10 11-15 15+
## 155 255 125 423
# Build a overall model
overall.model <- '
TL =~ JS58+JS59+JS60+JS61+JS62+JS63+JS64+JS65+JS66+JS67+JS68+JS69+JS70+JS71+JS72+JS73+JS74+JS75+JS76+JS77
'
# Run the model
overall.fit <- cfa(model = overall.model,
data= TL_TeacherYear,
meanstructure = TRUE)
# Request the summary
summary(overall.fit,
standardized = TRUE,
rsquare = TRUE,
fit.measure = TRUE)
## lavaan 0.6-7 ended normally after 80 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 60
##
## Number of observations 958
##
## Model Test User Model:
##
## Test statistic 1783.761
## Degrees of freedom 170
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 29157.594
## Degrees of freedom 190
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.944
## Tucker-Lewis Index (TLI) 0.938
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -7063.065
## Loglikelihood unrestricted model (H1) -6171.185
##
## Akaike (AIC) 14246.130
## Bayesian (BIC) 14538.021
## Sample-size adjusted Bayesian (BIC) 14347.463
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.100
## 90 Percent confidence interval - lower 0.095
## 90 Percent confidence interval - upper 0.104
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.019
##
## 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
## TL =~
## JS58 1.000 0.607 0.895
## JS59 1.074 0.024 45.018 0.000 0.652 0.906
## JS60 1.107 0.025 44.562 0.000 0.672 0.902
## JS61 1.006 0.024 41.114 0.000 0.611 0.873
## JS62 1.129 0.025 44.284 0.000 0.685 0.900
## JS63 1.006 0.023 44.270 0.000 0.611 0.900
## JS64 1.118 0.026 43.487 0.000 0.679 0.894
## JS65 1.190 0.024 48.775 0.000 0.723 0.933
## JS66 1.185 0.026 45.579 0.000 0.720 0.910
## JS67 1.079 0.024 44.423 0.000 0.655 0.901
## JS68 1.010 0.023 44.218 0.000 0.614 0.900
## JS69 1.170 0.025 47.113 0.000 0.711 0.922
## JS70 0.985 0.024 41.289 0.000 0.598 0.875
## JS71 0.972 0.025 38.360 0.000 0.590 0.847
## JS72 1.044 0.023 46.063 0.000 0.634 0.914
## JS73 0.946 0.023 40.350 0.000 0.574 0.866
## JS74 1.075 0.023 47.293 0.000 0.653 0.923
## JS75 1.138 0.024 47.181 0.000 0.691 0.922
## JS76 0.953 0.024 39.300 0.000 0.579 0.856
## JS77 0.966 0.022 43.407 0.000 0.587 0.893
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.480 0.022 204.352 0.000 4.480 6.602
## .JS59 4.430 0.023 190.405 0.000 4.430 6.152
## .JS60 4.422 0.024 183.718 0.000 4.422 5.936
## .JS61 4.447 0.023 196.754 0.000 4.447 6.357
## .JS62 4.397 0.025 178.746 0.000 4.397 5.775
## .JS63 4.491 0.022 204.761 0.000 4.491 6.616
## .JS64 4.386 0.025 178.671 0.000 4.386 5.773
## .JS65 4.404 0.025 175.996 0.000 4.404 5.686
## .JS66 4.376 0.026 171.321 0.000 4.376 5.535
## .JS67 4.402 0.023 187.417 0.000 4.402 6.055
## .JS68 4.500 0.022 204.246 0.000 4.500 6.599
## .JS69 4.423 0.025 177.502 0.000 4.423 5.735
## .JS70 4.456 0.022 201.768 0.000 4.456 6.519
## .JS71 4.419 0.023 196.269 0.000 4.419 6.341
## .JS72 4.476 0.022 199.724 0.000 4.476 6.453
## .JS73 4.483 0.021 209.268 0.000 4.483 6.761
## .JS74 4.436 0.023 194.063 0.000 4.436 6.270
## .JS75 4.442 0.024 183.407 0.000 4.442 5.926
## .JS76 4.459 0.022 204.144 0.000 4.459 6.596
## .JS77 4.482 0.021 211.243 0.000 4.482 6.825
## TL 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.092 0.004 20.866 0.000 0.092 0.199
## .JS59 0.093 0.004 20.724 0.000 0.093 0.179
## .JS60 0.103 0.005 20.773 0.000 0.103 0.186
## .JS61 0.116 0.006 21.072 0.000 0.116 0.237
## .JS62 0.110 0.005 20.802 0.000 0.110 0.190
## .JS63 0.087 0.004 20.804 0.000 0.087 0.190
## .JS64 0.116 0.006 20.879 0.000 0.116 0.201
## .JS65 0.078 0.004 20.183 0.000 0.078 0.130
## .JS66 0.107 0.005 20.660 0.000 0.107 0.171
## .JS67 0.099 0.005 20.788 0.000 0.099 0.188
## .JS68 0.089 0.004 20.809 0.000 0.089 0.190
## .JS69 0.090 0.004 20.458 0.000 0.090 0.151
## .JS70 0.110 0.005 21.059 0.000 0.110 0.235
## .JS71 0.137 0.006 21.244 0.000 0.137 0.283
## .JS72 0.079 0.004 20.601 0.000 0.079 0.165
## .JS73 0.110 0.005 21.124 0.000 0.110 0.250
## .JS74 0.074 0.004 20.431 0.000 0.074 0.148
## .JS75 0.084 0.004 20.448 0.000 0.084 0.150
## .JS76 0.122 0.006 21.190 0.000 0.122 0.267
## .JS77 0.087 0.004 20.886 0.000 0.087 0.202
## TL 0.369 0.021 17.851 0.000 1.000 1.000
##
## R-Square:
## Estimate
## JS58 0.801
## JS59 0.821
## JS60 0.814
## JS61 0.763
## JS62 0.810
## JS63 0.810
## JS64 0.799
## JS65 0.870
## JS66 0.829
## JS67 0.812
## JS68 0.810
## JS69 0.849
## JS70 0.765
## JS71 0.717
## JS72 0.835
## JS73 0.750
## JS74 0.852
## JS75 0.850
## JS76 0.733
## JS77 0.798
# Make a table to compare all the models
table_fit <- matrix(NA,nrow=4,ncol=6)
colnames(table_fit) <- c("Model","X2","df","CFI","RMSEA","SRMR")
# Put the overall model results into our table
table_fit[1,] <- c("Overall Model",round(fitmeasures(overall.fit,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1783.761 | 170 | 0.944 | 0.1 | 0.019 |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
# Create a SEM plot
semPaths(overall.fit,
whatLabels = "std",
layout="tree")
# The 1st row is the factor loading
# The 2nd row below the Items is the variances
# The 3nd row is the estimates
# Build the model
MG.model <- '
TL=~Direction+Cultivation+Organization+Tutor
Direction=~JS58+JS59+JS60+JS61
Cultivation=~JS62+JS63+JS64+JS65+JS66+JS67
Organization=~JS68+JS69+JS70+JS71
Tutor=~JS72+JS73+JS74+JS75+JS76+JS77
'
# Running the CFA by group - structural equivalence - configural invariance
# In this case, a configural invariance test allows you to examine whether the overall factor structure stipulated by our measure fits well for all teacher years groups in our sample. As with a typical CFA, we start by specifying the relationships between each item in the measure we’re using and the latent factor(s) that the items are stipulated to measure.
MG.fit.configural <- cfa(MG.model,
data = TL_TeacherYear,
group = "Teacher_year",
std.lv=T,
)
## Warning in lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING:
## Could not compute standard errors! The information matrix could
## not be inverted. This may be a symptom that the model is not
## identified.
# Request the summary of the model result
summary(MG.fit.configural,fit.measures=T,standardized=T)
## lavaan 0.6-7 ended normally after 1125 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 256
##
## Number of observations per group:
## 4-10 255
## 1-3 155
## 11-15 125
## 15+ 423
##
## Model Test User Model:
##
## Test statistic 3108.442
## Degrees of freedom 664
## P-value (Chi-square) 0.000
## Test statistic for each group:
## 4-10 709.067
## 1-3 1017.493
## 11-15 580.666
## 15+ 801.215
##
## Model Test Baseline Model:
##
## Test statistic 31669.539
## Degrees of freedom 760
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.921
## Tucker-Lewis Index (TLI) 0.909
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -6139.061
## Loglikelihood unrestricted model (H1) -4584.840
##
## Akaike (AIC) 12790.121
## Bayesian (BIC) 14035.522
## Sample-size adjusted Bayesian (BIC) 13222.474
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.124
## 90 Percent confidence interval - lower 0.120
## 90 Percent confidence interval - upper 0.128
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.024
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [4-10]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Direction 2.748 NA 0.940 0.940
## Cultivation 4.686 NA 0.978 0.978
## Organization 4.642 NA 0.978 0.978
## Tutor 3.939 NA 0.969 0.969
## Direction =~
## JS58 0.193 NA 0.563 0.906
## JS59 0.211 NA 0.618 0.936
## JS60 0.214 NA 0.625 0.938
## JS61 0.172 NA 0.503 0.833
## Cultivation =~
## JS62 0.129 NA 0.620 0.863
## JS63 0.107 NA 0.511 0.863
## JS64 0.119 NA 0.569 0.875
## JS65 0.136 NA 0.649 0.918
## JS66 0.128 NA 0.615 0.906
## JS67 0.119 NA 0.570 0.854
## Organization =~
## JS68 0.097 NA 0.460 0.819
## JS69 0.132 NA 0.626 0.894
## JS70 0.112 NA 0.534 0.822
## JS71 0.126 NA 0.597 0.850
## Tutor =~
## JS72 0.145 NA 0.589 0.879
## JS73 0.135 NA 0.549 0.853
## JS74 0.152 NA 0.616 0.932
## JS75 0.159 NA 0.648 0.930
## JS76 0.142 NA 0.577 0.889
## JS77 0.137 NA 0.556 0.895
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.612 NA 4.612 7.418
## .JS59 4.553 NA 4.553 6.900
## .JS60 4.537 NA 4.537 6.804
## .JS61 4.604 NA 4.604 7.624
## .JS62 4.486 NA 4.486 6.243
## .JS63 4.596 NA 4.596 7.762
## .JS64 4.518 NA 4.518 6.952
## .JS65 4.514 NA 4.514 6.378
## .JS66 4.533 NA 4.533 6.679
## .JS67 4.522 NA 4.522 6.773
## .JS68 4.643 NA 4.643 8.263
## .JS69 4.553 NA 4.553 6.502
## .JS70 4.541 NA 4.541 7.000
## .JS71 4.482 NA 4.482 6.385
## .JS72 4.569 NA 4.569 6.816
## .JS73 4.588 NA 4.588 7.124
## .JS74 4.537 NA 4.537 6.865
## .JS75 4.529 NA 4.529 6.508
## .JS76 4.522 NA 4.522 6.960
## .JS77 4.573 NA 4.573 7.361
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.069 NA 0.069 0.180
## .JS59 0.054 NA 0.054 0.123
## .JS60 0.054 NA 0.054 0.121
## .JS61 0.111 NA 0.111 0.305
## .JS62 0.132 NA 0.132 0.255
## .JS63 0.089 NA 0.089 0.255
## .JS64 0.099 NA 0.099 0.234
## .JS65 0.079 NA 0.079 0.158
## .JS66 0.082 NA 0.082 0.179
## .JS67 0.121 NA 0.121 0.270
## .JS68 0.104 NA 0.104 0.329
## .JS69 0.099 NA 0.099 0.201
## .JS70 0.136 NA 0.136 0.324
## .JS71 0.137 NA 0.137 0.277
## .JS72 0.103 NA 0.103 0.228
## .JS73 0.113 NA 0.113 0.272
## .JS74 0.057 NA 0.057 0.132
## .JS75 0.065 NA 0.065 0.134
## .JS76 0.089 NA 0.089 0.210
## .JS77 0.077 NA 0.077 0.199
## TL 1.000 1.000 1.000
## .Direction 1.000 0.117 0.117
## .Cultivation 1.000 0.044 0.044
## .Organization 1.000 0.044 0.044
## .Tutor 1.000 0.061 0.061
##
##
## Group 2 [1-3]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Direction 4.489 NA 0.976 0.976
## Cultivation 7.057 NA 0.990 0.990
## Organization 252.038 NA 1.000 1.000
## Tutor 9.041 NA 0.994 0.994
## Direction =~
## JS58 0.134 NA 0.618 0.979
## JS59 0.138 NA 0.635 0.970
## JS60 0.143 NA 0.657 0.948
## JS61 0.135 NA 0.622 0.938
## Cultivation =~
## JS62 0.094 NA 0.671 0.943
## JS63 0.086 NA 0.612 0.955
## JS64 0.092 NA 0.652 0.968
## JS65 0.089 NA 0.635 0.978
## JS66 0.090 NA 0.642 0.879
## JS67 0.084 NA 0.597 0.927
## Organization =~
## JS68 0.002 NA 0.590 0.956
## JS69 0.002 NA 0.597 0.964
## JS70 0.002 NA 0.596 0.942
## JS71 0.002 NA 0.603 0.936
## Tutor =~
## JS72 0.066 NA 0.598 0.937
## JS73 0.056 NA 0.506 0.907
## JS74 0.063 NA 0.571 0.935
## JS75 0.064 NA 0.587 0.971
## JS76 0.062 NA 0.568 0.900
## JS77 0.064 NA 0.586 0.949
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.581 NA 4.581 7.258
## .JS59 4.548 NA 4.548 6.950
## .JS60 4.542 NA 4.542 6.553
## .JS61 4.561 NA 4.561 6.878
## .JS62 4.535 NA 4.535 6.371
## .JS63 4.587 NA 4.587 7.163
## .JS64 4.548 NA 4.548 6.750
## .JS65 4.594 NA 4.594 7.072
## .JS66 4.523 NA 4.523 6.193
## .JS67 4.555 NA 4.555 7.073
## .JS68 4.606 NA 4.606 7.467
## .JS69 4.594 NA 4.594 7.421
## .JS70 4.568 NA 4.568 7.220
## .JS71 4.555 NA 4.555 7.073
## .JS72 4.600 NA 4.600 7.204
## .JS73 4.626 NA 4.626 8.287
## .JS74 4.581 NA 4.581 7.505
## .JS75 4.619 NA 4.619 7.649
## .JS76 4.581 NA 4.581 7.258
## .JS77 4.606 NA 4.606 7.467
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.017 NA 0.017 0.042
## .JS59 0.026 NA 0.026 0.060
## .JS60 0.049 NA 0.049 0.101
## .JS61 0.052 NA 0.052 0.119
## .JS62 0.056 NA 0.056 0.111
## .JS63 0.036 NA 0.036 0.087
## .JS64 0.028 NA 0.028 0.063
## .JS65 0.018 NA 0.018 0.043
## .JS66 0.122 NA 0.122 0.228
## .JS67 0.058 NA 0.058 0.141
## .JS68 0.033 NA 0.033 0.087
## .JS69 0.027 NA 0.027 0.070
## .JS70 0.045 NA 0.045 0.113
## .JS71 0.051 NA 0.051 0.123
## .JS72 0.050 NA 0.050 0.122
## .JS73 0.055 NA 0.055 0.177
## .JS74 0.047 NA 0.047 0.126
## .JS75 0.021 NA 0.021 0.056
## .JS76 0.076 NA 0.076 0.190
## .JS77 0.038 NA 0.038 0.099
## TL 1.000 1.000 1.000
## .Direction 1.000 0.047 0.047
## .Cultivation 1.000 0.020 0.020
## .Organization 1.000 0.000 0.000
## .Tutor 1.000 0.012 0.012
##
##
## Group 3 [11-15]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Direction 2.429 NA 0.925 0.925
## Cultivation 5.525 NA 0.984 0.984
## Organization 212.716 NA 1.000 1.000
## Tutor 5.894 NA 0.986 0.986
## Direction =~
## JS58 0.231 NA 0.607 0.915
## JS59 0.265 NA 0.697 0.944
## JS60 0.264 NA 0.693 0.933
## JS61 0.231 NA 0.607 0.874
## Cultivation =~
## JS62 0.133 NA 0.746 0.955
## JS63 0.119 NA 0.668 0.902
## JS64 0.122 NA 0.687 0.913
## JS65 0.145 NA 0.813 0.948
## JS66 0.150 NA 0.841 0.946
## JS67 0.128 NA 0.718 0.941
## Organization =~
## JS68 0.003 NA 0.659 0.915
## JS69 0.003 NA 0.738 0.931
## JS70 0.003 NA 0.593 0.879
## JS71 0.003 NA 0.633 0.839
## Tutor =~
## JS72 0.106 NA 0.631 0.937
## JS73 0.099 NA 0.591 0.923
## JS74 0.117 NA 0.700 0.934
## JS75 0.122 NA 0.728 0.895
## JS76 0.099 NA 0.591 0.906
## JS77 0.104 NA 0.619 0.919
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.464 NA 4.464 6.724
## .JS59 4.408 NA 4.408 5.968
## .JS60 4.368 NA 4.368 5.876
## .JS61 4.408 NA 4.408 6.352
## .JS62 4.344 NA 4.344 5.564
## .JS63 4.424 NA 4.424 5.975
## .JS64 4.360 NA 4.360 5.793
## .JS65 4.336 NA 4.336 5.057
## .JS66 4.312 NA 4.312 4.849
## .JS67 4.360 NA 4.360 5.713
## .JS68 4.440 NA 4.440 6.167
## .JS69 4.352 NA 4.352 5.491
## .JS70 4.448 NA 4.448 6.592
## .JS71 4.368 NA 4.368 5.793
## .JS72 4.440 NA 4.440 6.587
## .JS73 4.480 NA 4.480 7.000
## .JS74 4.408 NA 4.408 5.882
## .JS75 4.360 NA 4.360 5.357
## .JS76 4.464 NA 4.464 6.850
## .JS77 4.440 NA 4.440 6.587
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.072 NA 0.072 0.163
## .JS59 0.060 NA 0.060 0.110
## .JS60 0.072 NA 0.072 0.130
## .JS61 0.114 NA 0.114 0.236
## .JS62 0.054 NA 0.054 0.088
## .JS63 0.103 NA 0.103 0.187
## .JS64 0.094 NA 0.094 0.166
## .JS65 0.074 NA 0.074 0.101
## .JS66 0.083 NA 0.083 0.105
## .JS67 0.066 NA 0.066 0.114
## .JS68 0.085 NA 0.085 0.163
## .JS69 0.084 NA 0.084 0.133
## .JS70 0.103 NA 0.103 0.227
## .JS71 0.168 NA 0.168 0.296
## .JS72 0.056 NA 0.056 0.123
## .JS73 0.061 NA 0.061 0.148
## .JS74 0.071 NA 0.071 0.127
## .JS75 0.132 NA 0.132 0.199
## .JS76 0.076 NA 0.076 0.178
## .JS77 0.071 NA 0.071 0.156
## TL 1.000 1.000 1.000
## .Direction 1.000 0.145 0.145
## .Cultivation 1.000 0.032 0.032
## .Organization 1.000 0.000 0.000
## .Tutor 1.000 0.028 0.028
##
##
## Group 4 [15+]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Direction 3.822 NA 0.967 0.967
## Cultivation 118.087 NA 1.000 1.000
## Organization 9.340 NA 0.994 0.994
## Tutor 5.757 NA 0.985 0.985
## Direction =~
## JS58 0.168 NA 0.663 0.931
## JS59 0.178 NA 0.701 0.931
## JS60 0.185 NA 0.730 0.923
## JS61 0.166 NA 0.655 0.884
## Cultivation =~
## JS62 0.006 NA 0.702 0.895
## JS63 0.005 NA 0.642 0.906
## JS64 0.006 NA 0.730 0.884
## JS65 0.006 NA 0.760 0.943
## JS66 0.006 NA 0.750 0.918
## JS67 0.006 NA 0.690 0.911
## Organization =~
## JS68 0.072 NA 0.673 0.915
## JS69 0.083 NA 0.777 0.936
## JS70 0.068 NA 0.640 0.899
## JS71 0.061 NA 0.575 0.842
## Tutor =~
## JS72 0.112 NA 0.657 0.914
## JS73 0.102 NA 0.596 0.857
## JS74 0.118 NA 0.690 0.936
## JS75 0.127 NA 0.742 0.939
## JS76 0.102 NA 0.598 0.851
## JS77 0.103 NA 0.604 0.899
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.369 NA 4.369 6.135
## .JS59 4.319 NA 4.319 5.735
## .JS60 4.324 NA 4.324 5.467
## .JS61 4.322 NA 4.322 5.832
## .JS62 4.307 NA 4.307 5.493
## .JS63 4.411 NA 4.411 6.225
## .JS64 4.255 NA 4.255 5.153
## .JS65 4.288 NA 4.288 5.320
## .JS66 4.246 NA 4.246 5.196
## .JS67 4.286 NA 4.286 5.662
## .JS68 4.392 NA 4.392 5.972
## .JS69 4.303 NA 4.303 5.185
## .JS70 4.366 NA 4.366 6.136
## .JS71 4.345 NA 4.345 6.357
## .JS72 4.385 NA 4.385 6.106
## .JS73 4.369 NA 4.369 6.284
## .JS74 4.331 NA 4.331 5.878
## .JS75 4.348 NA 4.348 5.504
## .JS76 4.376 NA 4.376 6.222
## .JS77 4.395 NA 4.395 6.539
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.068 NA 0.068 0.134
## .JS59 0.075 NA 0.075 0.133
## .JS60 0.092 NA 0.092 0.148
## .JS61 0.120 NA 0.120 0.219
## .JS62 0.122 NA 0.122 0.198
## .JS63 0.090 NA 0.090 0.180
## .JS64 0.149 NA 0.149 0.219
## .JS65 0.072 NA 0.072 0.111
## .JS66 0.106 NA 0.106 0.158
## .JS67 0.097 NA 0.097 0.170
## .JS68 0.088 NA 0.088 0.163
## .JS69 0.085 NA 0.085 0.124
## .JS70 0.097 NA 0.097 0.192
## .JS71 0.136 NA 0.136 0.292
## .JS72 0.085 NA 0.085 0.164
## .JS73 0.129 NA 0.129 0.266
## .JS74 0.067 NA 0.067 0.124
## .JS75 0.074 NA 0.074 0.119
## .JS76 0.137 NA 0.137 0.276
## .JS77 0.086 NA 0.086 0.191
## TL 1.000 1.000 1.000
## .Direction 1.000 0.064 0.064
## .Cultivation 1.000 0.000 0.000
## .Organization 1.000 0.011 0.011
## .Tutor 1.000 0.029 0.029
# Check out the key indices for the model
# Put it into our table
table_fit[2,] <- c("Configural Model",round(fitmeasures(MG.fit.configural,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1783.761 | 170 | 0.944 | 0.1 | 0.019 |
| Configural Model | 3108.442 | 664 | 0.921 | 0.124 | 0.024 |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
# Running the CFA by group - metric equivalence/invariance - constraining the factor loadings to be equal.
# The next step is to test for metric invariance to examine whether the factor loadings are equivalent across the groups. This time, we constrain the factor loadings to be equivalent across groups, while still allowing the item intercepts to vary freely as before. A good multi-group model fit indicates metric invariance — if constraining the factor loadings in this way results in a poorer fit, it suggests that the factor loadings are not similar across age groups.
# Ascertaining metric invariance allows you to substantiate multi-group comparisons of factor variances and covariances, since metric invariance indicates that each item of the scale loads onto the specified latent factor in a similar manner and with similar magnitude across groups. As such, we can assume that differences in factor variances and covariances are not attributable to Teacher_years based differences in the properties of the scales themselves.
MG.fit.metric <- cfa(MG.model,
data = TL_TeacherYear,
group = "Teacher_year",
std.lv=T,
group.equal = "loadings"
)
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
# Request the summary of the model result
summary(MG.fit.metric,fit.measures=T,standardized=T)
## lavaan 0.6-7 ended normally after 420 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 271
## Number of equality constraints 72
##
## Number of observations per group:
## 4-10 255
## 1-3 155
## 11-15 125
## 15+ 423
##
## Model Test User Model:
##
## Test statistic 3277.199
## Degrees of freedom 721
## P-value (Chi-square) 0.000
## Test statistic for each group:
## 4-10 758.652
## 1-3 1078.703
## 11-15 604.636
## 15+ 835.208
##
## Model Test Baseline Model:
##
## Test statistic 31669.539
## Degrees of freedom 760
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.917
## Tucker-Lewis Index (TLI) 0.913
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -6223.439
## Loglikelihood unrestricted model (H1) -4584.840
##
## Akaike (AIC) 12844.878
## Bayesian (BIC) 13812.983
## Sample-size adjusted Bayesian (BIC) 13180.965
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.122
## 90 Percent confidence interval - lower 0.117
## 90 Percent confidence interval - upper 0.126
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.058
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [4-10]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 2.787 0.252 11.051 0.000 0.941 0.941
## Cultvtn (.p2.) 5.128 0.857 5.980 0.000 0.982 0.982
## Orgnztn (.p3.) 5.330 1.258 4.238 0.000 0.983 0.983
## Tutor (.p4.) 3.307 0.327 10.100 0.000 0.957 0.957
## Direction =~
## JS58 (.p5.) 0.192 0.015 12.902 0.000 0.568 0.907
## JS59 (.p6.) 0.204 0.016 12.932 0.000 0.603 0.931
## JS60 (.p7.) 0.210 0.016 12.934 0.000 0.621 0.937
## JS61 (.p8.) 0.186 0.015 12.764 0.000 0.552 0.856
## Cultivation =~
## JS62 (.p9.) 0.117 0.019 6.239 0.000 0.612 0.860
## JS63 (.10.) 0.105 0.017 6.241 0.000 0.548 0.878
## JS64 (.11.) 0.115 0.018 6.243 0.000 0.602 0.886
## JS65 (.12.) 0.121 0.019 6.248 0.000 0.630 0.910
## JS66 (.13.) 0.122 0.019 6.248 0.000 0.636 0.911
## JS67 (.14.) 0.111 0.018 6.238 0.000 0.579 0.858
## Organization =~
## JS68 (.15.) 0.101 0.023 4.325 0.000 0.550 0.859
## JS69 (.16.) 0.114 0.026 4.327 0.000 0.621 0.890
## JS70 (.17.) 0.100 0.023 4.323 0.000 0.543 0.825
## JS71 (.18.) 0.099 0.023 4.322 0.000 0.538 0.815
## Tutor =~
## JS72 (.19.) 0.163 0.014 11.358 0.000 0.565 0.868
## JS73 (.20.) 0.148 0.013 11.289 0.000 0.511 0.835
## JS74 (.21.) 0.170 0.015 11.420 0.000 0.587 0.927
## JS75 (.22.) 0.177 0.015 11.417 0.000 0.610 0.922
## JS76 (.23.) 0.154 0.014 11.313 0.000 0.532 0.872
## JS77 (.24.) 0.156 0.014 11.370 0.000 0.538 0.890
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.612 0.039 117.515 0.000 4.612 7.359
## .JS59 4.553 0.041 112.255 0.000 4.553 7.030
## .JS60 4.537 0.041 109.365 0.000 4.537 6.849
## .JS61 4.604 0.040 114.053 0.000 4.604 7.142
## .JS62 4.486 0.045 100.718 0.000 4.486 6.307
## .JS63 4.596 0.039 117.590 0.000 4.596 7.364
## .JS64 4.518 0.043 106.204 0.000 4.518 6.651
## .JS65 4.514 0.043 104.237 0.000 4.514 6.528
## .JS66 4.533 0.044 103.769 0.000 4.533 6.498
## .JS67 4.522 0.042 107.047 0.000 4.522 6.704
## .JS68 4.643 0.040 115.741 0.000 4.643 7.248
## .JS69 4.553 0.044 104.244 0.000 4.553 6.528
## .JS70 4.541 0.041 110.034 0.000 4.541 6.891
## .JS71 4.482 0.041 108.483 0.000 4.482 6.793
## .JS72 4.569 0.041 112.156 0.000 4.569 7.023
## .JS73 4.588 0.038 119.741 0.000 4.588 7.498
## .JS74 4.537 0.040 114.379 0.000 4.537 7.163
## .JS75 4.529 0.041 109.319 0.000 4.529 6.846
## .JS76 4.522 0.038 118.392 0.000 4.522 7.414
## .JS77 4.573 0.038 120.822 0.000 4.573 7.566
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.070 0.007 9.349 0.000 0.070 0.177
## .JS59 0.056 0.007 8.547 0.000 0.056 0.134
## .JS60 0.054 0.007 8.256 0.000 0.054 0.123
## .JS61 0.111 0.011 10.158 0.000 0.111 0.268
## .JS62 0.132 0.013 10.350 0.000 0.132 0.261
## .JS63 0.089 0.009 10.171 0.000 0.089 0.230
## .JS64 0.099 0.010 10.070 0.000 0.099 0.215
## .JS65 0.082 0.008 9.662 0.000 0.082 0.171
## .JS66 0.082 0.009 9.637 0.000 0.082 0.169
## .JS67 0.120 0.012 10.366 0.000 0.120 0.264
## .JS68 0.107 0.011 9.852 0.000 0.107 0.262
## .JS69 0.101 0.011 9.266 0.000 0.101 0.208
## .JS70 0.139 0.014 10.235 0.000 0.139 0.320
## .JS71 0.146 0.014 10.313 0.000 0.146 0.336
## .JS72 0.104 0.010 10.210 0.000 0.104 0.246
## .JS73 0.114 0.011 10.483 0.000 0.114 0.303
## .JS74 0.057 0.006 9.123 0.000 0.057 0.141
## .JS75 0.065 0.007 9.263 0.000 0.065 0.149
## .JS76 0.089 0.009 10.168 0.000 0.089 0.239
## .JS77 0.076 0.008 9.936 0.000 0.076 0.207
## TL 1.000 1.000 1.000
## .Direction 1.000 0.114 0.114
## .Cultivation 1.000 0.037 0.037
## .Organization 1.000 0.034 0.034
## .Tutor 1.000 0.084 0.084
##
##
## Group 2 [1-3]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 2.787 0.252 11.051 0.000 0.966 0.966
## Cultvtn (.p2.) 5.128 0.857 5.980 0.000 0.987 0.987
## Orgnztn (.p3.) 5.330 1.258 4.238 0.000 1.007 1.007
## Tutor (.p4.) 3.307 0.327 10.100 0.000 0.997 0.997
## Direction =~
## JS58 (.p5.) 0.192 0.015 12.902 0.000 0.590 0.978
## JS59 (.p6.) 0.204 0.016 12.932 0.000 0.626 0.970
## JS60 (.p7.) 0.210 0.016 12.934 0.000 0.644 0.946
## JS61 (.p8.) 0.186 0.015 12.764 0.000 0.573 0.925
## Cultivation =~
## JS62 (.p9.) 0.117 0.019 6.239 0.000 0.648 0.938
## JS63 (.10.) 0.105 0.017 6.241 0.000 0.580 0.948
## JS64 (.11.) 0.115 0.018 6.243 0.000 0.638 0.966
## JS65 (.12.) 0.121 0.019 6.248 0.000 0.667 0.978
## JS66 (.13.) 0.122 0.019 6.248 0.000 0.674 0.889
## JS67 (.14.) 0.111 0.018 6.238 0.000 0.613 0.932
## Organization =~
## JS68 (.15.) 0.101 0.023 4.325 0.000 0.572 0.949
## JS69 (.16.) 0.114 0.026 4.327 0.000 0.645 0.961
## JS70 (.17.) 0.100 0.023 4.323 0.000 0.565 0.935
## JS71 (.18.) 0.099 0.023 4.322 0.000 0.559 0.924
## Tutor =~
## JS72 (.19.) 0.163 0.014 11.358 0.000 0.577 0.932
## JS73 (.20.) 0.148 0.013 11.289 0.000 0.522 0.912
## JS74 (.21.) 0.170 0.015 11.420 0.000 0.600 0.940
## JS75 (.22.) 0.177 0.015 11.417 0.000 0.624 0.972
## JS76 (.23.) 0.154 0.014 11.313 0.000 0.544 0.891
## JS77 (.24.) 0.156 0.014 11.370 0.000 0.550 0.941
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.581 0.048 94.478 0.000 4.581 7.589
## .JS59 4.548 0.052 87.772 0.000 4.548 7.050
## .JS60 4.542 0.055 83.017 0.000 4.542 6.668
## .JS61 4.561 0.050 91.696 0.000 4.561 7.365
## .JS62 4.535 0.055 81.767 0.000 4.535 6.568
## .JS63 4.587 0.049 93.240 0.000 4.587 7.489
## .JS64 4.548 0.053 85.788 0.000 4.548 6.891
## .JS65 4.594 0.055 83.891 0.000 4.594 6.738
## .JS66 4.523 0.061 74.317 0.000 4.523 5.969
## .JS67 4.555 0.053 86.268 0.000 4.555 6.929
## .JS68 4.606 0.048 95.175 0.000 4.606 7.645
## .JS69 4.594 0.054 85.245 0.000 4.594 6.847
## .JS70 4.568 0.049 94.146 0.000 4.568 7.562
## .JS71 4.555 0.049 93.756 0.000 4.555 7.531
## .JS72 4.600 0.050 92.467 0.000 4.600 7.427
## .JS73 4.626 0.046 100.570 0.000 4.626 8.078
## .JS74 4.581 0.051 89.314 0.000 4.581 7.174
## .JS75 4.619 0.052 89.584 0.000 4.619 7.196
## .JS76 4.581 0.049 93.445 0.000 4.581 7.506
## .JS77 4.606 0.047 98.089 0.000 4.606 7.879
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.016 0.003 5.751 0.000 0.016 0.044
## .JS59 0.024 0.004 6.531 0.000 0.024 0.059
## .JS60 0.049 0.006 7.626 0.000 0.049 0.105
## .JS61 0.056 0.007 7.992 0.000 0.056 0.145
## .JS62 0.057 0.007 8.091 0.000 0.057 0.120
## .JS63 0.038 0.005 7.946 0.000 0.038 0.102
## .JS64 0.029 0.004 7.428 0.000 0.029 0.067
## .JS65 0.020 0.003 6.572 0.000 0.020 0.043
## .JS66 0.120 0.014 8.440 0.000 0.120 0.210
## .JS67 0.056 0.007 8.157 0.000 0.056 0.131
## .JS68 0.036 0.004 8.447 0.000 0.036 0.099
## .JS69 0.034 0.004 8.170 0.000 0.034 0.076
## .JS70 0.046 0.005 8.599 0.000 0.046 0.126
## .JS71 0.054 0.006 8.665 0.000 0.054 0.146
## .JS72 0.050 0.006 8.258 0.000 0.050 0.131
## .JS73 0.055 0.007 8.405 0.000 0.055 0.168
## .JS74 0.048 0.006 8.178 0.000 0.048 0.117
## .JS75 0.023 0.003 7.266 0.000 0.023 0.056
## .JS76 0.077 0.009 8.496 0.000 0.077 0.206
## .JS77 0.039 0.005 8.164 0.000 0.039 0.115
## TL 1.134 0.166 6.826 0.000 1.000 1.000
## .Direction 0.638 0.141 4.509 0.000 0.067 0.067
## .Cultivation 0.799 0.312 2.558 0.011 0.026 0.026
## .Organization -0.471 0.254 -1.859 0.063 -0.015 -0.015
## .Tutor 0.069 0.058 1.194 0.232 0.006 0.006
##
##
## Group 3 [11-15]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 2.787 0.252 11.051 0.000 0.933 0.933
## Cultvtn (.p2.) 5.128 0.857 5.980 0.000 0.980 0.980
## Orgnztn (.p3.) 5.330 1.258 4.238 0.000 1.009 1.009
## Tutor (.p4.) 3.307 0.327 10.100 0.000 0.985 0.985
## Direction =~
## JS58 (.p5.) 0.192 0.015 12.902 0.000 0.685 0.931
## JS59 (.p6.) 0.204 0.016 12.932 0.000 0.726 0.946
## JS60 (.p7.) 0.210 0.016 12.934 0.000 0.748 0.941
## JS61 (.p8.) 0.186 0.015 12.764 0.000 0.665 0.893
## Cultivation =~
## JS62 (.p9.) 0.117 0.019 6.239 0.000 0.732 0.954
## JS63 (.10.) 0.105 0.017 6.241 0.000 0.655 0.898
## JS64 (.11.) 0.115 0.018 6.243 0.000 0.720 0.920
## JS65 (.12.) 0.121 0.019 6.248 0.000 0.753 0.938
## JS66 (.13.) 0.122 0.019 6.248 0.000 0.761 0.930
## JS67 (.14.) 0.111 0.018 6.238 0.000 0.692 0.937
## Organization =~
## JS68 (.15.) 0.101 0.023 4.325 0.000 0.640 0.909
## JS69 (.16.) 0.114 0.026 4.327 0.000 0.722 0.924
## JS70 (.17.) 0.100 0.023 4.323 0.000 0.632 0.886
## JS71 (.18.) 0.099 0.023 4.322 0.000 0.626 0.830
## Tutor =~
## JS72 (.19.) 0.163 0.014 11.358 0.000 0.656 0.942
## JS73 (.20.) 0.148 0.013 11.289 0.000 0.593 0.924
## JS74 (.21.) 0.170 0.015 11.420 0.000 0.681 0.929
## JS75 (.22.) 0.177 0.015 11.417 0.000 0.708 0.887
## JS76 (.23.) 0.154 0.014 11.313 0.000 0.617 0.914
## JS77 (.24.) 0.156 0.014 11.370 0.000 0.625 0.921
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.464 0.066 67.869 0.000 4.464 6.070
## .JS59 4.408 0.069 64.147 0.000 4.408 5.738
## .JS60 4.368 0.071 61.433 0.000 4.368 5.495
## .JS61 4.408 0.067 66.230 0.000 4.408 5.924
## .JS62 4.344 0.069 63.327 0.000 4.344 5.664
## .JS63 4.424 0.065 67.764 0.000 4.424 6.061
## .JS64 4.360 0.070 62.249 0.000 4.360 5.568
## .JS65 4.336 0.072 60.361 0.000 4.336 5.399
## .JS66 4.312 0.073 58.953 0.000 4.312 5.273
## .JS67 4.360 0.066 65.991 0.000 4.360 5.902
## .JS68 4.440 0.063 70.494 0.000 4.440 6.305
## .JS69 4.352 0.070 62.279 0.000 4.352 5.570
## .JS70 4.448 0.064 69.641 0.000 4.448 6.229
## .JS71 4.368 0.067 64.784 0.000 4.368 5.794
## .JS72 4.440 0.062 71.333 0.000 4.440 6.380
## .JS73 4.480 0.057 78.093 0.000 4.480 6.985
## .JS74 4.408 0.066 67.175 0.000 4.408 6.008
## .JS75 4.360 0.071 61.033 0.000 4.360 5.459
## .JS76 4.464 0.060 73.859 0.000 4.464 6.606
## .JS77 4.440 0.061 73.213 0.000 4.440 6.548
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.072 0.011 6.313 0.000 0.072 0.133
## .JS59 0.063 0.011 5.841 0.000 0.063 0.106
## .JS60 0.073 0.012 6.028 0.000 0.073 0.115
## .JS61 0.112 0.016 6.955 0.000 0.112 0.202
## .JS62 0.053 0.008 6.478 0.000 0.053 0.090
## .JS63 0.103 0.014 7.326 0.000 0.103 0.194
## .JS64 0.095 0.013 7.141 0.000 0.095 0.154
## .JS65 0.078 0.011 6.882 0.000 0.078 0.120
## .JS66 0.090 0.013 7.006 0.000 0.090 0.135
## .JS67 0.067 0.010 6.895 0.000 0.067 0.122
## .JS68 0.086 0.012 7.312 0.000 0.086 0.173
## .JS69 0.089 0.013 7.098 0.000 0.089 0.146
## .JS70 0.110 0.015 7.510 0.000 0.110 0.216
## .JS71 0.177 0.023 7.709 0.000 0.177 0.311
## .JS72 0.055 0.008 6.716 0.000 0.055 0.113
## .JS73 0.060 0.009 7.028 0.000 0.060 0.146
## .JS74 0.074 0.011 6.968 0.000 0.074 0.138
## .JS75 0.136 0.019 7.361 0.000 0.136 0.214
## .JS76 0.076 0.011 7.153 0.000 0.076 0.165
## .JS77 0.070 0.010 7.069 0.000 0.070 0.151
## TL 1.428 0.225 6.339 0.000 1.000 1.000
## .Direction 1.642 0.388 4.228 0.000 0.129 0.129
## .Cultivation 1.529 0.649 2.354 0.019 0.039 0.039
## .Organization -0.746 0.536 -1.392 0.164 -0.019 -0.019
## .Tutor 0.467 0.188 2.492 0.013 0.029 0.029
##
##
## Group 4 [15+]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 2.787 0.252 11.051 0.000 0.968 0.968
## Cultvtn (.p2.) 5.128 0.857 5.980 0.000 0.998 0.998
## Orgnztn (.p3.) 5.330 1.258 4.238 0.000 0.994 0.994
## Tutor (.p4.) 3.307 0.327 10.100 0.000 0.986 0.986
## Direction =~
## JS58 (.p5.) 0.192 0.015 12.902 0.000 0.667 0.932
## JS59 (.p6.) 0.204 0.016 12.932 0.000 0.708 0.933
## JS60 (.p7.) 0.210 0.016 12.934 0.000 0.728 0.923
## JS61 (.p8.) 0.186 0.015 12.764 0.000 0.647 0.881
## Cultivation =~
## JS62 (.p9.) 0.117 0.019 6.239 0.000 0.725 0.902
## JS63 (.10.) 0.105 0.017 6.241 0.000 0.650 0.908
## JS64 (.11.) 0.115 0.018 6.243 0.000 0.714 0.880
## JS65 (.12.) 0.121 0.019 6.248 0.000 0.747 0.941
## JS66 (.13.) 0.122 0.019 6.248 0.000 0.754 0.919
## JS67 (.14.) 0.111 0.018 6.238 0.000 0.686 0.911
## Organization =~
## JS68 (.15.) 0.101 0.023 4.325 0.000 0.657 0.910
## JS69 (.16.) 0.114 0.026 4.327 0.000 0.740 0.928
## JS70 (.17.) 0.100 0.023 4.323 0.000 0.648 0.902
## JS71 (.18.) 0.099 0.023 4.322 0.000 0.641 0.865
## Tutor =~
## JS72 (.19.) 0.163 0.014 11.358 0.000 0.662 0.916
## JS73 (.20.) 0.148 0.013 11.289 0.000 0.598 0.858
## JS74 (.21.) 0.170 0.015 11.420 0.000 0.688 0.935
## JS75 (.22.) 0.177 0.015 11.417 0.000 0.715 0.933
## JS76 (.23.) 0.154 0.014 11.313 0.000 0.623 0.860
## JS77 (.24.) 0.156 0.014 11.370 0.000 0.630 0.906
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.369 0.035 125.484 0.000 4.369 6.101
## .JS59 4.319 0.037 117.109 0.000 4.319 5.694
## .JS60 4.324 0.038 112.660 0.000 4.324 5.478
## .JS61 4.322 0.036 120.952 0.000 4.322 5.881
## .JS62 4.307 0.039 110.126 0.000 4.307 5.355
## .JS63 4.411 0.035 126.709 0.000 4.411 6.161
## .JS64 4.255 0.039 107.819 0.000 4.255 5.242
## .JS65 4.288 0.039 111.114 0.000 4.288 5.403
## .JS66 4.246 0.040 106.390 0.000 4.246 5.173
## .JS67 4.286 0.037 116.949 0.000 4.286 5.686
## .JS68 4.392 0.035 125.288 0.000 4.392 6.092
## .JS69 4.303 0.039 110.907 0.000 4.303 5.392
## .JS70 4.366 0.035 124.960 0.000 4.366 6.076
## .JS71 4.345 0.036 120.504 0.000 4.345 5.859
## .JS72 4.385 0.035 124.866 0.000 4.385 6.071
## .JS73 4.369 0.034 128.849 0.000 4.369 6.265
## .JS74 4.331 0.036 121.133 0.000 4.331 5.890
## .JS75 4.348 0.037 116.658 0.000 4.348 5.672
## .JS76 4.376 0.035 124.275 0.000 4.376 6.042
## .JS77 4.395 0.034 129.983 0.000 4.395 6.320
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.068 0.006 11.674 0.000 0.068 0.132
## .JS59 0.075 0.006 11.616 0.000 0.075 0.130
## .JS60 0.093 0.008 12.056 0.000 0.093 0.148
## .JS61 0.121 0.009 13.058 0.000 0.121 0.224
## .JS62 0.121 0.009 13.540 0.000 0.121 0.187
## .JS63 0.090 0.007 13.461 0.000 0.090 0.176
## .JS64 0.149 0.011 13.764 0.000 0.149 0.226
## .JS65 0.072 0.006 12.692 0.000 0.072 0.115
## .JS66 0.105 0.008 13.274 0.000 0.105 0.156
## .JS67 0.097 0.007 13.417 0.000 0.097 0.171
## .JS68 0.089 0.007 12.926 0.000 0.089 0.171
## .JS69 0.088 0.007 12.381 0.000 0.088 0.139
## .JS70 0.096 0.007 13.109 0.000 0.096 0.186
## .JS71 0.139 0.010 13.614 0.000 0.139 0.252
## .JS72 0.084 0.006 12.990 0.000 0.084 0.161
## .JS73 0.128 0.009 13.725 0.000 0.128 0.264
## .JS74 0.068 0.005 12.446 0.000 0.068 0.126
## .JS75 0.077 0.006 12.537 0.000 0.077 0.130
## .JS76 0.136 0.010 13.708 0.000 0.136 0.260
## .JS77 0.086 0.007 13.176 0.000 0.086 0.178
## TL 1.456 0.167 8.699 0.000 1.000 1.000
## .Direction 0.768 0.158 4.854 0.000 0.064 0.064
## .Cultivation 0.117 0.177 0.660 0.509 0.003 0.003
## .Organization 0.474 0.344 1.378 0.168 0.011 0.011
## .Tutor 0.451 0.123 3.672 0.000 0.028 0.028
# Check out the key indices for the model
# Put it into our table
table_fit[3,] <- c("Metric Model",round(fitmeasures(MG.fit.metric,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1783.761 | 170 | 0.944 | 0.1 | 0.019 |
| Configural Model | 3108.442 | 664 | 0.921 | 0.124 | 0.024 |
| Metric Model | 3277.199 | 721 | 0.917 | 0.122 | 0.058 |
| NA | NA | NA | NA | NA | NA |
# Running the CFA by group - Scalar or full score equivalence/invariance - constraining the factor loadings and intercepts to be equal.
# The final step is to test for scalar invariance to examine whether the item intercepts are equivalent across groups. In this case, we constrain the item intercepts to be equivalent, just as we did with the factor loadings in the previous step. If this results in a poorer multi-group model fit, we can conclude that the item intercepts are not similar for people of different teacher years groups.
# Ascertaining scalar invariance allows us to substantiate multi-group comparisons of factor means (e.g., t-tests or ANOVA), and we can be confident that any statistically significant differences in group means are not due to differences in scale properties at different teacher year groups.
MG.fit.scalar <- cfa(MG.model,
data = TL_TeacherYear,
group = "Teacher_year",
std.lv=T,
group.equal = c("loadings","intercepts")
)
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
# Request the summary of the model result
summary(MG.fit.scalar,fit.measures=T,standardized=T)
## lavaan 0.6-7 ended normally after 560 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 286
## Number of equality constraints 132
##
## Number of observations per group:
## 4-10 255
## 1-3 155
## 11-15 125
## 15+ 423
##
## Model Test User Model:
##
## Test statistic 3348.531
## Degrees of freedom 766
## P-value (Chi-square) 0.000
## Test statistic for each group:
## 4-10 782.403
## 1-3 1100.829
## 11-15 615.014
## 15+ 850.285
##
## Model Test Baseline Model:
##
## Test statistic 31669.539
## Degrees of freedom 760
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.916
## Tucker-Lewis Index (TLI) 0.917
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -6259.105
## Loglikelihood unrestricted model (H1) -4584.840
##
## Akaike (AIC) 12826.210
## Bayesian (BIC) 13575.397
## Sample-size adjusted Bayesian (BIC) 13086.298
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.119
## 90 Percent confidence interval - lower 0.115
## 90 Percent confidence interval - upper 0.123
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.058
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [4-10]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 2.788 0.253 11.034 0.000 0.941 0.941
## Cultvtn (.p2.) 5.125 0.858 5.975 0.000 0.981 0.981
## Orgnztn (.p3.) 5.408 1.313 4.118 0.000 0.983 0.983
## Tutor (.p4.) 3.314 0.329 10.076 0.000 0.957 0.957
## Direction =~
## JS58 (.p5.) 0.192 0.015 12.879 0.000 0.568 0.907
## JS59 (.p6.) 0.203 0.016 12.908 0.000 0.603 0.931
## JS60 (.p7.) 0.209 0.016 12.908 0.000 0.619 0.936
## JS61 (.p8.) 0.187 0.015 12.747 0.000 0.555 0.855
## Cultivation =~
## JS62 (.p9.) 0.117 0.019 6.233 0.000 0.608 0.858
## JS63 (.10.) 0.104 0.017 6.235 0.000 0.544 0.876
## JS64 (.11.) 0.116 0.019 6.238 0.000 0.603 0.886
## JS65 (.12.) 0.121 0.019 6.243 0.000 0.632 0.910
## JS66 (.13.) 0.122 0.020 6.243 0.000 0.638 0.911
## JS67 (.14.) 0.111 0.018 6.233 0.000 0.579 0.858
## Organization =~
## JS68 (.15.) 0.100 0.024 4.198 0.000 0.551 0.857
## JS69 (.16.) 0.113 0.027 4.200 0.000 0.623 0.891
## JS70 (.17.) 0.098 0.023 4.197 0.000 0.541 0.823
## JS71 (.18.) 0.097 0.023 4.196 0.000 0.535 0.811
## Tutor =~
## JS72 (.19.) 0.163 0.014 11.327 0.000 0.564 0.868
## JS73 (.20.) 0.148 0.013 11.261 0.000 0.513 0.836
## JS74 (.21.) 0.170 0.015 11.387 0.000 0.587 0.927
## JS75 (.22.) 0.177 0.016 11.384 0.000 0.611 0.922
## JS76 (.23.) 0.153 0.014 11.281 0.000 0.530 0.870
## JS77 (.24.) 0.155 0.014 11.338 0.000 0.537 0.890
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 (.50.) 4.600 0.037 124.217 0.000 4.600 7.340
## .JS59 (.51.) 4.561 0.039 116.576 0.000 4.561 7.046
## .JS60 (.52.) 4.553 0.040 113.247 0.000 4.553 6.887
## .JS61 (.53.) 4.569 0.037 123.918 0.000 4.569 7.042
## .JS62 (.54.) 4.516 0.040 112.656 0.000 4.516 6.364
## .JS63 (.55.) 4.591 0.036 128.320 0.000 4.591 7.401
## .JS64 (.56.) 4.511 0.040 114.088 0.000 4.511 6.629
## .JS65 (.57.) 4.538 0.041 110.607 0.000 4.538 6.542
## .JS66 (.58.) 4.504 0.042 107.821 0.000 4.504 6.433
## .JS67 (.59.) 4.517 0.038 118.280 0.000 4.517 6.690
## .JS68 (.60.) 4.602 0.037 124.743 0.000 4.602 7.161
## .JS69 (.61.) 4.549 0.041 109.835 0.000 4.549 6.503
## .JS70 (.62.) 4.560 0.037 124.812 0.000 4.560 6.935
## .JS71 (.63.) 4.526 0.036 124.219 0.000 4.526 6.858
## .JS72 (.64.) 4.562 0.037 123.252 0.000 4.562 7.025
## .JS73 (.65.) 4.569 0.034 133.887 0.000 4.569 7.443
## .JS74 (.66.) 4.529 0.038 118.714 0.000 4.529 7.145
## .JS75 (.67.) 4.546 0.040 114.607 0.000 4.546 6.860
## .JS76 (.68.) 4.542 0.035 129.161 0.000 4.542 7.462
## .JS77 (.69.) 4.565 0.035 129.606 0.000 4.565 7.560
## TL 0.000 0.000 0.000
## .Directn 0.000 0.000 0.000
## .Cultvtn 0.000 0.000 0.000
## .Orgnztn 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.070 0.007 9.342 0.000 0.070 0.178
## .JS59 0.056 0.007 8.538 0.000 0.056 0.134
## .JS60 0.054 0.007 8.292 0.000 0.054 0.124
## .JS61 0.113 0.011 10.156 0.000 0.113 0.268
## .JS62 0.133 0.013 10.365 0.000 0.133 0.265
## .JS63 0.089 0.009 10.183 0.000 0.089 0.232
## .JS64 0.099 0.010 10.061 0.000 0.099 0.214
## .JS65 0.082 0.009 9.657 0.000 0.082 0.171
## .JS66 0.083 0.009 9.642 0.000 0.083 0.170
## .JS67 0.120 0.012 10.360 0.000 0.120 0.264
## .JS68 0.110 0.011 9.881 0.000 0.110 0.266
## .JS69 0.101 0.011 9.235 0.000 0.101 0.206
## .JS70 0.140 0.014 10.251 0.000 0.140 0.323
## .JS71 0.149 0.014 10.342 0.000 0.149 0.342
## .JS72 0.104 0.010 10.213 0.000 0.104 0.247
## .JS73 0.114 0.011 10.476 0.000 0.114 0.302
## .JS74 0.057 0.006 9.121 0.000 0.057 0.141
## .JS75 0.066 0.007 9.260 0.000 0.066 0.150
## .JS76 0.090 0.009 10.184 0.000 0.090 0.242
## .JS77 0.076 0.008 9.941 0.000 0.076 0.208
## TL 1.000 1.000 1.000
## .Direction 1.000 0.114 0.114
## .Cultivation 1.000 0.037 0.037
## .Organization 1.000 0.033 0.033
## .Tutor 1.000 0.083 0.083
##
##
## Group 2 [1-3]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 2.788 0.253 11.034 0.000 0.966 0.966
## Cultvtn (.p2.) 5.125 0.858 5.975 0.000 0.987 0.987
## Orgnztn (.p3.) 5.408 1.313 4.118 0.000 1.008 1.008
## Tutor (.p4.) 3.314 0.329 10.076 0.000 0.997 0.997
## Direction =~
## JS58 (.p5.) 0.192 0.015 12.879 0.000 0.590 0.977
## JS59 (.p6.) 0.203 0.016 12.908 0.000 0.626 0.970
## JS60 (.p7.) 0.209 0.016 12.908 0.000 0.642 0.946
## JS61 (.p8.) 0.187 0.015 12.747 0.000 0.576 0.926
## Cultivation =~
## JS62 (.p9.) 0.117 0.019 6.233 0.000 0.644 0.937
## JS63 (.10.) 0.104 0.017 6.235 0.000 0.576 0.944
## JS64 (.11.) 0.116 0.019 6.238 0.000 0.639 0.966
## JS65 (.12.) 0.121 0.019 6.243 0.000 0.669 0.977
## JS66 (.13.) 0.122 0.020 6.243 0.000 0.676 0.890
## JS67 (.14.) 0.111 0.018 6.233 0.000 0.614 0.933
## Organization =~
## JS68 (.15.) 0.100 0.024 4.198 0.000 0.572 0.948
## JS69 (.16.) 0.113 0.027 4.200 0.000 0.648 0.961
## JS70 (.17.) 0.098 0.023 4.197 0.000 0.562 0.934
## JS71 (.18.) 0.097 0.023 4.196 0.000 0.556 0.923
## Tutor =~
## JS72 (.19.) 0.163 0.014 11.327 0.000 0.576 0.932
## JS73 (.20.) 0.148 0.013 11.261 0.000 0.524 0.912
## JS74 (.21.) 0.170 0.015 11.387 0.000 0.600 0.940
## JS75 (.22.) 0.177 0.016 11.384 0.000 0.625 0.971
## JS76 (.23.) 0.153 0.014 11.281 0.000 0.542 0.890
## JS77 (.24.) 0.155 0.014 11.338 0.000 0.549 0.940
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 (.50.) 4.600 0.037 124.217 0.000 4.600 7.621
## .JS59 (.51.) 4.561 0.039 116.576 0.000 4.561 7.073
## .JS60 (.52.) 4.553 0.040 113.247 0.000 4.553 6.703
## .JS61 (.53.) 4.569 0.037 123.918 0.000 4.569 7.342
## .JS62 (.54.) 4.516 0.040 112.656 0.000 4.516 6.566
## .JS63 (.55.) 4.591 0.036 128.320 0.000 4.591 7.528
## .JS64 (.56.) 4.511 0.040 114.088 0.000 4.511 6.821
## .JS65 (.57.) 4.538 0.041 110.607 0.000 4.538 6.631
## .JS66 (.58.) 4.504 0.042 107.821 0.000 4.504 5.931
## .JS67 (.59.) 4.517 0.038 118.280 0.000 4.517 6.869
## .JS68 (.60.) 4.602 0.037 124.743 0.000 4.602 7.627
## .JS69 (.61.) 4.549 0.041 109.835 0.000 4.549 6.747
## .JS70 (.62.) 4.560 0.037 124.812 0.000 4.560 7.574
## .JS71 (.63.) 4.526 0.036 124.219 0.000 4.526 7.509
## .JS72 (.64.) 4.562 0.037 123.252 0.000 4.562 7.377
## .JS73 (.65.) 4.569 0.034 133.887 0.000 4.569 7.950
## .JS74 (.66.) 4.529 0.038 118.714 0.000 4.529 7.090
## .JS75 (.67.) 4.546 0.040 114.607 0.000 4.546 7.068
## .JS76 (.68.) 4.542 0.035 129.161 0.000 4.542 7.463
## .JS77 (.69.) 4.565 0.035 129.606 0.000 4.565 7.815
## TL 0.057 0.106 0.537 0.591 0.053 0.053
## .Directn -0.233 0.103 -2.264 0.024 -0.076 -0.076
## .Cultvtn 0.007 0.104 0.064 0.949 0.001 0.001
## .Orgnztn -0.088 0.101 -0.870 0.384 -0.015 -0.015
## .Tutor 0.146 0.090 1.617 0.106 0.041 0.041
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.016 0.003 5.762 0.000 0.016 0.045
## .JS59 0.025 0.004 6.537 0.000 0.025 0.059
## .JS60 0.049 0.006 7.631 0.000 0.049 0.106
## .JS61 0.055 0.007 7.975 0.000 0.055 0.143
## .JS62 0.058 0.007 8.093 0.000 0.058 0.122
## .JS63 0.040 0.005 7.991 0.000 0.040 0.109
## .JS64 0.029 0.004 7.401 0.000 0.029 0.067
## .JS65 0.021 0.003 6.632 0.000 0.021 0.045
## .JS66 0.120 0.014 8.432 0.000 0.120 0.208
## .JS67 0.056 0.007 8.139 0.000 0.056 0.129
## .JS68 0.037 0.004 8.481 0.000 0.037 0.100
## .JS69 0.035 0.004 8.218 0.000 0.035 0.077
## .JS70 0.046 0.005 8.629 0.000 0.046 0.128
## .JS71 0.054 0.006 8.690 0.000 0.054 0.148
## .JS72 0.050 0.006 8.269 0.000 0.050 0.132
## .JS73 0.055 0.007 8.406 0.000 0.055 0.168
## .JS74 0.048 0.006 8.182 0.000 0.048 0.117
## .JS75 0.023 0.003 7.301 0.000 0.023 0.057
## .JS76 0.077 0.009 8.502 0.000 0.077 0.208
## .JS77 0.039 0.005 8.175 0.000 0.039 0.116
## TL 1.134 0.166 6.826 0.000 1.000 1.000
## .Direction 0.639 0.142 4.506 0.000 0.068 0.068
## .Cultivation 0.796 0.312 2.550 0.011 0.026 0.026
## .Organization -0.508 0.276 -1.839 0.066 -0.016 -0.016
## .Tutor 0.066 0.058 1.133 0.257 0.005 0.005
##
##
## Group 3 [11-15]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 2.788 0.253 11.034 0.000 0.933 0.933
## Cultvtn (.p2.) 5.125 0.858 5.975 0.000 0.980 0.980
## Orgnztn (.p3.) 5.408 1.313 4.118 0.000 1.010 1.010
## Tutor (.p4.) 3.314 0.329 10.076 0.000 0.985 0.985
## Direction =~
## JS58 (.p5.) 0.192 0.015 12.879 0.000 0.685 0.931
## JS59 (.p6.) 0.203 0.016 12.908 0.000 0.726 0.945
## JS60 (.p7.) 0.209 0.016 12.908 0.000 0.745 0.940
## JS61 (.p8.) 0.187 0.015 12.747 0.000 0.669 0.894
## Cultivation =~
## JS62 (.p9.) 0.117 0.019 6.233 0.000 0.728 0.953
## JS63 (.10.) 0.104 0.017 6.235 0.000 0.651 0.896
## JS64 (.11.) 0.116 0.019 6.238 0.000 0.722 0.919
## JS65 (.12.) 0.121 0.019 6.243 0.000 0.756 0.938
## JS66 (.13.) 0.122 0.020 6.243 0.000 0.763 0.931
## JS67 (.14.) 0.111 0.018 6.233 0.000 0.693 0.937
## Organization =~
## JS68 (.15.) 0.100 0.024 4.198 0.000 0.641 0.909
## JS69 (.16.) 0.113 0.027 4.200 0.000 0.725 0.925
## JS70 (.17.) 0.098 0.023 4.197 0.000 0.630 0.883
## JS71 (.18.) 0.097 0.023 4.196 0.000 0.623 0.829
## Tutor =~
## JS72 (.19.) 0.163 0.014 11.327 0.000 0.654 0.942
## JS73 (.20.) 0.148 0.013 11.261 0.000 0.595 0.924
## JS74 (.21.) 0.170 0.015 11.387 0.000 0.682 0.929
## JS75 (.22.) 0.177 0.016 11.384 0.000 0.709 0.884
## JS76 (.23.) 0.153 0.014 11.281 0.000 0.615 0.912
## JS77 (.24.) 0.155 0.014 11.338 0.000 0.624 0.921
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 (.50.) 4.600 0.037 124.217 0.000 4.600 6.254
## .JS59 (.51.) 4.561 0.039 116.576 0.000 4.561 5.939
## .JS60 (.52.) 4.553 0.040 113.247 0.000 4.553 5.740
## .JS61 (.53.) 4.569 0.037 123.918 0.000 4.569 6.110
## .JS62 (.54.) 4.516 0.040 112.656 0.000 4.516 5.913
## .JS63 (.55.) 4.591 0.036 128.320 0.000 4.591 6.327
## .JS64 (.56.) 4.511 0.040 114.088 0.000 4.511 5.745
## .JS65 (.57.) 4.538 0.041 110.607 0.000 4.538 5.633
## .JS66 (.58.) 4.504 0.042 107.821 0.000 4.504 5.494
## .JS67 (.59.) 4.517 0.038 118.280 0.000 4.517 6.107
## .JS68 (.60.) 4.602 0.037 124.743 0.000 4.602 6.530
## .JS69 (.61.) 4.549 0.041 109.835 0.000 4.549 5.799
## .JS70 (.62.) 4.560 0.037 124.812 0.000 4.560 6.395
## .JS71 (.63.) 4.526 0.036 124.219 0.000 4.526 6.020
## .JS72 (.64.) 4.562 0.037 123.252 0.000 4.562 6.568
## .JS73 (.65.) 4.569 0.034 133.887 0.000 4.569 7.094
## .JS74 (.66.) 4.529 0.038 118.714 0.000 4.529 6.169
## .JS75 (.67.) 4.546 0.040 114.607 0.000 4.546 5.668
## .JS76 (.68.) 4.542 0.035 129.161 0.000 4.542 6.733
## .JS77 (.69.) 4.565 0.035 129.606 0.000 4.565 6.738
## TL -0.254 0.124 -2.042 0.041 -0.212 -0.212
## .Directn -0.089 0.144 -0.619 0.536 -0.025 -0.025
## .Cultvtn -0.205 0.136 -1.507 0.132 -0.033 -0.033
## .Orgnztn -0.188 0.132 -1.421 0.155 -0.029 -0.029
## .Tutor 0.118 0.116 1.014 0.310 0.029 0.029
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.072 0.011 6.314 0.000 0.072 0.133
## .JS59 0.063 0.011 5.844 0.000 0.063 0.106
## .JS60 0.073 0.012 6.050 0.000 0.073 0.117
## .JS61 0.112 0.016 6.940 0.000 0.112 0.200
## .JS62 0.053 0.008 6.494 0.000 0.053 0.091
## .JS63 0.103 0.014 7.335 0.000 0.103 0.196
## .JS64 0.095 0.013 7.143 0.000 0.095 0.155
## .JS65 0.078 0.011 6.875 0.000 0.078 0.120
## .JS66 0.090 0.013 6.993 0.000 0.090 0.133
## .JS67 0.066 0.010 6.889 0.000 0.066 0.121
## .JS68 0.086 0.012 7.319 0.000 0.086 0.173
## .JS69 0.089 0.013 7.101 0.000 0.089 0.145
## .JS70 0.112 0.015 7.531 0.000 0.112 0.220
## .JS71 0.177 0.023 7.718 0.000 0.177 0.313
## .JS72 0.054 0.008 6.714 0.000 0.054 0.113
## .JS73 0.060 0.009 7.023 0.000 0.060 0.145
## .JS74 0.074 0.011 6.963 0.000 0.074 0.137
## .JS75 0.140 0.019 7.372 0.000 0.140 0.218
## .JS76 0.077 0.011 7.170 0.000 0.077 0.169
## .JS77 0.070 0.010 7.071 0.000 0.070 0.152
## TL 1.428 0.225 6.339 0.000 1.000 1.000
## .Direction 1.640 0.389 4.220 0.000 0.129 0.129
## .Cultivation 1.536 0.652 2.356 0.018 0.039 0.039
## .Organization -0.796 0.567 -1.403 0.161 -0.019 -0.019
## .Tutor 0.468 0.188 2.482 0.013 0.029 0.029
##
##
## Group 4 [15+]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 2.788 0.253 11.034 0.000 0.968 0.968
## Cultvtn (.p2.) 5.125 0.858 5.975 0.000 0.998 0.998
## Orgnztn (.p3.) 5.408 1.313 4.118 0.000 0.994 0.994
## Tutor (.p4.) 3.314 0.329 10.076 0.000 0.986 0.986
## Direction =~
## JS58 (.p5.) 0.192 0.015 12.879 0.000 0.667 0.932
## JS59 (.p6.) 0.203 0.016 12.908 0.000 0.707 0.933
## JS60 (.p7.) 0.209 0.016 12.908 0.000 0.726 0.922
## JS61 (.p8.) 0.187 0.015 12.747 0.000 0.651 0.882
## Cultivation =~
## JS62 (.p9.) 0.117 0.019 6.233 0.000 0.722 0.900
## JS63 (.10.) 0.104 0.017 6.235 0.000 0.645 0.905
## JS64 (.11.) 0.116 0.019 6.238 0.000 0.716 0.880
## JS65 (.12.) 0.121 0.019 6.243 0.000 0.749 0.941
## JS66 (.13.) 0.122 0.020 6.243 0.000 0.757 0.919
## JS67 (.14.) 0.111 0.018 6.233 0.000 0.687 0.911
## Organization =~
## JS68 (.15.) 0.100 0.024 4.198 0.000 0.657 0.911
## JS69 (.16.) 0.113 0.027 4.200 0.000 0.744 0.929
## JS70 (.17.) 0.098 0.023 4.197 0.000 0.646 0.901
## JS71 (.18.) 0.097 0.023 4.196 0.000 0.639 0.864
## Tutor =~
## JS72 (.19.) 0.163 0.014 11.327 0.000 0.660 0.915
## JS73 (.20.) 0.148 0.013 11.261 0.000 0.601 0.858
## JS74 (.21.) 0.170 0.015 11.387 0.000 0.688 0.935
## JS75 (.22.) 0.177 0.016 11.384 0.000 0.716 0.933
## JS76 (.23.) 0.153 0.014 11.281 0.000 0.621 0.859
## JS77 (.24.) 0.155 0.014 11.338 0.000 0.629 0.906
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 (.50.) 4.600 0.037 124.217 0.000 4.600 6.424
## .JS59 (.51.) 4.561 0.039 116.576 0.000 4.561 6.016
## .JS60 (.52.) 4.553 0.040 113.247 0.000 4.553 5.779
## .JS61 (.53.) 4.569 0.037 123.918 0.000 4.569 6.186
## .JS62 (.54.) 4.516 0.040 112.656 0.000 4.516 5.633
## .JS63 (.55.) 4.591 0.036 128.320 0.000 4.591 6.446
## .JS64 (.56.) 4.511 0.040 114.088 0.000 4.511 5.545
## .JS65 (.57.) 4.538 0.041 110.607 0.000 4.538 5.701
## .JS66 (.58.) 4.504 0.042 107.821 0.000 4.504 5.472
## .JS67 (.59.) 4.517 0.038 118.280 0.000 4.517 5.986
## .JS68 (.60.) 4.602 0.037 124.743 0.000 4.602 6.377
## .JS69 (.61.) 4.549 0.041 109.835 0.000 4.549 5.680
## .JS70 (.62.) 4.560 0.037 124.812 0.000 4.560 6.365
## .JS71 (.63.) 4.526 0.036 124.219 0.000 4.526 6.121
## .JS72 (.64.) 4.562 0.037 123.252 0.000 4.562 6.325
## .JS73 (.65.) 4.569 0.034 133.887 0.000 4.569 6.524
## .JS74 (.66.) 4.529 0.038 118.714 0.000 4.529 6.155
## .JS75 (.67.) 4.546 0.040 114.607 0.000 4.546 5.923
## .JS76 (.68.) 4.542 0.035 129.161 0.000 4.542 6.289
## .JS77 (.69.) 4.565 0.035 129.606 0.000 4.565 6.571
## TL -0.353 0.087 -4.043 0.000 -0.293 -0.293
## .Directn -0.207 0.094 -2.204 0.028 -0.060 -0.060
## .Cultvtn -0.193 0.098 -1.971 0.049 -0.031 -0.031
## .Orgnztn -0.145 0.107 -1.357 0.175 -0.022 -0.022
## .Tutor 0.031 0.091 0.338 0.735 0.008 0.008
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.068 0.006 11.671 0.000 0.068 0.132
## .JS59 0.075 0.006 11.614 0.000 0.075 0.130
## .JS60 0.093 0.008 12.088 0.000 0.093 0.150
## .JS61 0.121 0.009 13.044 0.000 0.121 0.222
## .JS62 0.122 0.009 13.555 0.000 0.122 0.189
## .JS63 0.091 0.007 13.489 0.000 0.091 0.180
## .JS64 0.150 0.011 13.763 0.000 0.150 0.226
## .JS65 0.072 0.006 12.672 0.000 0.072 0.114
## .JS66 0.105 0.008 13.265 0.000 0.105 0.155
## .JS67 0.097 0.007 13.412 0.000 0.097 0.170
## .JS68 0.089 0.007 12.926 0.000 0.089 0.171
## .JS69 0.088 0.007 12.356 0.000 0.088 0.138
## .JS70 0.096 0.007 13.128 0.000 0.096 0.188
## .JS71 0.139 0.010 13.626 0.000 0.139 0.254
## .JS72 0.084 0.006 12.999 0.000 0.084 0.162
## .JS73 0.129 0.009 13.724 0.000 0.129 0.264
## .JS74 0.068 0.005 12.442 0.000 0.068 0.126
## .JS75 0.076 0.006 12.525 0.000 0.076 0.130
## .JS76 0.136 0.010 13.714 0.000 0.136 0.261
## .JS77 0.086 0.007 13.179 0.000 0.086 0.179
## TL 1.456 0.167 8.699 0.000 1.000 1.000
## .Direction 0.769 0.159 4.846 0.000 0.064 0.064
## .Cultivation 0.117 0.177 0.660 0.509 0.003 0.003
## .Organization 0.480 0.356 1.350 0.177 0.011 0.011
## .Tutor 0.453 0.124 3.667 0.000 0.028 0.028
# Check out the key indices for the model
# Put it into our table
table_fit[4,] <- c("Scalar Model",round(fitmeasures(MG.fit.scalar,c("chisq","df","cfi","rmsea","srmr")),3))
fitmeasures(MG.fit.scalar)
## npar fmin chisq df
## 154.000 1.748 3348.531 766.000
## pvalue baseline.chisq baseline.df baseline.pvalue
## 0.000 31669.539 760.000 0.000
## cfi tli nnfi rfi
## 0.916 0.917 0.917 NA
## nfi pnfi ifi rni
## NA 0.901 0.916 0.916
## logl unrestricted.logl aic bic
## -6259.105 -4584.840 12826.210 13575.397
## ntotal bic2 rmsea rmsea.ci.lower
## 958.000 13086.298 0.119 0.115
## rmsea.ci.upper rmsea.pvalue rmr rmr_nomean
## 0.123 0.000 0.028 0.028
## srmr srmr_bentler srmr_bentler_nomean crmr
## 0.058 0.058 0.060 0.085
## crmr_nomean srmr_mplus srmr_mplus_nomean cn_05
## 0.028 0.084 0.036 238.888
## cn_01 gfi agfi pgfi
## 247.038 0.961 0.954 0.800
## mfi
## 0.260
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1783.761 | 170 | 0.944 | 0.1 | 0.019 |
| Configural Model | 3108.442 | 664 | 0.921 | 0.124 | 0.024 |
| Metric Model | 3277.199 | 721 | 0.917 | 0.122 | 0.058 |
| Scalar Model | 3348.531 | 766 | 0.916 | 0.119 | 0.058 |
# Comparing all the models
anova(overall.fit,MG.fit.configural,MG.fit.metric,MG.fit.scalar)
## Chi-Squared Difference Test
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## overall.fit 170 14246 14538 1783.8
## MG.fit.configural 664 12790 14036 3108.4 1324.68 494 < 2.2e-16 ***
## MG.fit.metric 721 12845 13813 3277.2 168.76 57 5.438e-13 ***
## MG.fit.scalar 766 12826 13575 3348.5 71.33 45 0.007464 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Pooling out the data
TL_EDBG <- TL_ML[,-c(21,23,24)]
# Check the freq table
table(TL_EDBG$Education_background)
##
## 1 2 3 4
## 127 821 5 5
# Subset the dataset
TL_EDBG <- subset(TL_EDBG,Education_background<3)
# Specify the data
TL_EDBG$Education_background <- factor(TL_EDBG$Education_background,
levels=c(1,2),
labels=c("Associate","Bachelor"))
# Build a overall model
overall.model <- '
TL =~ JS58+JS59+JS60+JS61+JS62+JS63+JS64+JS65+JS66+JS67+JS68+JS69+JS70+JS71+JS72+JS73+JS74+JS75+JS76+JS77
'
# Run the model
overall.fit <- cfa(model = overall.model,
data= TL_EDBG,
meanstructure = TRUE)
# Request the summary
summary(overall.fit,
standardized = TRUE,
rsquare = TRUE,
fit.measure = TRUE)
## lavaan 0.6-7 ended normally after 83 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 60
##
## Number of observations 948
##
## Model Test User Model:
##
## Test statistic 1763.445
## Degrees of freedom 170
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 28799.388
## Degrees of freedom 190
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.944
## Tucker-Lewis Index (TLI) 0.938
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -7008.458
## Loglikelihood unrestricted model (H1) -6126.735
##
## Akaike (AIC) 14136.915
## Bayesian (BIC) 14428.176
## Sample-size adjusted Bayesian (BIC) 14237.620
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.099
## 90 Percent confidence interval - lower 0.095
## 90 Percent confidence interval - upper 0.104
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.019
##
## 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
## TL =~
## JS58 1.000 0.606 0.896
## JS59 1.076 0.024 44.962 0.000 0.652 0.907
## JS60 1.106 0.025 44.474 0.000 0.671 0.903
## JS61 1.008 0.025 40.939 0.000 0.611 0.873
## JS62 1.130 0.026 44.155 0.000 0.685 0.900
## JS63 1.006 0.023 44.183 0.000 0.610 0.901
## JS64 1.121 0.026 43.273 0.000 0.680 0.893
## JS65 1.193 0.025 48.606 0.000 0.724 0.933
## JS66 1.186 0.026 45.344 0.000 0.719 0.910
## JS67 1.079 0.024 44.165 0.000 0.654 0.901
## JS68 1.012 0.023 44.107 0.000 0.614 0.900
## JS69 1.170 0.025 46.985 0.000 0.710 0.922
## JS70 0.985 0.024 41.006 0.000 0.597 0.874
## JS71 0.972 0.026 38.071 0.000 0.589 0.845
## JS72 1.045 0.023 45.820 0.000 0.634 0.913
## JS73 0.946 0.024 40.059 0.000 0.574 0.865
## JS74 1.075 0.023 47.057 0.000 0.652 0.922
## JS75 1.140 0.024 46.967 0.000 0.692 0.922
## JS76 0.953 0.024 39.006 0.000 0.578 0.855
## JS77 0.964 0.022 43.152 0.000 0.585 0.892
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.482 0.022 203.795 0.000 4.482 6.619
## .JS59 4.431 0.023 189.677 0.000 4.431 6.160
## .JS60 4.424 0.024 183.298 0.000 4.424 5.953
## .JS61 4.447 0.023 195.646 0.000 4.447 6.354
## .JS62 4.399 0.025 177.926 0.000 4.399 5.779
## .JS63 4.493 0.022 204.216 0.000 4.493 6.633
## .JS64 4.387 0.025 177.514 0.000 4.387 5.765
## .JS65 4.405 0.025 174.843 0.000 4.405 5.679
## .JS66 4.378 0.026 170.448 0.000 4.378 5.536
## .JS67 4.404 0.024 186.662 0.000 4.404 6.063
## .JS68 4.501 0.022 203.191 0.000 4.501 6.599
## .JS69 4.426 0.025 177.024 0.000 4.426 5.749
## .JS70 4.458 0.022 200.713 0.000 4.458 6.519
## .JS71 4.420 0.023 195.167 0.000 4.420 6.339
## .JS72 4.478 0.023 198.674 0.000 4.478 6.453
## .JS73 4.485 0.022 208.273 0.000 4.485 6.764
## .JS74 4.439 0.023 193.392 0.000 4.439 6.281
## .JS75 4.443 0.024 182.284 0.000 4.443 5.920
## .JS76 4.461 0.022 203.102 0.000 4.461 6.596
## .JS77 4.485 0.021 210.817 0.000 4.485 6.847
## TL 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.091 0.004 20.746 0.000 0.091 0.198
## .JS59 0.092 0.004 20.602 0.000 0.092 0.178
## .JS60 0.102 0.005 20.655 0.000 0.102 0.185
## .JS61 0.116 0.006 20.961 0.000 0.116 0.238
## .JS62 0.110 0.005 20.688 0.000 0.110 0.189
## .JS63 0.087 0.004 20.685 0.000 0.087 0.189
## .JS64 0.117 0.006 20.772 0.000 0.117 0.202
## .JS65 0.078 0.004 20.076 0.000 0.078 0.130
## .JS66 0.108 0.005 20.558 0.000 0.108 0.173
## .JS67 0.100 0.005 20.687 0.000 0.100 0.189
## .JS68 0.088 0.004 20.692 0.000 0.088 0.190
## .JS69 0.089 0.004 20.343 0.000 0.089 0.151
## .JS70 0.111 0.005 20.956 0.000 0.111 0.237
## .JS71 0.139 0.007 21.138 0.000 0.139 0.285
## .JS72 0.080 0.004 20.500 0.000 0.080 0.166
## .JS73 0.111 0.005 21.021 0.000 0.111 0.252
## .JS74 0.075 0.004 20.333 0.000 0.075 0.150
## .JS75 0.085 0.004 20.346 0.000 0.085 0.151
## .JS76 0.123 0.006 21.086 0.000 0.123 0.269
## .JS77 0.087 0.004 20.783 0.000 0.087 0.204
## TL 0.368 0.021 17.779 0.000 1.000 1.000
##
## R-Square:
## Estimate
## JS58 0.802
## JS59 0.822
## JS60 0.815
## JS61 0.762
## JS62 0.811
## JS63 0.811
## JS64 0.798
## JS65 0.870
## JS66 0.827
## JS67 0.811
## JS68 0.810
## JS69 0.849
## JS70 0.763
## JS71 0.715
## JS72 0.834
## JS73 0.748
## JS74 0.850
## JS75 0.849
## JS76 0.731
## JS77 0.796
# Make a table to compare all the models
table_fit <- matrix(NA,nrow=4,ncol=6)
colnames(table_fit) <- c("Model","X2","df","CFI","RMSEA","SRMR")
# Put the overall model results into our table
table_fit[1,] <- c("Overall Model",round(fitmeasures(overall.fit,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1763.445 | 170 | 0.944 | 0.099 | 0.019 |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
# Create a SEM plot
semPaths(overall.fit,
whatLabels = "std",
layout="tree")
# The 1st row is the factor loading
# The 2nd row below the Items is the variances
# The 3nd row is the estimates
# Build the model
MG.model <- '
TL=~Direction+Cultivation+Organization+Tutor
Direction=~JS58+JS59+JS60+JS61
Cultivation=~JS62+JS63+JS64+JS65+JS66+JS67
Organization=~JS68+JS69+JS70+JS71
Tutor=~JS72+JS73+JS74+JS75+JS76+JS77
'
# Running the CFA by group - structural equivalence - configural invariance
# In this case, a configural invariance test allows you to examine whether the overall factor structure stipulated by our measure fits well for both Ed background groups in our sample. As with a typical CFA, we start by specifying the relationships between each item in the measure we’re using and the latent factor(s) that the items are stipulated to measure.
MG.fit.configural <- cfa(MG.model,
data = TL_EDBG,
group = "Education_background",
std.lv=T,
)
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
## but not all elements of the gradient are (near) zero;
## the optimizer may not have found a local solution
## use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
## but not all elements of the gradient are (near) zero;
## the optimizer may not have found a local solution
## use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
## but not all elements of the gradient are (near) zero;
## the optimizer may not have found a local solution
## use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
## but not all elements of the gradient are (near) zero;
## the optimizer may not have found a local solution
## use check.gradient = FALSE to skip this check.
# The result shows the model is not converge
# Request the summary of the model result
summary(MG.fit.configural,fit.measures=T,standardized=T)
## lavaan 0.6-7 did NOT end normally after 1237 iterations
## ** WARNING ** Estimates below are most likely unreliable
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 128
##
## Number of observations per group:
## Bachelor 821
## Associate 127
##
## Model Test User Model:
##
## Test statistic NA
## Degrees of freedom NA
## Test statistic for each group:
## Bachelor NA
## Associate NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [Bachelor]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Direction 3.510 NA 0.962 0.962
## Cultivation 7.232 NA 0.991 0.991
## Organization 10.077 NA 0.995 0.995
## Tutor 5.457 NA 0.984 0.984
## Direction =~
## JS58 0.174 NA 0.634 0.932
## JS59 0.185 NA 0.677 0.945
## JS60 0.190 NA 0.692 0.938
## JS61 0.169 NA 0.617 0.878
## Cultivation =~
## JS62 0.095 NA 0.696 0.911
## JS63 0.085 NA 0.618 0.902
## JS64 0.095 NA 0.695 0.909
## JS65 0.102 NA 0.747 0.944
## JS66 0.101 NA 0.736 0.920
## JS67 0.092 NA 0.670 0.912
## Organization =~
## JS68 0.061 NA 0.622 0.906
## JS69 0.072 NA 0.728 0.929
## JS70 0.061 NA 0.616 0.891
## JS71 0.059 NA 0.598 0.853
## Tutor =~
## JS72 0.116 NA 0.642 0.916
## JS73 0.104 NA 0.577 0.870
## JS74 0.121 NA 0.669 0.938
## JS75 0.128 NA 0.711 0.938
## JS76 0.105 NA 0.582 0.872
## JS77 0.107 NA 0.594 0.906
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.497 NA 4.497 6.617
## .JS59 4.451 NA 4.451 6.213
## .JS60 4.442 NA 4.442 6.024
## .JS61 4.463 NA 4.463 6.345
## .JS62 4.417 NA 4.417 5.779
## .JS63 4.505 NA 4.505 6.577
## .JS64 4.407 NA 4.407 5.763
## .JS65 4.417 NA 4.417 5.584
## .JS66 4.395 NA 4.395 5.490
## .JS67 4.419 NA 4.419 6.010
## .JS68 4.518 NA 4.518 6.580
## .JS69 4.435 NA 4.435 5.662
## .JS70 4.468 NA 4.468 6.462
## .JS71 4.431 NA 4.431 6.322
## .JS72 4.487 NA 4.487 6.404
## .JS73 4.499 NA 4.499 6.783
## .JS74 4.452 NA 4.452 6.244
## .JS75 4.449 NA 4.449 5.874
## .JS76 4.481 NA 4.481 6.721
## .JS77 4.501 NA 4.501 6.861
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.060 NA 0.060 0.131
## .JS59 0.055 NA 0.055 0.108
## .JS60 0.065 NA 0.065 0.120
## .JS61 0.113 NA 0.113 0.229
## .JS62 0.099 NA 0.099 0.170
## .JS63 0.088 NA 0.088 0.187
## .JS64 0.102 NA 0.102 0.174
## .JS65 0.068 NA 0.068 0.108
## .JS66 0.098 NA 0.098 0.154
## .JS67 0.091 NA 0.091 0.169
## .JS68 0.084 NA 0.084 0.179
## .JS69 0.084 NA 0.084 0.137
## .JS70 0.099 NA 0.099 0.207
## .JS71 0.134 NA 0.134 0.273
## .JS72 0.079 NA 0.079 0.160
## .JS73 0.107 NA 0.107 0.243
## .JS74 0.061 NA 0.061 0.120
## .JS75 0.069 NA 0.069 0.120
## .JS76 0.106 NA 0.106 0.239
## .JS77 0.077 NA 0.077 0.179
## TL 1.000 1.000 1.000
## .Direction 1.000 0.075 0.075
## .Cultivation 1.000 0.019 0.019
## .Organization 1.000 0.010 0.010
## .Tutor 1.000 0.032 0.032
##
##
## Group 2 [Associate]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Direction 2.659 NA 0.936 0.936
## Cultivation 6.730 NA 0.989 0.989
## Organization 416.789 NA 1.000 1.000
## Tutor 5.342 NA 0.983 0.983
## Direction =~
## JS58 0.212 NA 0.601 0.921
## JS59 0.233 NA 0.662 0.911
## JS60 0.243 NA 0.691 0.899
## JS61 0.211 NA 0.600 0.898
## Cultivation =~
## JS62 0.093 NA 0.633 0.867
## JS63 0.083 NA 0.564 0.911
## JS64 0.088 NA 0.596 0.825
## JS65 0.091 NA 0.616 0.927
## JS66 0.094 NA 0.642 0.898
## JS67 0.085 NA 0.579 0.880
## Organization =~
## JS68 0.001 NA 0.556 0.866
## JS69 0.002 NA 0.626 0.930
## JS70 0.001 NA 0.517 0.822
## JS71 0.001 NA 0.571 0.854
## Tutor =~
## JS72 0.106 NA 0.575 0.891
## JS73 0.105 NA 0.571 0.872
## JS74 0.111 NA 0.601 0.912
## JS75 0.117 NA 0.637 0.909
## JS76 0.117 NA 0.636 0.882
## JS77 0.108 NA 0.586 0.915
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.386 NA 4.386 6.720
## .JS59 4.307 NA 4.307 5.929
## .JS60 4.307 NA 4.307 5.604
## .JS61 4.346 NA 4.346 6.502
## .JS62 4.283 NA 4.283 5.863
## .JS63 4.409 NA 4.409 7.120
## .JS64 4.260 NA 4.260 5.890
## .JS65 4.331 NA 4.331 6.515
## .JS66 4.268 NA 4.268 5.970
## .JS67 4.307 NA 4.307 6.544
## .JS68 4.394 NA 4.394 6.846
## .JS69 4.370 NA 4.370 6.489
## .JS70 4.394 NA 4.394 6.981
## .JS71 4.346 NA 4.346 6.502
## .JS72 4.417 NA 4.417 6.846
## .JS73 4.394 NA 4.394 6.719
## .JS74 4.354 NA 4.354 6.613
## .JS75 4.402 NA 4.402 6.273
## .JS76 4.331 NA 4.331 6.002
## .JS77 4.386 NA 4.386 6.848
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.064 NA 0.064 0.151
## .JS59 0.089 NA 0.089 0.169
## .JS60 0.113 NA 0.113 0.191
## .JS61 0.087 NA 0.087 0.194
## .JS62 0.133 NA 0.133 0.248
## .JS63 0.065 NA 0.065 0.171
## .JS64 0.167 NA 0.167 0.320
## .JS65 0.062 NA 0.062 0.140
## .JS66 0.099 NA 0.099 0.194
## .JS67 0.098 NA 0.098 0.226
## .JS68 0.103 NA 0.103 0.249
## .JS69 0.061 NA 0.061 0.135
## .JS70 0.128 NA 0.128 0.324
## .JS71 0.121 NA 0.121 0.271
## .JS72 0.086 NA 0.086 0.206
## .JS73 0.102 NA 0.102 0.239
## .JS74 0.073 NA 0.073 0.168
## .JS75 0.086 NA 0.086 0.174
## .JS76 0.116 NA 0.116 0.222
## .JS77 0.066 NA 0.066 0.162
## TL 1.000 1.000 1.000
## .Direction 1.000 0.124 0.124
## .Cultivation 1.000 0.022 0.022
## .Organization 1.000 0.000 0.000
## .Tutor 1.000 0.034 0.034
# Check out the key indices for the model
# Put it into our table
# table_fit[2,] <- c("Configural Model",round(fitmeasures(MG.fit.configural,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1763.445 | 170 | 0.944 | 0.099 | 0.019 |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
# Running the CFA by group - metric equivalence/invariance - constraining the factor loadings to be equal.
# The next step is to test for metric invariance to examine whether the factor loadings are equivalent across the groups. This time, we constrain the factor loadings to be equivalent across groups, while still allowing the item intercepts to vary freely as before. A good multi-group model fit indicates metric invariance — if constraining the factor loadings in this way results in a poorer fit, it suggests that the factor loadings are not similar across education background groups.
# Ascertaining metric invariance allows you to substantiate multi-group comparisons of factor variances and covariances, since metric invariance indicates that each item of the scale loads onto the specified latent factor in a similar manner and with similar magnitude across groups. As such, we can assume that differences in factor variances and covariances are not attributable to education background based differences in the properties of the scales themselves.
MG.fit.metric <- cfa(MG.model,
data = TL_EDBG,
group = "Education_background",
std.lv=T,
group.equal = "loadings"
)
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
# Request the summary of the model result
summary(MG.fit.metric,fit.measures=T,standardized=T)
## lavaan 0.6-7 ended normally after 252 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 133
## Number of equality constraints 24
##
## Number of observations per group:
## Bachelor 821
## Associate 127
##
## Model Test User Model:
##
## Test statistic 1762.943
## Degrees of freedom 351
## P-value (Chi-square) 0.000
## Test statistic for each group:
## Bachelor 1127.665
## Associate 635.277
##
## Model Test Baseline Model:
##
## Test statistic 29391.691
## Degrees of freedom 380
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.951
## Tucker-Lewis Index (TLI) 0.947
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -6670.735
## Loglikelihood unrestricted model (H1) -5789.264
##
## Akaike (AIC) 13559.470
## Bayesian (BIC) 14088.594
## Sample-size adjusted Bayesian (BIC) 13742.416
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.092
## 90 Percent confidence interval - lower 0.088
## 90 Percent confidence interval - upper 0.096
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.025
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [Bachelor]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 3.535 0.188 18.789 0.000 0.962 0.962
## Cultvtn (.p2.) 7.115 0.753 9.443 0.000 0.990 0.990
## Orgnztn (.p3.) 10.000 2.496 4.007 0.000 0.995 0.995
## Tutor (.p4.) 5.512 0.416 13.249 0.000 0.984 0.984
## Direction =~
## JS58 (.p5.) 0.173 0.008 21.666 0.000 0.634 0.932
## JS59 (.p6.) 0.185 0.008 21.809 0.000 0.679 0.945
## JS60 (.p7.) 0.189 0.009 21.734 0.000 0.696 0.939
## JS61 (.p8.) 0.169 0.008 20.955 0.000 0.620 0.879
## Cultivation =~
## JS62 (.p9.) 0.097 0.010 9.747 0.000 0.697 0.911
## JS63 (.10.) 0.086 0.009 9.737 0.000 0.619 0.902
## JS64 (.11.) 0.096 0.010 9.742 0.000 0.692 0.908
## JS65 (.12.) 0.103 0.011 9.784 0.000 0.740 0.943
## JS66 (.13.) 0.102 0.010 9.758 0.000 0.734 0.919
## JS67 (.14.) 0.093 0.010 9.747 0.000 0.667 0.911
## Organization =~
## JS68 (.15.) 0.062 0.015 4.038 0.000 0.622 0.906
## JS69 (.16.) 0.072 0.018 4.038 0.000 0.724 0.928
## JS70 (.17.) 0.061 0.015 4.037 0.000 0.612 0.890
## JS71 (.18.) 0.060 0.015 4.034 0.000 0.602 0.854
## Tutor =~
## JS72 (.19.) 0.115 0.008 14.068 0.000 0.642 0.916
## JS73 (.20.) 0.104 0.008 13.891 0.000 0.584 0.873
## JS74 (.21.) 0.119 0.008 14.145 0.000 0.669 0.938
## JS75 (.22.) 0.127 0.009 14.145 0.000 0.710 0.938
## JS76 (.23.) 0.106 0.008 13.903 0.000 0.594 0.877
## JS77 (.24.) 0.107 0.008 14.039 0.000 0.601 0.908
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.497 0.024 189.365 0.000 4.497 6.609
## .JS59 4.451 0.025 177.398 0.000 4.451 6.191
## .JS60 4.442 0.026 171.784 0.000 4.442 5.995
## .JS61 4.463 0.025 181.199 0.000 4.463 6.324
## .JS62 4.417 0.027 165.523 0.000 4.417 5.777
## .JS63 4.505 0.024 188.108 0.000 4.505 6.565
## .JS64 4.407 0.027 165.639 0.000 4.407 5.781
## .JS65 4.417 0.027 161.394 0.000 4.417 5.633
## .JS66 4.395 0.028 157.773 0.000 4.395 5.506
## .JS67 4.419 0.026 172.814 0.000 4.419 6.031
## .JS68 4.518 0.024 188.598 0.000 4.518 6.582
## .JS69 4.435 0.027 163.001 0.000 4.435 5.689
## .JS70 4.468 0.024 185.972 0.000 4.468 6.490
## .JS71 4.431 0.025 180.172 0.000 4.431 6.288
## .JS72 4.487 0.024 183.555 0.000 4.487 6.406
## .JS73 4.499 0.023 192.714 0.000 4.499 6.726
## .JS74 4.452 0.025 178.905 0.000 4.452 6.244
## .JS75 4.449 0.026 168.290 0.000 4.449 5.873
## .JS76 4.481 0.024 189.581 0.000 4.481 6.616
## .JS77 4.501 0.023 194.841 0.000 4.501 6.800
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.060 0.004 16.375 0.000 0.060 0.131
## .JS59 0.055 0.004 15.349 0.000 0.055 0.107
## .JS60 0.065 0.004 15.899 0.000 0.065 0.118
## .JS61 0.113 0.006 18.310 0.000 0.113 0.228
## .JS62 0.099 0.005 18.380 0.000 0.099 0.170
## .JS63 0.088 0.005 18.586 0.000 0.088 0.186
## .JS64 0.102 0.006 18.454 0.000 0.102 0.175
## .JS65 0.068 0.004 17.110 0.000 0.068 0.110
## .JS66 0.098 0.005 18.152 0.000 0.098 0.155
## .JS67 0.091 0.005 18.389 0.000 0.091 0.170
## .JS68 0.084 0.005 17.958 0.000 0.084 0.179
## .JS69 0.084 0.005 16.949 0.000 0.084 0.138
## .JS70 0.099 0.005 18.403 0.000 0.099 0.208
## .JS71 0.134 0.007 18.990 0.000 0.134 0.270
## .JS72 0.079 0.004 18.032 0.000 0.079 0.160
## .JS73 0.107 0.006 18.912 0.000 0.107 0.238
## .JS74 0.061 0.004 17.128 0.000 0.061 0.121
## .JS75 0.069 0.004 17.127 0.000 0.069 0.121
## .JS76 0.106 0.006 18.856 0.000 0.106 0.231
## .JS77 0.077 0.004 18.259 0.000 0.077 0.175
## TL 1.000 1.000 1.000
## .Direction 1.000 0.074 0.074
## .Cultivation 1.000 0.019 0.019
## .Organization 1.000 0.010 0.010
## .Tutor 1.000 0.032 0.032
##
##
## Group 2 [Associate]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 3.535 0.188 18.789 0.000 0.929 0.929
## Cultvtn (.p2.) 7.115 0.753 9.443 0.000 0.990 0.990
## Orgnztn (.p3.) 10.000 2.496 4.007 0.000 1.002 1.002
## Tutor (.p4.) 5.512 0.416 13.249 0.000 0.980 0.980
## Direction =~
## JS58 (.p5.) 0.173 0.008 21.666 0.000 0.591 0.920
## JS59 (.p6.) 0.185 0.008 21.809 0.000 0.632 0.904
## JS60 (.p7.) 0.189 0.009 21.734 0.000 0.648 0.886
## JS61 (.p8.) 0.169 0.008 20.955 0.000 0.577 0.891
## Cultivation =~
## JS62 (.p9.) 0.097 0.010 9.747 0.000 0.626 0.864
## JS63 (.10.) 0.086 0.009 9.737 0.000 0.557 0.908
## JS64 (.11.) 0.096 0.010 9.742 0.000 0.622 0.836
## JS65 (.12.) 0.103 0.011 9.784 0.000 0.665 0.935
## JS66 (.13.) 0.102 0.010 9.758 0.000 0.660 0.902
## JS67 (.14.) 0.093 0.010 9.747 0.000 0.600 0.887
## Organization =~
## JS68 (.15.) 0.062 0.015 4.038 0.000 0.555 0.865
## JS69 (.16.) 0.072 0.018 4.038 0.000 0.646 0.933
## JS70 (.17.) 0.061 0.015 4.037 0.000 0.547 0.835
## JS71 (.18.) 0.060 0.015 4.034 0.000 0.538 0.836
## Tutor =~
## JS72 (.19.) 0.115 0.008 14.068 0.000 0.579 0.893
## JS73 (.20.) 0.104 0.008 13.891 0.000 0.526 0.854
## JS74 (.21.) 0.119 0.008 14.145 0.000 0.603 0.913
## JS75 (.22.) 0.127 0.009 14.145 0.000 0.641 0.910
## JS76 (.23.) 0.106 0.008 13.903 0.000 0.535 0.833
## JS77 (.24.) 0.107 0.008 14.039 0.000 0.542 0.899
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.386 0.057 77.044 0.000 4.386 6.837
## .JS59 4.307 0.062 69.375 0.000 4.307 6.156
## .JS60 4.307 0.065 66.391 0.000 4.307 5.891
## .JS61 4.346 0.058 75.579 0.000 4.346 6.707
## .JS62 4.283 0.064 66.586 0.000 4.283 5.909
## .JS63 4.409 0.054 81.071 0.000 4.409 7.194
## .JS64 4.260 0.066 64.450 0.000 4.260 5.719
## .JS65 4.331 0.063 68.658 0.000 4.331 6.092
## .JS66 4.268 0.065 65.777 0.000 4.268 5.837
## .JS67 4.307 0.060 71.740 0.000 4.307 6.366
## .JS68 4.394 0.057 77.155 0.000 4.394 6.846
## .JS69 4.370 0.061 71.132 0.000 4.370 6.312
## .JS70 4.394 0.058 75.619 0.000 4.394 6.710
## .JS71 4.346 0.057 76.184 0.000 4.346 6.760
## .JS72 4.417 0.058 76.799 0.000 4.417 6.815
## .JS73 4.394 0.055 80.277 0.000 4.394 7.123
## .JS74 4.354 0.059 74.322 0.000 4.354 6.595
## .JS75 4.402 0.062 70.433 0.000 4.402 6.250
## .JS76 4.331 0.057 75.901 0.000 4.331 6.735
## .JS77 4.386 0.054 81.969 0.000 4.386 7.274
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.063 0.010 6.046 0.000 0.063 0.153
## .JS59 0.090 0.014 6.433 0.000 0.090 0.183
## .JS60 0.115 0.017 6.722 0.000 0.115 0.216
## .JS61 0.087 0.013 6.647 0.000 0.087 0.206
## .JS62 0.133 0.018 7.431 0.000 0.133 0.254
## .JS63 0.066 0.009 7.096 0.000 0.066 0.175
## .JS64 0.167 0.022 7.548 0.000 0.167 0.302
## .JS65 0.063 0.009 6.643 0.000 0.063 0.125
## .JS66 0.099 0.014 7.158 0.000 0.099 0.186
## .JS67 0.098 0.013 7.291 0.000 0.098 0.213
## .JS68 0.104 0.014 7.396 0.000 0.104 0.251
## .JS69 0.062 0.010 6.349 0.000 0.062 0.129
## .JS70 0.130 0.017 7.545 0.000 0.130 0.303
## .JS71 0.124 0.017 7.541 0.000 0.124 0.301
## .JS72 0.085 0.012 7.127 0.000 0.085 0.203
## .JS73 0.103 0.014 7.399 0.000 0.103 0.271
## .JS74 0.072 0.011 6.885 0.000 0.072 0.166
## .JS75 0.086 0.012 6.936 0.000 0.086 0.173
## .JS76 0.127 0.017 7.490 0.000 0.127 0.306
## .JS77 0.070 0.010 7.064 0.000 0.070 0.192
## TL 0.808 0.111 7.264 0.000 1.000 1.000
## .Direction 1.601 0.349 4.588 0.000 0.137 0.137
## .Cultivation 0.856 0.533 1.607 0.108 0.021 0.021
## .Organization -0.250 1.134 -0.220 0.826 -0.003 -0.003
## .Tutor 0.987 0.385 2.561 0.010 0.039 0.039
# Check out the key indices for the model
# Put it into our table
table_fit[3,] <- c("Metric Model",round(fitmeasures(MG.fit.metric,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1763.445 | 170 | 0.944 | 0.099 | 0.019 |
| NA | NA | NA | NA | NA | NA |
| Metric Model | 1762.943 | 351 | 0.951 | 0.092 | 0.025 |
| NA | NA | NA | NA | NA | NA |
# Running the CFA by group - Scalar or full score equivalence/invariance - constraining the factor loadings and intercepts to be equal.
# The final step is to test for scalar invariance to examine whether the item intercepts are equivalent across groups. In this case, we constrain the item intercepts to be equivalent, just as we did with the factor loadings in the previous step. If this results in a poorer multi-group model fit, we can conclude that the item intercepts are not similar for people of different education backgrounds.
# Ascertaining scalar invariance allows us to substantiate multi-group comparisons of factor means (e.g., t-tests or ANOVA), and we can be confident that any statistically significant differences in group means are not due to differences in scale properties at different education background groups.
MG.fit.scalar <- cfa(MG.model,
data = TL_EDBG,
group = "Education_background",
std.lv=T,
group.equal = c("loadings","intercepts")
)
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
# Request the summary of the model result
summary(MG.fit.scalar,fit.measures=T,standardized=T)
## lavaan 0.6-7 ended normally after 396 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 138
## Number of equality constraints 44
##
## Number of observations per group:
## Bachelor 821
## Associate 127
##
## Model Test User Model:
##
## Test statistic 1780.010
## Degrees of freedom 366
## P-value (Chi-square) 0.000
## Test statistic for each group:
## Bachelor 1130.088
## Associate 649.923
##
## Model Test Baseline Model:
##
## Test statistic 29391.691
## Degrees of freedom 380
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.951
## Tucker-Lewis Index (TLI) 0.949
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -6679.269
## Loglikelihood unrestricted model (H1) -5789.264
##
## Akaike (AIC) 13546.537
## Bayesian (BIC) 14002.846
## Sample-size adjusted Bayesian (BIC) 13704.307
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.090
## 90 Percent confidence interval - lower 0.086
## 90 Percent confidence interval - upper 0.095
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.026
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [Bachelor]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 3.535 0.188 18.788 0.000 0.962 0.962
## Cultvtn (.p2.) 7.116 0.754 9.441 0.000 0.990 0.990
## Orgnztn (.p3.) 10.014 2.506 3.996 0.000 0.995 0.995
## Tutor (.p4.) 5.512 0.416 13.248 0.000 0.984 0.984
## Direction =~
## JS58 (.p5.) 0.173 0.008 21.666 0.000 0.634 0.932
## JS59 (.p6.) 0.185 0.008 21.809 0.000 0.680 0.945
## JS60 (.p7.) 0.189 0.009 21.735 0.000 0.696 0.939
## JS61 (.p8.) 0.169 0.008 20.960 0.000 0.620 0.879
## Cultivation =~
## JS62 (.p9.) 0.097 0.010 9.745 0.000 0.697 0.911
## JS63 (.10.) 0.086 0.009 9.735 0.000 0.619 0.902
## JS64 (.11.) 0.096 0.010 9.740 0.000 0.693 0.908
## JS65 (.12.) 0.103 0.011 9.781 0.000 0.739 0.943
## JS66 (.13.) 0.102 0.010 9.756 0.000 0.734 0.919
## JS67 (.14.) 0.093 0.010 9.745 0.000 0.667 0.911
## Organization =~
## JS68 (.15.) 0.062 0.015 4.027 0.000 0.622 0.906
## JS69 (.16.) 0.072 0.018 4.027 0.000 0.723 0.928
## JS70 (.17.) 0.061 0.015 4.026 0.000 0.612 0.890
## JS71 (.18.) 0.060 0.015 4.023 0.000 0.602 0.854
## Tutor =~
## JS72 (.19.) 0.115 0.008 14.067 0.000 0.642 0.916
## JS73 (.20.) 0.104 0.008 13.891 0.000 0.584 0.873
## JS74 (.21.) 0.119 0.008 14.144 0.000 0.669 0.938
## JS75 (.22.) 0.127 0.009 14.143 0.000 0.710 0.938
## JS76 (.23.) 0.106 0.008 13.903 0.000 0.594 0.877
## JS77 (.24.) 0.107 0.008 14.039 0.000 0.602 0.908
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 (.50.) 4.498 0.024 190.589 0.000 4.498 6.613
## .JS59 (.51.) 4.449 0.025 177.913 0.000 4.449 6.188
## .JS60 (.52.) 4.442 0.026 172.414 0.000 4.442 5.995
## .JS61 (.53.) 4.463 0.024 184.028 0.000 4.463 6.325
## .JS62 (.54.) 4.414 0.026 166.656 0.000 4.414 5.772
## .JS63 (.55.) 4.506 0.024 190.640 0.000 4.506 6.566
## .JS64 (.56.) 4.404 0.026 166.558 0.000 4.404 5.774
## .JS65 (.57.) 4.421 0.027 162.589 0.000 4.421 5.642
## .JS66 (.58.) 4.393 0.028 159.042 0.000 4.393 5.504
## .JS67 (.59.) 4.418 0.025 174.370 0.000 4.418 6.030
## .JS68 (.60.) 4.513 0.024 189.719 0.000 4.513 6.570
## .JS69 (.61.) 4.439 0.027 164.334 0.000 4.439 5.698
## .JS70 (.62.) 4.468 0.024 187.712 0.000 4.468 6.491
## .JS71 (.63.) 4.430 0.024 183.068 0.000 4.430 6.285
## .JS72 (.64.) 4.490 0.024 185.286 0.000 4.490 6.413
## .JS73 (.65.) 4.497 0.023 195.324 0.000 4.497 6.718
## .JS74 (.66.) 4.452 0.025 179.870 0.000 4.452 6.243
## .JS75 (.67.) 4.455 0.026 169.544 0.000 4.455 5.887
## .JS76 (.68.) 4.474 0.023 191.346 0.000 4.474 6.600
## .JS77 (.69.) 4.497 0.023 196.570 0.000 4.497 6.789
## TL 0.000 0.000 0.000
## .Directn 0.000 0.000 0.000
## .Cultvtn 0.000 0.000 0.000
## .Orgnztn 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.060 0.004 16.379 0.000 0.060 0.131
## .JS59 0.055 0.004 15.346 0.000 0.055 0.107
## .JS60 0.065 0.004 15.899 0.000 0.065 0.118
## .JS61 0.113 0.006 18.310 0.000 0.113 0.228
## .JS62 0.099 0.005 18.378 0.000 0.099 0.170
## .JS63 0.088 0.005 18.586 0.000 0.088 0.186
## .JS64 0.102 0.006 18.452 0.000 0.102 0.175
## .JS65 0.068 0.004 17.118 0.000 0.068 0.111
## .JS66 0.098 0.005 18.151 0.000 0.098 0.155
## .JS67 0.091 0.005 18.388 0.000 0.091 0.170
## .JS68 0.084 0.005 17.954 0.000 0.084 0.179
## .JS69 0.084 0.005 16.958 0.000 0.084 0.138
## .JS70 0.099 0.005 18.404 0.000 0.099 0.208
## .JS71 0.134 0.007 18.989 0.000 0.134 0.270
## .JS72 0.079 0.004 18.034 0.000 0.079 0.161
## .JS73 0.107 0.006 18.910 0.000 0.107 0.238
## .JS74 0.061 0.004 17.127 0.000 0.061 0.121
## .JS75 0.069 0.004 17.138 0.000 0.069 0.121
## .JS76 0.106 0.006 18.854 0.000 0.106 0.231
## .JS77 0.077 0.004 18.255 0.000 0.077 0.175
## TL 1.000 1.000 1.000
## .Direction 1.000 0.074 0.074
## .Cultivation 1.000 0.019 0.019
## .Organization 1.000 0.010 0.010
## .Tutor 1.000 0.032 0.032
##
##
## Group 2 [Associate]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 3.535 0.188 18.788 0.000 0.929 0.929
## Cultvtn (.p2.) 7.116 0.754 9.441 0.000 0.990 0.990
## Orgnztn (.p3.) 10.014 2.506 3.996 0.000 1.002 1.002
## Tutor (.p4.) 5.512 0.416 13.248 0.000 0.981 0.981
## Direction =~
## JS58 (.p5.) 0.173 0.008 21.666 0.000 0.590 0.920
## JS59 (.p6.) 0.185 0.008 21.809 0.000 0.633 0.904
## JS60 (.p7.) 0.189 0.009 21.735 0.000 0.648 0.886
## JS61 (.p8.) 0.169 0.008 20.960 0.000 0.577 0.891
## Cultivation =~
## JS62 (.p9.) 0.097 0.010 9.745 0.000 0.627 0.864
## JS63 (.10.) 0.086 0.009 9.735 0.000 0.557 0.908
## JS64 (.11.) 0.096 0.010 9.740 0.000 0.623 0.835
## JS65 (.12.) 0.103 0.011 9.781 0.000 0.665 0.934
## JS66 (.13.) 0.102 0.010 9.756 0.000 0.660 0.902
## JS67 (.14.) 0.093 0.010 9.745 0.000 0.600 0.887
## Organization =~
## JS68 (.15.) 0.062 0.015 4.027 0.000 0.556 0.863
## JS69 (.16.) 0.072 0.018 4.027 0.000 0.646 0.932
## JS70 (.17.) 0.061 0.015 4.026 0.000 0.547 0.835
## JS71 (.18.) 0.060 0.015 4.023 0.000 0.538 0.836
## Tutor =~
## JS72 (.19.) 0.115 0.008 14.067 0.000 0.578 0.893
## JS73 (.20.) 0.104 0.008 13.891 0.000 0.527 0.854
## JS74 (.21.) 0.119 0.008 14.144 0.000 0.603 0.913
## JS75 (.22.) 0.127 0.009 14.143 0.000 0.640 0.906
## JS76 (.23.) 0.106 0.008 13.903 0.000 0.536 0.829
## JS77 (.24.) 0.107 0.008 14.039 0.000 0.542 0.898
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 (.50.) 4.498 0.024 190.589 0.000 4.498 7.012
## .JS59 (.51.) 4.449 0.025 177.913 0.000 4.449 6.355
## .JS60 (.52.) 4.442 0.026 172.414 0.000 4.442 6.075
## .JS61 (.53.) 4.463 0.024 184.028 0.000 4.463 6.887
## .JS62 (.54.) 4.414 0.026 166.656 0.000 4.414 6.084
## .JS63 (.55.) 4.506 0.024 190.640 0.000 4.506 7.351
## .JS64 (.56.) 4.404 0.026 166.558 0.000 4.404 5.902
## .JS65 (.57.) 4.421 0.027 162.589 0.000 4.421 6.217
## .JS66 (.58.) 4.393 0.028 159.042 0.000 4.393 6.006
## .JS67 (.59.) 4.418 0.025 174.370 0.000 4.418 6.527
## .JS68 (.60.) 4.513 0.024 189.719 0.000 4.513 7.012
## .JS69 (.61.) 4.439 0.027 164.334 0.000 4.439 6.412
## .JS70 (.62.) 4.468 0.024 187.712 0.000 4.468 6.824
## .JS71 (.63.) 4.430 0.024 183.068 0.000 4.430 6.888
## .JS72 (.64.) 4.490 0.024 185.286 0.000 4.490 6.930
## .JS73 (.65.) 4.497 0.023 195.324 0.000 4.497 7.287
## .JS74 (.66.) 4.452 0.025 179.870 0.000 4.452 6.743
## .JS75 (.67.) 4.455 0.026 169.544 0.000 4.455 6.312
## .JS76 (.68.) 4.474 0.023 191.346 0.000 4.474 6.922
## .JS77 (.69.) 4.497 0.023 196.570 0.000 4.497 7.448
## TL -0.138 0.088 -1.567 0.117 -0.153 -0.153
## .Directn -0.217 0.140 -1.544 0.123 -0.063 -0.063
## .Cultvtn -0.167 0.144 -1.153 0.249 -0.026 -0.026
## .Orgnztn 0.103 0.132 0.776 0.438 0.011 0.011
## .Tutor -0.060 0.137 -0.435 0.664 -0.012 -0.012
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.063 0.010 6.050 0.000 0.063 0.153
## .JS59 0.090 0.014 6.435 0.000 0.090 0.183
## .JS60 0.115 0.017 6.720 0.000 0.115 0.215
## .JS61 0.087 0.013 6.645 0.000 0.087 0.206
## .JS62 0.134 0.018 7.431 0.000 0.134 0.254
## .JS63 0.066 0.009 7.094 0.000 0.066 0.175
## .JS64 0.169 0.022 7.550 0.000 0.169 0.303
## .JS65 0.064 0.010 6.666 0.000 0.064 0.127
## .JS66 0.099 0.014 7.157 0.000 0.099 0.186
## .JS67 0.098 0.013 7.292 0.000 0.098 0.214
## .JS68 0.105 0.014 7.411 0.000 0.105 0.255
## .JS69 0.063 0.010 6.376 0.000 0.063 0.131
## .JS70 0.130 0.017 7.550 0.000 0.130 0.303
## .JS71 0.125 0.017 7.546 0.000 0.125 0.301
## .JS72 0.085 0.012 7.128 0.000 0.085 0.203
## .JS73 0.103 0.014 7.398 0.000 0.103 0.271
## .JS74 0.073 0.011 6.884 0.000 0.073 0.166
## .JS75 0.089 0.013 6.976 0.000 0.089 0.179
## .JS76 0.131 0.017 7.503 0.000 0.131 0.313
## .JS77 0.070 0.010 7.068 0.000 0.070 0.193
## TL 0.808 0.111 7.265 0.000 1.000 1.000
## .Direction 1.600 0.349 4.587 0.000 0.137 0.137
## .Cultivation 0.848 0.532 1.594 0.111 0.020 0.020
## .Organization -0.316 1.141 -0.277 0.782 -0.004 -0.004
## .Tutor 0.959 0.383 2.505 0.012 0.038 0.038
# Check out the key indices for the model
# Put it into our table
table_fit[4,] <- c("Scalar Model",round(fitmeasures(MG.fit.scalar,c("chisq","df","cfi","rmsea","srmr")),3))
fitmeasures(MG.fit.scalar)
## npar fmin chisq df
## 94.000 0.939 1780.010 366.000
## pvalue baseline.chisq baseline.df baseline.pvalue
## 0.000 29391.691 380.000 0.000
## cfi tli nnfi rfi
## 0.951 0.949 0.949 0.937
## nfi pnfi ifi rni
## 0.939 0.905 0.951 0.951
## logl unrestricted.logl aic bic
## -6679.269 -5789.264 13546.537 14002.846
## ntotal bic2 rmsea rmsea.ci.lower
## 948.000 13704.307 0.090 0.086
## rmsea.ci.upper rmsea.pvalue rmr rmr_nomean
## 0.095 0.000 0.013 0.013
## srmr srmr_bentler srmr_bentler_nomean crmr
## 0.026 0.026 0.027 0.032
## crmr_nomean srmr_mplus srmr_mplus_nomean cn_05
## 0.022 0.031 0.022 220.216
## cn_01 gfi agfi pgfi
## 231.003 0.978 0.973 0.778
## mfi
## 0.474
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1763.445 | 170 | 0.944 | 0.099 | 0.019 |
| NA | NA | NA | NA | NA | NA |
| Metric Model | 1762.943 | 351 | 0.951 | 0.092 | 0.025 |
| Scalar Model | 1780.01 | 366 | 0.951 | 0.09 | 0.026 |
# Comparing all the models
anova(overall.fit,MG.fit.metric,MG.fit.scalar)
## Warning in lavTestLRT(object = new("lavaan", version = "0.6.7", call = lavaan::lavaan(model = overall.model, : lavaan WARNING: some restricted models fit better than less
## restricted models; either these models are not nested, or
## the less restricted model failed to reach a global optimum.
## Chi-Squared Difference Test
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## overall.fit 170 14137 14428 1763.4
## MG.fit.metric 351 13560 14089 1762.9 -0.5019 181 1.0000
## MG.fit.scalar 366 13546 14003 1780.0 17.0673 15 0.3149
# Pooling out the data
TL_Gender <- TL_ML[,-c(21,22,24)]
# Check the freq table
table(TL_Gender$Gender)
##
## 1 2
## 419 539
# Specify the data
TL_Gender$Gender <- factor(TL_Gender$Gender,
levels=c(1,2),
labels=c("Male","Female"))
# Build a overall model
overall.model <- '
TL =~ JS58+JS59+JS60+JS61+JS62+JS63+JS64+JS65+JS66+JS67+JS68+JS69+JS70+JS71+JS72+JS73+JS74+JS75+JS76+JS77
'
# Run the model
overall.fit <- cfa(model = overall.model,
data= TL_Gender,
meanstructure = TRUE)
# Request the summary
summary(overall.fit,
standardized = TRUE,
rsquare = TRUE,
fit.measure = TRUE)
## lavaan 0.6-7 ended normally after 80 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 60
##
## Number of observations 958
##
## Model Test User Model:
##
## Test statistic 1783.761
## Degrees of freedom 170
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 29157.594
## Degrees of freedom 190
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.944
## Tucker-Lewis Index (TLI) 0.938
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -7063.065
## Loglikelihood unrestricted model (H1) -6171.185
##
## Akaike (AIC) 14246.130
## Bayesian (BIC) 14538.021
## Sample-size adjusted Bayesian (BIC) 14347.463
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.100
## 90 Percent confidence interval - lower 0.095
## 90 Percent confidence interval - upper 0.104
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.019
##
## 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
## TL =~
## JS58 1.000 0.607 0.895
## JS59 1.074 0.024 45.018 0.000 0.652 0.906
## JS60 1.107 0.025 44.562 0.000 0.672 0.902
## JS61 1.006 0.024 41.114 0.000 0.611 0.873
## JS62 1.129 0.025 44.284 0.000 0.685 0.900
## JS63 1.006 0.023 44.270 0.000 0.611 0.900
## JS64 1.118 0.026 43.487 0.000 0.679 0.894
## JS65 1.190 0.024 48.775 0.000 0.723 0.933
## JS66 1.185 0.026 45.579 0.000 0.720 0.910
## JS67 1.079 0.024 44.423 0.000 0.655 0.901
## JS68 1.010 0.023 44.218 0.000 0.614 0.900
## JS69 1.170 0.025 47.113 0.000 0.711 0.922
## JS70 0.985 0.024 41.289 0.000 0.598 0.875
## JS71 0.972 0.025 38.360 0.000 0.590 0.847
## JS72 1.044 0.023 46.063 0.000 0.634 0.914
## JS73 0.946 0.023 40.350 0.000 0.574 0.866
## JS74 1.075 0.023 47.293 0.000 0.653 0.923
## JS75 1.138 0.024 47.181 0.000 0.691 0.922
## JS76 0.953 0.024 39.300 0.000 0.579 0.856
## JS77 0.966 0.022 43.407 0.000 0.587 0.893
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.480 0.022 204.352 0.000 4.480 6.602
## .JS59 4.430 0.023 190.405 0.000 4.430 6.152
## .JS60 4.422 0.024 183.718 0.000 4.422 5.936
## .JS61 4.447 0.023 196.754 0.000 4.447 6.357
## .JS62 4.397 0.025 178.746 0.000 4.397 5.775
## .JS63 4.491 0.022 204.761 0.000 4.491 6.616
## .JS64 4.386 0.025 178.671 0.000 4.386 5.773
## .JS65 4.404 0.025 175.996 0.000 4.404 5.686
## .JS66 4.376 0.026 171.321 0.000 4.376 5.535
## .JS67 4.402 0.023 187.417 0.000 4.402 6.055
## .JS68 4.500 0.022 204.246 0.000 4.500 6.599
## .JS69 4.423 0.025 177.502 0.000 4.423 5.735
## .JS70 4.456 0.022 201.768 0.000 4.456 6.519
## .JS71 4.419 0.023 196.269 0.000 4.419 6.341
## .JS72 4.476 0.022 199.724 0.000 4.476 6.453
## .JS73 4.483 0.021 209.268 0.000 4.483 6.761
## .JS74 4.436 0.023 194.063 0.000 4.436 6.270
## .JS75 4.442 0.024 183.407 0.000 4.442 5.926
## .JS76 4.459 0.022 204.144 0.000 4.459 6.596
## .JS77 4.482 0.021 211.243 0.000 4.482 6.825
## TL 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.092 0.004 20.866 0.000 0.092 0.199
## .JS59 0.093 0.004 20.724 0.000 0.093 0.179
## .JS60 0.103 0.005 20.773 0.000 0.103 0.186
## .JS61 0.116 0.006 21.072 0.000 0.116 0.237
## .JS62 0.110 0.005 20.802 0.000 0.110 0.190
## .JS63 0.087 0.004 20.804 0.000 0.087 0.190
## .JS64 0.116 0.006 20.879 0.000 0.116 0.201
## .JS65 0.078 0.004 20.183 0.000 0.078 0.130
## .JS66 0.107 0.005 20.660 0.000 0.107 0.171
## .JS67 0.099 0.005 20.788 0.000 0.099 0.188
## .JS68 0.089 0.004 20.809 0.000 0.089 0.190
## .JS69 0.090 0.004 20.458 0.000 0.090 0.151
## .JS70 0.110 0.005 21.059 0.000 0.110 0.235
## .JS71 0.137 0.006 21.244 0.000 0.137 0.283
## .JS72 0.079 0.004 20.601 0.000 0.079 0.165
## .JS73 0.110 0.005 21.124 0.000 0.110 0.250
## .JS74 0.074 0.004 20.431 0.000 0.074 0.148
## .JS75 0.084 0.004 20.448 0.000 0.084 0.150
## .JS76 0.122 0.006 21.190 0.000 0.122 0.267
## .JS77 0.087 0.004 20.886 0.000 0.087 0.202
## TL 0.369 0.021 17.851 0.000 1.000 1.000
##
## R-Square:
## Estimate
## JS58 0.801
## JS59 0.821
## JS60 0.814
## JS61 0.763
## JS62 0.810
## JS63 0.810
## JS64 0.799
## JS65 0.870
## JS66 0.829
## JS67 0.812
## JS68 0.810
## JS69 0.849
## JS70 0.765
## JS71 0.717
## JS72 0.835
## JS73 0.750
## JS74 0.852
## JS75 0.850
## JS76 0.733
## JS77 0.798
# Make a table to compare all the models
table_fit <- matrix(NA,nrow=4,ncol=6)
colnames(table_fit) <- c("Model","X2","df","CFI","RMSEA","SRMR")
# Put the overall model results into our table
table_fit[1,] <- c("Overall Model",round(fitmeasures(overall.fit,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1783.761 | 170 | 0.944 | 0.1 | 0.019 |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
# Create a SEM plot
semPaths(overall.fit,
whatLabels = "std",
layout="tree")
# The 1st row is the factor loading
# The 2nd row below the Items is the variances
# The 3nd row is the estimates
# Build the model
MG.model <- '
TL=~Direction+Cultivation+Organization+Tutor
Direction=~JS58+JS59+JS60+JS61
Cultivation=~JS62+JS63+JS64+JS65+JS66+JS67
Organization=~JS68+JS69+JS70+JS71
Tutor=~JS72+JS73+JS74+JS75+JS76+JS77
'
# Running the CFA by group - structural equivalence - configural invariance
# In this case, a configural invariance test allows you to examine whether the overall factor structure stipulated by our measure fits well for both gender groups in our sample. As with a typical CFA, we start by specifying the relationships between each item in the measure we’re using and the latent factor(s) that the items are stipulated to measure.
MG.fit.configural <- cfa(MG.model,
data = TL_Gender,
group = "Gender",
std.lv=T,
)
# The result shows the model is not converge
# Request the summary of the model result
summary(MG.fit.configural,fit.measures=T,standardized=T)
## lavaan 0.6-7 ended normally after 429 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 128
##
## Number of observations per group:
## Male 419
## Female 539
##
## Model Test User Model:
##
## Test statistic 1767.430
## Degrees of freedom 332
## P-value (Chi-square) 0.000
## Test statistic for each group:
## Male 813.269
## Female 954.162
##
## Model Test Baseline Model:
##
## Test statistic 29909.827
## Degrees of freedom 380
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.951
## Tucker-Lewis Index (TLI) 0.944
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -6609.985
## Loglikelihood unrestricted model (H1) -5726.270
##
## Akaike (AIC) 13475.970
## Bayesian (BIC) 14098.670
## Sample-size adjusted Bayesian (BIC) 13692.146
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.095
## 90 Percent confidence interval - lower 0.091
## 90 Percent confidence interval - upper 0.099
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.019
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [Male]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Direction 3.879 0.323 12.007 0.000 0.968 0.968
## Cultivation 7.916 1.355 5.844 0.000 0.992 0.992
## Organization 32.728 111.461 0.294 0.769 1.000 1.000
## Tutor 5.773 0.627 9.208 0.000 0.985 0.985
## Direction =~
## JS58 0.163 0.012 13.343 0.000 0.655 0.920
## JS59 0.174 0.013 13.355 0.000 0.698 0.922
## JS60 0.177 0.013 13.394 0.000 0.709 0.928
## JS61 0.163 0.012 13.119 0.000 0.654 0.888
## Cultivation =~
## JS62 0.087 0.015 5.978 0.000 0.695 0.897
## JS63 0.080 0.013 5.978 0.000 0.642 0.896
## JS64 0.090 0.015 5.974 0.000 0.722 0.890
## JS65 0.099 0.016 6.009 0.000 0.787 0.950
## JS66 0.095 0.016 5.993 0.000 0.761 0.919
## JS67 0.087 0.015 5.985 0.000 0.698 0.907
## Organization =~
## JS68 0.020 0.066 0.294 0.769 0.639 0.881
## JS69 0.024 0.081 0.294 0.769 0.777 0.932
## JS70 0.020 0.069 0.294 0.769 0.662 0.897
## JS71 0.020 0.067 0.294 0.769 0.646 0.858
## Tutor =~
## JS72 0.115 0.012 9.739 0.000 0.675 0.918
## JS73 0.104 0.011 9.563 0.000 0.609 0.860
## JS74 0.124 0.013 9.786 0.000 0.728 0.936
## JS75 0.129 0.013 9.804 0.000 0.758 0.944
## JS76 0.106 0.011 9.535 0.000 0.619 0.852
## JS77 0.111 0.011 9.750 0.000 0.651 0.922
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.473 0.035 128.575 0.000 4.473 6.281
## .JS59 4.430 0.037 119.637 0.000 4.430 5.845
## .JS60 4.427 0.037 118.625 0.000 4.427 5.795
## .JS61 4.434 0.036 123.335 0.000 4.434 6.025
## .JS62 4.418 0.038 116.623 0.000 4.418 5.697
## .JS63 4.499 0.035 128.631 0.000 4.499 6.284
## .JS64 4.389 0.040 110.777 0.000 4.389 5.412
## .JS65 4.406 0.040 108.961 0.000 4.406 5.323
## .JS66 4.363 0.040 107.930 0.000 4.363 5.273
## .JS67 4.394 0.038 116.898 0.000 4.394 5.711
## .JS68 4.501 0.035 126.938 0.000 4.501 6.201
## .JS69 4.408 0.041 108.234 0.000 4.408 5.288
## .JS70 4.461 0.036 123.750 0.000 4.461 6.046
## .JS71 4.413 0.037 119.961 0.000 4.413 5.860
## .JS72 4.477 0.036 124.642 0.000 4.477 6.089
## .JS73 4.470 0.035 129.133 0.000 4.470 6.309
## .JS74 4.413 0.038 116.115 0.000 4.413 5.673
## .JS75 4.425 0.039 112.751 0.000 4.425 5.508
## .JS76 4.449 0.036 125.203 0.000 4.449 6.117
## .JS77 4.482 0.034 130.024 0.000 4.482 6.352
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.078 0.007 11.951 0.000 0.078 0.154
## .JS59 0.087 0.007 11.879 0.000 0.087 0.151
## .JS60 0.081 0.007 11.618 0.000 0.081 0.139
## .JS61 0.114 0.009 12.774 0.000 0.114 0.211
## .JS62 0.118 0.009 13.387 0.000 0.118 0.196
## .JS63 0.101 0.008 13.391 0.000 0.101 0.196
## .JS64 0.136 0.010 13.464 0.000 0.136 0.207
## .JS65 0.066 0.006 11.915 0.000 0.066 0.097
## .JS66 0.106 0.008 13.018 0.000 0.106 0.155
## .JS67 0.105 0.008 13.245 0.000 0.105 0.178
## .JS68 0.118 0.009 13.458 0.000 0.118 0.225
## .JS69 0.092 0.008 12.198 0.000 0.092 0.132
## .JS70 0.107 0.008 13.226 0.000 0.107 0.196
## .JS71 0.150 0.011 13.686 0.000 0.150 0.264
## .JS72 0.085 0.007 12.911 0.000 0.085 0.157
## .JS73 0.131 0.010 13.655 0.000 0.131 0.261
## .JS74 0.075 0.006 12.398 0.000 0.075 0.124
## .JS75 0.071 0.006 12.077 0.000 0.071 0.110
## .JS76 0.145 0.011 13.713 0.000 0.145 0.275
## .JS77 0.074 0.006 12.812 0.000 0.074 0.150
## TL 1.000 1.000 1.000
## .Direction 1.000 0.062 0.062
## .Cultivation 1.000 0.016 0.016
## .Organization 1.000 0.001 0.001
## .Tutor 1.000 0.029 0.029
##
##
## Group 2 [Female]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Direction 2.970 0.177 16.808 0.000 0.948 0.948
## Cultivation 7.041 0.958 7.350 0.000 0.990 0.990
## Organization 8.013 1.720 4.658 0.000 0.992 0.992
## Tutor 4.967 0.429 11.567 0.000 0.980 0.980
## Direction =~
## JS58 0.196 0.010 20.485 0.000 0.614 0.942
## JS59 0.211 0.010 20.759 0.000 0.661 0.959
## JS60 0.218 0.011 20.372 0.000 0.683 0.936
## JS61 0.187 0.010 19.220 0.000 0.587 0.877
## Cultivation =~
## JS62 0.097 0.013 7.588 0.000 0.686 0.915
## JS63 0.083 0.011 7.580 0.000 0.588 0.908
## JS64 0.092 0.012 7.583 0.000 0.653 0.910
## JS65 0.096 0.013 7.605 0.000 0.682 0.934
## JS66 0.098 0.013 7.591 0.000 0.699 0.919
## JS67 0.089 0.012 7.583 0.000 0.630 0.910
## Organization =~
## JS68 0.074 0.016 4.730 0.000 0.596 0.923
## JS69 0.083 0.017 4.731 0.000 0.667 0.928
## JS70 0.069 0.015 4.720 0.000 0.555 0.870
## JS71 0.068 0.014 4.714 0.000 0.551 0.848
## Tutor =~
## JS72 0.119 0.010 12.402 0.000 0.600 0.911
## JS73 0.109 0.009 12.274 0.000 0.553 0.884
## JS74 0.120 0.010 12.517 0.000 0.606 0.937
## JS75 0.129 0.010 12.464 0.000 0.651 0.924
## JS76 0.112 0.009 12.334 0.000 0.568 0.896
## JS77 0.109 0.009 12.332 0.000 0.552 0.896
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.486 0.028 159.910 0.000 4.486 6.888
## .JS59 4.430 0.030 149.209 0.000 4.430 6.427
## .JS60 4.417 0.031 140.527 0.000 4.417 6.053
## .JS61 4.456 0.029 154.494 0.000 4.456 6.655
## .JS62 4.380 0.032 135.629 0.000 4.380 5.842
## .JS63 4.484 0.028 160.558 0.000 4.484 6.916
## .JS64 4.384 0.031 141.850 0.000 4.384 6.110
## .JS65 4.403 0.031 139.919 0.000 4.403 6.027
## .JS66 4.386 0.033 133.892 0.000 4.386 5.767
## .JS67 4.408 0.030 147.865 0.000 4.408 6.369
## .JS68 4.499 0.028 161.757 0.000 4.499 6.967
## .JS69 4.434 0.031 143.237 0.000 4.434 6.170
## .JS70 4.453 0.027 161.976 0.000 4.453 6.977
## .JS71 4.423 0.028 158.039 0.000 4.423 6.807
## .JS72 4.475 0.028 157.539 0.000 4.475 6.786
## .JS73 4.494 0.027 166.845 0.000 4.494 7.187
## .JS74 4.455 0.028 159.841 0.000 4.455 6.885
## .JS75 4.455 0.030 146.764 0.000 4.455 6.322
## .JS76 4.468 0.027 163.775 0.000 4.468 7.054
## .JS77 4.482 0.027 168.913 0.000 4.482 7.276
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.047 0.004 12.777 0.000 0.047 0.112
## .JS59 0.038 0.003 11.116 0.000 0.038 0.080
## .JS60 0.066 0.005 13.175 0.000 0.066 0.123
## .JS61 0.103 0.007 14.923 0.000 0.103 0.231
## .JS62 0.091 0.006 14.732 0.000 0.091 0.162
## .JS63 0.074 0.005 14.898 0.000 0.074 0.176
## .JS64 0.088 0.006 14.840 0.000 0.088 0.171
## .JS65 0.068 0.005 14.179 0.000 0.068 0.128
## .JS66 0.090 0.006 14.646 0.000 0.090 0.156
## .JS67 0.082 0.006 14.839 0.000 0.082 0.171
## .JS68 0.062 0.004 13.790 0.000 0.062 0.148
## .JS69 0.072 0.005 13.579 0.000 0.072 0.140
## .JS70 0.099 0.007 15.094 0.000 0.099 0.243
## .JS71 0.119 0.008 15.344 0.000 0.119 0.281
## .JS72 0.074 0.005 14.598 0.000 0.074 0.171
## .JS73 0.085 0.006 15.084 0.000 0.085 0.219
## .JS74 0.051 0.004 13.679 0.000 0.051 0.121
## .JS75 0.072 0.005 14.204 0.000 0.072 0.145
## .JS76 0.079 0.005 14.894 0.000 0.079 0.197
## .JS77 0.075 0.005 14.902 0.000 0.075 0.198
## TL 1.000 1.000 1.000
## .Direction 1.000 0.102 0.102
## .Cultivation 1.000 0.020 0.020
## .Organization 1.000 0.015 0.015
## .Tutor 1.000 0.039 0.039
# Check out the key indices for the model
# Put it into our table
table_fit[2,] <- c("Configural Model",round(fitmeasures(MG.fit.configural,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1783.761 | 170 | 0.944 | 0.1 | 0.019 |
| Configural Model | 1767.43 | 332 | 0.951 | 0.095 | 0.019 |
| NA | NA | NA | NA | NA | NA |
| NA | NA | NA | NA | NA | NA |
# Running the CFA by group - metric equivalence/invariance - constraining the factor loadings to be equal.
# The next step is to test for metric invariance to examine whether the factor loadings are equivalent across the groups. This time, we constrain the factor loadings to be equivalent across groups, while still allowing the item intercepts to vary freely as before. A good multi-group model fit indicates metric invariance — if constraining the factor loadings in this way results in a poorer fit, it suggests that the factor loadings are not similar across gender groups.
# Ascertaining metric invariance allows you to substantiate multi-group comparisons of factor variances and covariances, since metric invariance indicates that each item of the scale loads onto the specified latent factor in a similar manner and with similar magnitude across groups. As such, we can assume that differences in factor variances and covariances are not attributable to gender based differences in the properties of the scales themselves.
MG.fit.metric <- cfa(MG.model,
data = TL_Gender,
group = "Gender",
std.lv=T,
group.equal = "loadings"
)
# Request the summary of the model result
summary(MG.fit.metric,fit.measures=T,standardized=T)
## lavaan 0.6-7 ended normally after 428 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 133
## Number of equality constraints 24
##
## Number of observations per group:
## Male 419
## Female 539
##
## Model Test User Model:
##
## Test statistic 1805.315
## Degrees of freedom 351
## P-value (Chi-square) 0.000
## Test statistic for each group:
## Male 834.321
## Female 970.994
##
## Model Test Baseline Model:
##
## Test statistic 29909.827
## Degrees of freedom 380
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.951
## Tucker-Lewis Index (TLI) 0.947
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -6628.927
## Loglikelihood unrestricted model (H1) -5726.270
##
## Akaike (AIC) 13475.855
## Bayesian (BIC) 14006.123
## Sample-size adjusted Bayesian (BIC) 13659.942
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.093
## 90 Percent confidence interval - lower 0.089
## 90 Percent confidence interval - upper 0.097
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.031
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [Male]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 3.967 0.328 12.092 0.000 0.970 0.970
## Cultvtn (.p2.) 8.280 1.502 5.513 0.000 0.993 0.993
## Orgnztn (.p3.) 31.692 103.049 0.308 0.758 1.000 1.000
## Tutor (.p4.) 5.592 0.584 9.583 0.000 0.984 0.984
## Direction =~
## JS58 (.p5.) 0.162 0.012 13.473 0.000 0.664 0.922
## JS59 (.p6.) 0.175 0.013 13.491 0.000 0.714 0.925
## JS60 (.p7.) 0.178 0.013 13.487 0.000 0.730 0.932
## JS61 (.p8.) 0.158 0.012 13.333 0.000 0.647 0.886
## Cultivation =~
## JS62 (.p9.) 0.088 0.016 5.632 0.000 0.738 0.906
## JS63 (.10.) 0.078 0.014 5.631 0.000 0.652 0.900
## JS64 (.11.) 0.087 0.016 5.629 0.000 0.729 0.892
## JS65 (.12.) 0.093 0.016 5.641 0.000 0.776 0.948
## JS66 (.13.) 0.093 0.016 5.636 0.000 0.774 0.922
## JS67 (.14.) 0.084 0.015 5.633 0.000 0.703 0.908
## Organization =~
## JS68 (.15.) 0.021 0.068 0.308 0.758 0.659 0.887
## JS69 (.16.) 0.024 0.078 0.308 0.758 0.760 0.928
## JS70 (.17.) 0.020 0.066 0.308 0.758 0.642 0.890
## JS71 (.18.) 0.020 0.065 0.308 0.758 0.630 0.851
## Tutor =~
## JS72 (.19.) 0.119 0.012 10.191 0.000 0.675 0.918
## JS73 (.20.) 0.109 0.011 10.121 0.000 0.617 0.863
## JS74 (.21.) 0.123 0.012 10.211 0.000 0.701 0.930
## JS75 (.22.) 0.131 0.013 10.221 0.000 0.745 0.941
## JS76 (.23.) 0.111 0.011 10.124 0.000 0.632 0.857
## JS77 (.24.) 0.112 0.011 10.188 0.000 0.635 0.919
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.473 0.035 127.023 0.000 4.473 6.205
## .JS59 4.430 0.038 117.421 0.000 4.430 5.736
## .JS60 4.427 0.038 115.636 0.000 4.427 5.649
## .JS61 4.434 0.036 124.220 0.000 4.434 6.069
## .JS62 4.418 0.040 111.130 0.000 4.418 5.429
## .JS63 4.499 0.035 126.976 0.000 4.499 6.203
## .JS64 4.389 0.040 110.005 0.000 4.389 5.374
## .JS65 4.406 0.040 110.195 0.000 4.406 5.383
## .JS66 4.363 0.041 106.385 0.000 4.363 5.197
## .JS67 4.394 0.038 116.158 0.000 4.394 5.675
## .JS68 4.501 0.036 124.012 0.000 4.501 6.058
## .JS69 4.408 0.040 110.162 0.000 4.408 5.382
## .JS70 4.461 0.035 126.729 0.000 4.461 6.191
## .JS71 4.413 0.036 122.001 0.000 4.413 5.960
## .JS72 4.477 0.036 124.650 0.000 4.477 6.090
## .JS73 4.470 0.035 127.935 0.000 4.470 6.250
## .JS74 4.413 0.037 119.899 0.000 4.413 5.857
## .JS75 4.425 0.039 114.451 0.000 4.425 5.591
## .JS76 4.449 0.036 123.347 0.000 4.449 6.026
## .JS77 4.482 0.034 132.655 0.000 4.482 6.481
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.078 0.007 12.009 0.000 0.078 0.151
## .JS59 0.086 0.007 11.891 0.000 0.086 0.145
## .JS60 0.081 0.007 11.568 0.000 0.081 0.132
## .JS61 0.115 0.009 12.900 0.000 0.115 0.215
## .JS62 0.118 0.009 13.284 0.000 0.118 0.178
## .JS63 0.100 0.008 13.382 0.000 0.100 0.191
## .JS64 0.136 0.010 13.474 0.000 0.136 0.204
## .JS65 0.068 0.006 12.103 0.000 0.068 0.101
## .JS66 0.106 0.008 13.010 0.000 0.106 0.151
## .JS67 0.105 0.008 13.261 0.000 0.105 0.176
## .JS68 0.118 0.009 13.362 0.000 0.118 0.214
## .JS69 0.093 0.008 12.303 0.000 0.093 0.138
## .JS70 0.108 0.008 13.307 0.000 0.108 0.207
## .JS71 0.151 0.011 13.726 0.000 0.151 0.275
## .JS72 0.085 0.007 12.868 0.000 0.085 0.157
## .JS73 0.131 0.010 13.613 0.000 0.131 0.255
## .JS74 0.076 0.006 12.544 0.000 0.076 0.135
## .JS75 0.071 0.006 12.123 0.000 0.071 0.114
## .JS76 0.145 0.011 13.662 0.000 0.145 0.266
## .JS77 0.075 0.006 12.860 0.000 0.075 0.156
## TL 1.000 1.000 1.000
## .Direction 1.000 0.060 0.060
## .Cultivation 1.000 0.014 0.014
## .Organization 1.000 0.001 0.001
## .Tutor 1.000 0.031 0.031
##
##
## Group 2 [Female]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 3.967 0.328 12.092 0.000 0.945 0.945
## Cultvtn (.p2.) 8.280 1.502 5.513 0.000 0.989 0.989
## Orgnztn (.p3.) 31.692 103.049 0.308 0.758 0.993 0.993
## Tutor (.p4.) 5.592 0.584 9.583 0.000 0.981 0.981
## Direction =~
## JS58 (.p5.) 0.162 0.012 13.473 0.000 0.604 0.941
## JS59 (.p6.) 0.175 0.013 13.491 0.000 0.650 0.958
## JS60 (.p7.) 0.178 0.013 13.487 0.000 0.665 0.932
## JS61 (.p8.) 0.158 0.012 13.333 0.000 0.589 0.878
## Cultivation =~
## JS62 (.p9.) 0.088 0.016 5.632 0.000 0.657 0.907
## JS63 (.10.) 0.078 0.014 5.631 0.000 0.581 0.905
## JS64 (.11.) 0.087 0.016 5.629 0.000 0.648 0.909
## JS65 (.12.) 0.093 0.016 5.641 0.000 0.691 0.936
## JS66 (.13.) 0.093 0.016 5.636 0.000 0.689 0.917
## JS67 (.14.) 0.084 0.015 5.633 0.000 0.626 0.910
## Organization =~
## JS68 (.15.) 0.021 0.068 0.308 0.758 0.588 0.921
## JS69 (.16.) 0.024 0.078 0.308 0.758 0.679 0.930
## JS70 (.17.) 0.020 0.066 0.308 0.758 0.573 0.877
## JS71 (.18.) 0.020 0.065 0.308 0.758 0.563 0.853
## Tutor =~
## JS72 (.19.) 0.119 0.012 10.191 0.000 0.601 0.910
## JS73 (.20.) 0.109 0.011 10.121 0.000 0.549 0.882
## JS74 (.21.) 0.123 0.012 10.211 0.000 0.624 0.941
## JS75 (.22.) 0.131 0.013 10.221 0.000 0.663 0.927
## JS76 (.23.) 0.111 0.011 10.124 0.000 0.563 0.894
## JS77 (.24.) 0.112 0.011 10.188 0.000 0.565 0.900
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 4.486 0.028 162.127 0.000 4.486 6.983
## .JS59 4.430 0.029 151.659 0.000 4.430 6.532
## .JS60 4.417 0.031 143.898 0.000 4.417 6.198
## .JS61 4.456 0.029 154.186 0.000 4.456 6.641
## .JS62 4.380 0.031 140.520 0.000 4.380 6.053
## .JS63 4.484 0.028 162.275 0.000 4.484 6.990
## .JS64 4.384 0.031 142.729 0.000 4.384 6.148
## .JS65 4.403 0.032 138.465 0.000 4.403 5.964
## .JS66 4.386 0.032 135.587 0.000 4.386 5.840
## .JS67 4.408 0.030 148.760 0.000 4.408 6.408
## .JS68 4.499 0.028 163.493 0.000 4.499 7.042
## .JS69 4.434 0.031 140.999 0.000 4.434 6.073
## .JS70 4.453 0.028 158.252 0.000 4.453 6.816
## .JS71 4.423 0.028 155.698 0.000 4.423 6.706
## .JS72 4.475 0.028 157.470 0.000 4.475 6.783
## .JS73 4.494 0.027 167.633 0.000 4.494 7.220
## .JS74 4.455 0.029 156.002 0.000 4.455 6.719
## .JS75 4.455 0.031 144.657 0.000 4.455 6.231
## .JS76 4.468 0.027 164.837 0.000 4.468 7.100
## .JS77 4.482 0.027 165.659 0.000 4.482 7.135
## TL 0.000 0.000 0.000
## .Direction 0.000 0.000 0.000
## .Cultivation 0.000 0.000 0.000
## .Organization 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.047 0.004 12.783 0.000 0.047 0.115
## .JS59 0.038 0.003 11.140 0.000 0.038 0.082
## .JS60 0.066 0.005 13.304 0.000 0.066 0.131
## .JS61 0.103 0.007 14.873 0.000 0.103 0.229
## .JS62 0.093 0.006 14.879 0.000 0.093 0.177
## .JS63 0.074 0.005 14.918 0.000 0.074 0.181
## .JS64 0.088 0.006 14.835 0.000 0.088 0.173
## .JS65 0.068 0.005 14.064 0.000 0.068 0.125
## .JS66 0.090 0.006 14.667 0.000 0.090 0.159
## .JS67 0.082 0.006 14.830 0.000 0.082 0.173
## .JS68 0.062 0.004 13.957 0.000 0.062 0.152
## .JS69 0.072 0.005 13.531 0.000 0.072 0.135
## .JS70 0.099 0.007 15.031 0.000 0.099 0.231
## .JS71 0.118 0.008 15.317 0.000 0.118 0.272
## .JS72 0.075 0.005 14.660 0.000 0.075 0.171
## .JS73 0.086 0.006 15.145 0.000 0.086 0.221
## .JS74 0.051 0.004 13.598 0.000 0.051 0.115
## .JS75 0.072 0.005 14.191 0.000 0.072 0.141
## .JS76 0.079 0.005 14.970 0.000 0.079 0.200
## .JS77 0.075 0.005 14.879 0.000 0.075 0.191
## TL 0.786 0.074 10.668 0.000 1.000 1.000
## .Direction 1.483 0.257 5.764 0.000 0.107 0.107
## .Cultivation 1.190 0.508 2.341 0.019 0.022 0.022
## .Organization 11.636 75.785 0.154 0.878 0.015 0.015
## .Tutor 0.950 0.239 3.975 0.000 0.037 0.037
# Check out the key indices for the model
# Put it into our table
table_fit[3,] <- c("Metric Model",round(fitmeasures(MG.fit.metric,c("chisq","df","cfi","rmsea","srmr")),3))
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1783.761 | 170 | 0.944 | 0.1 | 0.019 |
| Configural Model | 1767.43 | 332 | 0.951 | 0.095 | 0.019 |
| Metric Model | 1805.315 | 351 | 0.951 | 0.093 | 0.031 |
| NA | NA | NA | NA | NA | NA |
# Running the CFA by group - Scalar or full score equivalence/invariance - constraining the factor loadings and intercepts to be equal.
# The final step is to test for scalar invariance to examine whether the item intercepts are equivalent across groups. In this case, we constrain the item intercepts to be equivalent, just as we did with the factor loadings in the previous step. If this results in a poorer multi-group model fit, we can conclude that the item intercepts are not similar for people of different gender groups.
# Ascertaining scalar invariance allows us to substantiate multi-group comparisons of factor means (e.g., t-tests or ANOVA), and we can be confident that any statistically significant differences in group means are not due to differences in scale properties at different gender groups.
MG.fit.scalar <- cfa(MG.model,
data = TL_Gender,
group = "Gender",
std.lv=T,
group.equal = c("loadings","intercepts")
)
# Request the summary of the model result
summary(MG.fit.scalar,fit.measures=T,standardized=T)
## lavaan 0.6-7 ended normally after 565 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 138
## Number of equality constraints 44
##
## Number of observations per group:
## Male 419
## Female 539
##
## Model Test User Model:
##
## Test statistic 1818.373
## Degrees of freedom 366
## P-value (Chi-square) 0.000
## Test statistic for each group:
## Male 842.341
## Female 976.032
##
## Model Test Baseline Model:
##
## Test statistic 29909.827
## Degrees of freedom 380
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.951
## Tucker-Lewis Index (TLI) 0.949
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -6635.456
## Loglikelihood unrestricted model (H1) -5726.270
##
## Akaike (AIC) 13458.912
## Bayesian (BIC) 13916.208
## Sample-size adjusted Bayesian (BIC) 13617.667
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.091
## 90 Percent confidence interval - lower 0.087
## 90 Percent confidence interval - upper 0.095
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.032
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [Male]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 3.968 0.328 12.087 0.000 0.970 0.970
## Cultvtn (.p2.) 8.288 1.507 5.501 0.000 0.993 0.993
## Orgnztn (.p3.) 32.871 114.992 0.286 0.775 1.000 1.000
## Tutor (.p4.) 5.597 0.585 9.569 0.000 0.984 0.984
## Direction =~
## JS58 (.p5.) 0.162 0.012 13.466 0.000 0.664 0.922
## JS59 (.p6.) 0.175 0.013 13.484 0.000 0.714 0.925
## JS60 (.p7.) 0.178 0.013 13.480 0.000 0.730 0.932
## JS61 (.p8.) 0.158 0.012 13.326 0.000 0.647 0.886
## Cultivation =~
## JS62 (.p9.) 0.088 0.016 5.619 0.000 0.738 0.906
## JS63 (.10.) 0.078 0.014 5.618 0.000 0.652 0.899
## JS64 (.11.) 0.087 0.016 5.616 0.000 0.729 0.892
## JS65 (.12.) 0.093 0.017 5.628 0.000 0.776 0.948
## JS66 (.13.) 0.093 0.016 5.623 0.000 0.774 0.921
## JS67 (.14.) 0.084 0.015 5.620 0.000 0.703 0.908
## Organization =~
## JS68 (.15.) 0.020 0.070 0.286 0.775 0.659 0.887
## JS69 (.16.) 0.023 0.081 0.286 0.775 0.760 0.928
## JS70 (.17.) 0.020 0.068 0.286 0.775 0.641 0.890
## JS71 (.18.) 0.019 0.067 0.286 0.775 0.630 0.851
## Tutor =~
## JS72 (.19.) 0.119 0.012 10.173 0.000 0.675 0.918
## JS73 (.20.) 0.109 0.011 10.104 0.000 0.617 0.863
## JS74 (.21.) 0.123 0.012 10.194 0.000 0.701 0.930
## JS75 (.22.) 0.131 0.013 10.203 0.000 0.745 0.941
## JS76 (.23.) 0.111 0.011 10.107 0.000 0.632 0.857
## JS77 (.24.) 0.112 0.011 10.171 0.000 0.635 0.918
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 (.50.) 4.479 0.034 132.257 0.000 4.479 6.213
## .JS59 (.51.) 4.426 0.036 122.003 0.000 4.426 5.732
## .JS60 (.52.) 4.418 0.037 118.893 0.000 4.418 5.637
## .JS61 (.53.) 4.445 0.034 131.808 0.000 4.445 6.082
## .JS62 (.54.) 4.396 0.038 116.194 0.000 4.396 5.400
## .JS63 (.55.) 4.491 0.034 133.936 0.000 4.491 6.192
## .JS64 (.56.) 4.388 0.037 117.087 0.000 4.388 5.372
## .JS65 (.57.) 4.406 0.039 112.591 0.000 4.406 5.383
## .JS66 (.58.) 4.379 0.039 111.018 0.000 4.379 5.215
## .JS67 (.59.) 4.405 0.036 122.266 0.000 4.405 5.688
## .JS68 (.60.) 4.494 0.034 131.501 0.000 4.494 6.049
## .JS69 (.61.) 4.419 0.039 113.511 0.000 4.419 5.394
## .JS70 (.62.) 4.452 0.033 132.945 0.000 4.452 6.178
## .JS71 (.63.) 4.415 0.033 131.912 0.000 4.415 5.962
## .JS72 (.64.) 4.464 0.034 129.404 0.000 4.464 6.072
## .JS73 (.65.) 4.474 0.032 138.975 0.000 4.474 6.255
## .JS74 (.66.) 4.427 0.036 124.596 0.000 4.427 5.874
## .JS75 (.67.) 4.429 0.038 117.469 0.000 4.429 5.596
## .JS76 (.68.) 4.449 0.033 135.179 0.000 4.449 6.026
## .JS77 (.69.) 4.472 0.033 137.522 0.000 4.472 6.466
## TL 0.000 0.000 0.000
## .Directn 0.000 0.000 0.000
## .Cultvtn 0.000 0.000 0.000
## .Orgnztn 0.000 0.000 0.000
## .Tutor 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.078 0.007 12.009 0.000 0.078 0.151
## .JS59 0.086 0.007 11.889 0.000 0.086 0.145
## .JS60 0.081 0.007 11.572 0.000 0.081 0.132
## .JS61 0.115 0.009 12.900 0.000 0.115 0.215
## .JS62 0.119 0.009 13.289 0.000 0.119 0.179
## .JS63 0.100 0.008 13.382 0.000 0.100 0.191
## .JS64 0.136 0.010 13.474 0.000 0.136 0.204
## .JS65 0.068 0.006 12.101 0.000 0.068 0.101
## .JS66 0.107 0.008 13.013 0.000 0.107 0.151
## .JS67 0.105 0.008 13.262 0.000 0.105 0.176
## .JS68 0.118 0.009 13.363 0.000 0.118 0.214
## .JS69 0.093 0.008 12.308 0.000 0.093 0.138
## .JS70 0.108 0.008 13.309 0.000 0.108 0.207
## .JS71 0.151 0.011 13.727 0.000 0.151 0.275
## .JS72 0.085 0.007 12.871 0.000 0.085 0.157
## .JS73 0.131 0.010 13.612 0.000 0.131 0.255
## .JS74 0.077 0.006 12.548 0.000 0.077 0.135
## .JS75 0.071 0.006 12.122 0.000 0.071 0.114
## .JS76 0.145 0.011 13.662 0.000 0.145 0.266
## .JS77 0.075 0.006 12.863 0.000 0.075 0.157
## TL 1.000 1.000 1.000
## .Direction 1.000 0.060 0.060
## .Cultivation 1.000 0.014 0.014
## .Organization 1.000 0.001 0.001
## .Tutor 1.000 0.031 0.031
##
##
## Group 2 [Female]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TL =~
## Directn (.p1.) 3.968 0.328 12.087 0.000 0.945 0.945
## Cultvtn (.p2.) 8.288 1.507 5.501 0.000 0.989 0.989
## Orgnztn (.p3.) 32.871 114.992 0.286 0.775 0.993 0.993
## Tutor (.p4.) 5.597 0.585 9.569 0.000 0.981 0.981
## Direction =~
## JS58 (.p5.) 0.162 0.012 13.466 0.000 0.604 0.941
## JS59 (.p6.) 0.175 0.013 13.484 0.000 0.650 0.958
## JS60 (.p7.) 0.178 0.013 13.480 0.000 0.664 0.932
## JS61 (.p8.) 0.158 0.012 13.326 0.000 0.589 0.878
## Cultivation =~
## JS62 (.p9.) 0.088 0.016 5.619 0.000 0.657 0.907
## JS63 (.10.) 0.078 0.014 5.618 0.000 0.581 0.905
## JS64 (.11.) 0.087 0.016 5.616 0.000 0.648 0.909
## JS65 (.12.) 0.093 0.017 5.628 0.000 0.691 0.936
## JS66 (.13.) 0.093 0.016 5.623 0.000 0.688 0.917
## JS67 (.14.) 0.084 0.015 5.620 0.000 0.626 0.910
## Organization =~
## JS68 (.15.) 0.020 0.070 0.286 0.775 0.588 0.921
## JS69 (.16.) 0.023 0.081 0.286 0.775 0.679 0.930
## JS70 (.17.) 0.020 0.068 0.286 0.775 0.573 0.877
## JS71 (.18.) 0.019 0.067 0.286 0.775 0.563 0.853
## Tutor =~
## JS72 (.19.) 0.119 0.012 10.173 0.000 0.600 0.910
## JS73 (.20.) 0.109 0.011 10.104 0.000 0.549 0.882
## JS74 (.21.) 0.123 0.012 10.194 0.000 0.624 0.941
## JS75 (.22.) 0.131 0.013 10.203 0.000 0.663 0.927
## JS76 (.23.) 0.111 0.011 10.107 0.000 0.563 0.894
## JS77 (.24.) 0.112 0.011 10.171 0.000 0.565 0.900
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 (.50.) 4.479 0.034 132.257 0.000 4.479 6.971
## .JS59 (.51.) 4.426 0.036 122.003 0.000 4.426 6.527
## .JS60 (.52.) 4.418 0.037 118.893 0.000 4.418 6.199
## .JS61 (.53.) 4.445 0.034 131.808 0.000 4.445 6.623
## .JS62 (.54.) 4.396 0.038 116.194 0.000 4.396 6.073
## .JS63 (.55.) 4.491 0.034 133.936 0.000 4.491 7.000
## .JS64 (.56.) 4.388 0.037 117.087 0.000 4.388 6.153
## .JS65 (.57.) 4.406 0.039 112.591 0.000 4.406 5.968
## .JS66 (.58.) 4.379 0.039 111.018 0.000 4.379 5.830
## .JS67 (.59.) 4.405 0.036 122.266 0.000 4.405 6.402
## .JS68 (.60.) 4.494 0.034 131.501 0.000 4.494 7.035
## .JS69 (.61.) 4.419 0.039 113.511 0.000 4.419 6.052
## .JS70 (.62.) 4.452 0.033 132.945 0.000 4.452 6.815
## .JS71 (.63.) 4.415 0.033 131.912 0.000 4.415 6.693
## .JS72 (.64.) 4.464 0.034 129.404 0.000 4.464 6.767
## .JS73 (.65.) 4.474 0.032 138.975 0.000 4.474 7.188
## .JS74 (.66.) 4.427 0.036 124.596 0.000 4.427 6.676
## .JS75 (.67.) 4.429 0.038 117.469 0.000 4.429 6.195
## .JS76 (.68.) 4.449 0.033 135.179 0.000 4.449 7.070
## .JS77 (.69.) 4.472 0.033 137.522 0.000 4.472 7.119
## TL 0.004 0.068 0.063 0.950 0.005 0.005
## .Directn 0.012 0.142 0.086 0.931 0.003 0.003
## .Cultvtn -0.070 0.256 -0.274 0.784 -0.009 -0.009
## .Orgnztn 0.251 0.104 2.407 0.016 0.009 0.009
## .Tutor 0.143 0.182 0.784 0.433 0.028 0.028
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .JS58 0.047 0.004 12.783 0.000 0.047 0.115
## .JS59 0.038 0.003 11.138 0.000 0.038 0.082
## .JS60 0.066 0.005 13.306 0.000 0.066 0.131
## .JS61 0.103 0.007 14.874 0.000 0.103 0.230
## .JS62 0.093 0.006 14.881 0.000 0.093 0.177
## .JS63 0.074 0.005 14.918 0.000 0.074 0.181
## .JS64 0.088 0.006 14.834 0.000 0.088 0.173
## .JS65 0.068 0.005 14.064 0.000 0.068 0.125
## .JS66 0.090 0.006 14.670 0.000 0.090 0.160
## .JS67 0.082 0.006 14.831 0.000 0.082 0.173
## .JS68 0.062 0.004 13.957 0.000 0.062 0.152
## .JS69 0.072 0.005 13.534 0.000 0.072 0.135
## .JS70 0.099 0.007 15.032 0.000 0.099 0.231
## .JS71 0.118 0.008 15.317 0.000 0.118 0.272
## .JS72 0.075 0.005 14.662 0.000 0.075 0.171
## .JS73 0.086 0.006 15.144 0.000 0.086 0.221
## .JS74 0.051 0.004 13.600 0.000 0.051 0.115
## .JS75 0.072 0.005 14.190 0.000 0.072 0.141
## .JS76 0.079 0.005 14.970 0.000 0.079 0.200
## .JS77 0.075 0.005 14.881 0.000 0.075 0.191
## TL 0.786 0.074 10.668 0.000 1.000 1.000
## .Direction 1.484 0.258 5.762 0.000 0.107 0.107
## .Cultivation 1.191 0.510 2.337 0.019 0.022 0.022
## .Organization 12.488 87.482 0.143 0.886 0.014 0.014
## .Tutor 0.951 0.239 3.970 0.000 0.037 0.037
# Check out the key indices for the model
# Put it into our table
table_fit[4,] <- c("Scalar Model",round(fitmeasures(MG.fit.scalar,c("chisq","df","cfi","rmsea","srmr")),3))
fitmeasures(MG.fit.scalar)
## npar fmin chisq df
## 94.000 0.949 1818.373 366.000
## pvalue baseline.chisq baseline.df baseline.pvalue
## 0.000 29909.827 380.000 0.000
## cfi tli nnfi rfi
## 0.951 0.949 0.949 0.937
## nfi pnfi ifi rni
## 0.939 0.905 0.951 0.951
## logl unrestricted.logl aic bic
## -6635.456 -5726.270 13458.912 13916.208
## ntotal bic2 rmsea rmsea.ci.lower
## 958.000 13617.667 0.091 0.087
## rmsea.ci.upper rmsea.pvalue rmr rmr_nomean
## 0.095 0.000 0.016 0.017
## srmr srmr_bentler srmr_bentler_nomean crmr
## 0.032 0.032 0.033 0.040
## crmr_nomean srmr_mplus srmr_mplus_nomean cn_05
## 0.022 0.040 0.024 217.854
## cn_01 gfi agfi pgfi
## 228.526 0.977 0.972 0.778
## mfi
## 0.469
# Check the table
kable(table_fit)
| Model | X2 | df | CFI | RMSEA | SRMR |
|---|---|---|---|---|---|
| Overall Model | 1783.761 | 170 | 0.944 | 0.1 | 0.019 |
| Configural Model | 1767.43 | 332 | 0.951 | 0.095 | 0.019 |
| Metric Model | 1805.315 | 351 | 0.951 | 0.093 | 0.031 |
| Scalar Model | 1818.373 | 366 | 0.951 | 0.091 | 0.032 |
# Comparing all the models
anova(overall.fit,MG.fit.configural,MG.fit.metric,MG.fit.scalar)
## Warning in lavTestLRT(object = new("lavaan", version = "0.6.7", call = lavaan::lavaan(model = overall.model, : lavaan WARNING: some restricted models fit better than less
## restricted models; either these models are not nested, or
## the less restricted model failed to reach a global optimum.
## Chi-Squared Difference Test
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## overall.fit 170 14246 14538 1783.8
## MG.fit.configural 332 13476 14099 1767.4 -16.331 162 1.000000
## MG.fit.metric 351 13476 14006 1805.3 37.885 19 0.006138 **
## MG.fit.scalar 366 13459 13916 1818.4 13.058 15 0.597826
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1