library(lavaan)
setwd(mypath) # change it to the path of your own data folder
chinese <- read.delim("ENGLISHchineseread.txt", sep = "\t", header = F)
korean <- read.delim("ENGLISHkoreanread.txt", sep = "\t", header = F)
chinese$country <- 1
korean$country <- 2
both.data <- rbind(chinese, korean)
colnames(both.data) <- c('read1', 'read2', 'read3', 'country')
language.model <- '
read =~ 1*read1 + c(a,a)*read2 + c(b,b)*read3
read ~ c(0,NA)*1
read1 ~ c(c,c)*1
read2 ~ c(d,d)*1
read3 ~ c(e,e)*1
'
language.fit <- sem(language.model, both.data, group = "country")
summary(language.fit, fit.measures = T, standardized = T)
## lavaan 0.6.15 ended normally after 88 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 19
## Number of equality constraints 5
##
## Number of observations per group:
## 1 86
## 2 96
##
## Model Test User Model:
##
## Test statistic 2.675
## Degrees of freedom 4
## P-value (Chi-square) 0.614
## Test statistic for each group:
## 1 1.853
## 2 0.821
##
## Model Test Baseline Model:
##
## Test statistic 370.321
## Degrees of freedom 6
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.005
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1614.747
## Loglikelihood unrestricted model (H1) -1613.410
##
## Akaike (AIC) 3257.494
## Bayesian (BIC) 3302.350
## Sample-size adjusted Bayesian (SABIC) 3258.010
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.132
## P-value H_0: RMSEA <= 0.050 0.708
## P-value H_0: RMSEA >= 0.080 0.187
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.025
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
##
## Group 1 [1]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## read =~
## read1 1.000 6.106 0.880
## read2 (a) 1.001 0.060 16.704 0.000 6.115 0.867
## read3 (b) 0.900 0.059 15.289 0.000 5.497 0.763
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## read 0.000 0.000 0.000
## .read1 (c) 16.208 0.719 22.532 0.000 16.208 2.336
## .read2 (d) 17.335 0.722 24.002 0.000 17.335 2.456
## .read3 (e) 18.180 0.675 26.926 0.000 18.180 2.523
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .read1 10.840 3.042 3.564 0.000 10.840 0.225
## .read2 12.410 3.188 3.892 0.000 12.410 0.249
## .read3 21.697 3.996 5.430 0.000 21.697 0.418
## read 37.287 6.849 5.444 0.000 1.000 1.000
##
##
## Group 2 [2]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## read =~
## read1 1.000 5.660 0.885
## read2 (a) 1.001 0.060 16.704 0.000 5.668 0.931
## read3 (b) 0.900 0.059 15.289 0.000 5.095 0.890
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## read 2.948 0.927 3.180 0.001 0.521 0.521
## .read1 (c) 16.208 0.719 22.532 0.000 16.208 2.535
## .read2 (d) 17.335 0.722 24.002 0.000 17.335 2.848
## .read3 (e) 18.180 0.675 26.926 0.000 18.180 3.174
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .read1 8.844 1.787 4.949 0.000 8.844 0.216
## .read2 4.915 1.432 3.432 0.001 4.915 0.133
## .read3 6.837 1.418 4.822 0.000 6.837 0.208
## read 32.034 5.574 5.747 0.000 1.000 1.000
© Copyright 2024
@Yi Feng
and
@Gregory R. Hancock.