> # principles and practice of sem, 5th ed. > # rex b. kline, guilford press, 2023 > > # chapter 12, table 12.2, analysis 1 > # multiple group analysis of a recursive path model of > # achievement and delinquency by lynam et al. (1993) > # covariance structure and mean structure > > # to avoid the problem that some R packages share the same name > # for different functions, all functions are specified next as > > # package::function > > # which prevents masking, or the default hiding of > # a function with a redundant name from a package used next > > date() [1] "Thu Apr 13 21:28:44 2023" > > v <- R.Version() > print(paste0(v$language, " version ", v$major, ".", + v$minor, " (", v$year, "-", v$month, "-", v$day, ")")) [1] "R version 4.2.3 (2023-03-15)" > > library(lavaan) This is lavaan 0.6-15 lavaan is FREE software! Please report any bugs. > options(width = 130) > > # get citation information > citation("lavaan", auto = TRUE) To cite package ‘lavaan’ in publications use: Rosseel Y, Jorgensen TD, Rockwood N (2023). _lavaan: Latent Variable Analysis_. R package version 0.6-15, . A BibTeX entry for LaTeX users is @Manual{, title = {lavaan: Latent Variable Analysis}, author = {Yves Rosseel and Terrence D. Jorgensen and Nicholas Rockwood}, year = {2023}, note = {R package version 0.6-15}, url = {https://CRAN.R-project.org/package=lavaan}, } > > # black, n = 214 > # white, n = 181 > # input the correlations in lower diagnonal form > > blackLower.cor <- ' + 1.00 + .08 1.00 + .28 .30 1.00 + .05 .21 .50 1.00 + -.11 -.17 -.26 -.33 1.00 ' > > whiteLower.cor <- ' + 1.00 + .25 1.00 + .37 .40 1.00 + .27 .28 .61 1.00 + -.11 -.20 -.31 -.21 1.00 ' > > # name the variables and convert to full correlation matrix > black.cor <- lavaan::getCov(blackLower.cor, names = c("ses", "effort", "viq", + "achieve", "delinq")) > white.cor <- lavaan::getCov(whiteLower.cor, names = c("ses", "effort", "viq", + "achieve", "delinq")) > > # display the correlations > black.cor ses effort viq achieve delinq ses 1.00 0.08 0.28 0.05 -0.11 effort 0.08 1.00 0.30 0.21 -0.17 viq 0.28 0.30 1.00 0.50 -0.26 achieve 0.05 0.21 0.50 1.00 -0.33 delinq -0.11 -0.17 -0.26 -0.33 1.00 > white.cor ses effort viq achieve delinq ses 1.00 0.25 0.37 0.27 -0.11 effort 0.25 1.00 0.40 0.28 -0.20 viq 0.37 0.40 1.00 0.61 -0.31 achieve 0.27 0.28 0.61 1.00 -0.21 delinq -0.11 -0.20 -0.31 -0.21 1.00 > > # add the standard deviations and convert to covariances > black.cov <- lavaan::cor2cov(black.cor, sds = c(10.58,1.35,13.62,.79,1.63)) > white.cov <- lavaan::cor2cov(white.cor, sds = c(11.53,1.32,16.32,.96,1.45)) > > # input group means > black.mean <- c(31.96,-.01,93.76,2.51,1.40) > white.mean <- c(34.64,.05,104.18,2.88,1.22) > > # display the covariances and means > black.cov ses effort viq achieve delinq ses 111.936400 1.142640 40.347888 0.417910 -1.896994 effort 1.142640 1.822500 5.516100 0.223965 -0.374085 viq 40.347888 5.516100 185.504400 5.379900 -5.772156 achieve 0.417910 0.223965 5.379900 0.624100 -0.424941 delinq -1.896994 -0.374085 -5.772156 -0.424941 2.656900 > black.mean [1] 31.96 -0.01 93.76 2.51 1.40 > white.cov ses effort viq achieve delinq ses 132.940900 3.804900 69.622752 2.988576 -1.839035 effort 3.804900 1.742400 8.616960 0.354816 -0.382800 viq 69.622752 8.616960 266.342400 9.556992 -7.335840 achieve 2.988576 0.354816 9.556992 0.921600 -0.292320 delinq -1.839035 -0.382800 -7.335840 -0.292320 2.102500 > white.mean [1] 34.64 0.05 104.18 2.88 1.22 > > # specify fit statistics for abbreviated output > fit.stats = c("chisq", "df", "pvalue", + "rmsea", "rmsea.ci.lower", "rmsea.ci.upper", "cfi", "srmr") > > # combine covariances matrices, mean vectors, and group sizes > # into single list objects > > combined.cov <- list(black = black.cov, white = white.cov) > combined.mean <- list(black = black.mean, white = white.mean) > combined.n <- list(black = 214, white = 181) > > # specify basic covariance model > > lynam.model <- ' + achieve ~ ses + effort + viq + delinq ~ achieve + ses + effort + viq ' > > # mean structure and equality constraints for direct > # effects or intercepts are specified in syntax for > # fitting each model to the data > > # model 1 > # all 7 direct effect constrained to equality > # over groups > > lynam1 <- lavaan::sem(lynam.model, sample.cov = combined.cov, + sample.mean = combined.mean, sample.nobs = combined.n, + group.equal = c("regressions"), fixed.x = FALSE, meanstructure = TRUE) > > # model 2 > # direct effects constrained to equality over groups > # but the constraint on achievement -> delinguency is > # released in syntax for "group.partial" > # so 6 direct effects are constrained over groups > > lynam2 <- lavaan::sem(lynam.model, sample.cov = combined.cov, + sample.mean = combined.mean, sample.nobs = combined.n, + group.equal = c("regressions"), group.partial = c("delinq ~ achieve"), + fixed.x = FALSE, meanstructure = TRUE) > > # model 3 > # retained model > # 6 direct effects constrained to equality over groups > # achievement -> delinguency is a free parameter in both groups > # intercept for achievement constrained to equality > > lynam3 <- lavaan::sem(lynam.model, sample.cov = combined.cov, + sample.mean = combined.mean, sample.nobs = combined.n, + group.equal = c("regressions", "intercepts"), + group.partial = c("delinq ~ achieve", "delinq ~ 1"), + fixed.x = FALSE, meanstructure = TRUE) > > # model 4 > # 6 direct effects constrained to equality over groups > # achievement -> delinguency is a free parameter in both groups > # intercept for deleinquency constrained to equality > > lynam4 <- lavaan::sem(lynam.model, sample.cov = combined.cov, + sample.mean = combined.mean, sample.nobs = combined.n, + group.equal = c("regressions", "intercepts"), + group.partial = c("delinq ~ achieve", "achieve ~ 1"), + fixed.x = FALSE, meanstructure = TRUE) > > # global fit statistics > lavaan::fitMeasures(lynam1, fit.stats) chisq df pvalue rmsea rmsea.ci.lower rmsea.ci.upper cfi srmr 11.736 7.000 0.110 0.059 0.000 0.115 0.975 0.036 > lavaan::fitMeasures(lynam2, fit.stats) chisq df pvalue rmsea rmsea.ci.lower rmsea.ci.upper cfi srmr 6.107 6.000 0.411 0.010 0.000 0.093 0.999 0.029 > lavaan::fitMeasures(lynam3, fit.stats) chisq df pvalue rmsea rmsea.ci.lower rmsea.ci.upper cfi srmr 6.409 7.000 0.493 0.000 0.000 0.083 1.000 0.030 > lavaan::fitMeasures(lynam4, fit.stats) chisq df pvalue rmsea rmsea.ci.lower rmsea.ci.upper cfi srmr 10.237 7.000 0.176 0.048 0.000 0.107 0.983 0.033 > > # chi square difference tests > lavaan::anova(lynam1, lynam2) Chi-Squared Difference Test Df AIC BIC Chisq Chisq diff RMSEA Df diff Pr(>Chisq) lynam2 6 9850.2 9985.5 6.1073 lynam1 7 9853.8 9985.1 11.7357 5.6284 0.15308 1 0.01767 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > lavaan::anova(lynam2, lynam3) Chi-Squared Difference Test Df AIC BIC Chisq Chisq diff RMSEA Df diff Pr(>Chisq) lynam2 6 9850.2 9985.5 6.1073 lynam3 7 9848.5 9979.8 6.4090 0.30174 0 1 0.5828 > lavaan::anova(lynam2, lynam4) Chi-Squared Difference Test Df AIC BIC Chisq Chisq diff RMSEA Df diff Pr(>Chisq) lynam2 6 9850.2 9985.5 6.1073 lynam4 7 9852.3 9983.6 10.2368 4.1295 0.12588 1 0.04214 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > # model 1 > # parameter estimates, residuals > # all mean residuals are zero > > lavaan::summary(lynam1, standardized = TRUE, fit.measures = FALSE) lavaan 0.6.15 ended normally after 45 iterations Estimator ML Optimization method NLMINB Number of model parameters 40 Number of equality constraints 7 Number of observations per group: black 214 white 181 Model Test User Model: Test statistic 11.736 Degrees of freedom 7 P-value (Chi-square) 0.110 Test statistic for each group: black 6.456 white 5.279 Parameter Estimates: Standard errors Standard Information Expected Information saturated (h1) model Structured Group 1 [black]: Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all achieve ~ ses (.p1.) -0.002 0.003 -0.688 0.491 -0.002 -0.031 effort (.p2.) 0.037 0.029 1.302 0.193 0.037 0.062 viq (.p3.) 0.032 0.003 11.719 0.000 0.032 0.532 delinq ~ achieve (.p4.) -0.255 0.101 -2.515 0.012 -0.255 -0.130 ses (.p5.) -0.002 0.007 -0.279 0.781 -0.002 -0.013 effort (.p6.) -0.101 0.059 -1.708 0.088 -0.101 -0.085 viq (.p7.) -0.017 0.006 -2.668 0.008 -0.017 -0.144 Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all ses ~~ effort 1.137 0.975 1.167 0.243 1.137 0.080 viq 40.159 10.181 3.944 0.000 40.159 0.280 effort ~~ viq 5.490 1.306 4.204 0.000 5.490 0.300 Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve -0.395 0.251 -1.575 0.115 -0.395 -0.486 .delinq 3.686 0.507 7.268 0.000 3.686 2.310 ses 31.960 0.722 44.294 0.000 31.960 3.028 effort -0.010 0.092 -0.109 0.914 -0.010 -0.007 viq 93.760 0.929 100.940 0.000 93.760 6.900 Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve 0.463 0.045 10.344 0.000 0.463 0.702 .delinq 2.344 0.227 10.344 0.000 2.344 0.921 ses 111.413 10.771 10.344 0.000 111.413 1.000 effort 1.814 0.175 10.344 0.000 1.814 1.000 viq 184.638 17.850 10.344 0.000 184.638 1.000 Group 2 [white]: Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all achieve ~ ses (.p1.) -0.002 0.003 -0.688 0.491 -0.002 -0.030 effort (.p2.) 0.037 0.029 1.302 0.193 0.037 0.053 viq (.p3.) 0.032 0.003 11.719 0.000 0.032 0.558 delinq ~ achieve (.p4.) -0.255 0.101 -2.515 0.012 -0.255 -0.160 ses (.p5.) -0.002 0.007 -0.279 0.781 -0.002 -0.015 effort (.p6.) -0.101 0.059 -1.708 0.088 -0.101 -0.090 viq (.p7.) -0.017 0.006 -2.668 0.008 -0.017 -0.186 Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all ses ~~ effort 3.784 1.160 3.263 0.001 3.784 0.250 viq 69.238 14.831 4.669 0.000 69.238 0.370 effort ~~ viq 8.569 1.715 4.997 0.000 8.569 0.400 Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve -0.352 0.278 -1.264 0.206 -0.352 -0.379 .delinq 3.788 0.558 6.787 0.000 3.788 2.564 ses 34.640 0.855 40.531 0.000 34.640 3.013 effort 0.050 0.098 0.511 0.609 0.050 0.038 viq 104.180 1.210 86.120 0.000 104.180 6.401 Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve 0.580 0.061 9.513 0.000 0.580 0.674 .delinq 1.904 0.200 9.513 0.000 1.904 0.873 ses 132.206 13.897 9.513 0.000 132.206 1.000 effort 1.733 0.182 9.513 0.000 1.733 1.000 viq 264.871 27.843 9.513 0.000 264.871 1.000 > lavaan::fitted(lynam1) $black $black$cov achiev delinq ses effort viq achieve 0.659 delinq -0.295 2.545 ses 1.053 -1.280 111.413 effort 0.240 -0.339 1.137 1.814 viq 5.980 -5.277 40.159 5.490 184.638 $black$mean achieve delinq ses effort viq 2.51 1.40 31.96 -0.01 93.76 $white $white$cov achiev delinq ses effort viq achieve 0.860 delinq -0.401 2.181 ses 2.027 -2.328 132.206 effort 0.328 -0.411 3.784 1.733 viq 8.577 -7.662 69.238 8.569 264.871 $white$mean achieve delinq ses effort viq 2.88 1.22 34.64 0.05 104.18 > lavaan::residuals(lynam1, type = "raw") $black $black$type [1] "raw" $black$cov achiev delinq ses effort viq achieve -0.038 delinq -0.128 0.099 ses -0.637 -0.608 0.000 effort -0.017 -0.033 0.000 0.000 viq -0.625 -0.468 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0 0 0 0 0 $white $white$type [1] "raw" $white$cov achiev delinq ses effort viq achieve 0.056 delinq 0.111 -0.091 ses 0.945 0.499 0.000 effort 0.025 0.030 0.000 0.000 viq 0.927 0.367 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0 0 0 0 0 > lavaan::residuals(lynam1, type = "standardized.mplus") $black $black$type [1] "standardized.mplus" $black$cov achiev delinq ses effort viq achieve -1.956 delinq -1.861 0.992 ses -2.224 -0.708 0.003 effort -0.490 -0.321 0.000 0.000 viq -1.734 -0.406 0.013 0.000 NA $black$mean achieve delinq ses effort viq 0 0 0 0 0 $white $white$type [1] "standardized.mplus" $white$cov achiev delinq ses effort viq achieve 1.040 delinq 1.693 -3.709 ses 1.723 0.670 0.000 effort 0.392 0.329 0.000 0.000 viq 1.191 0.370 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0 0 0 0 0 > lavaan::residuals(lynam1, type = "normalized") $black $black$type [1] "normalized" $black$cov achiev delinq ses effort viq achieve -0.632 delinq -1.384 0.389 ses -1.119 -0.515 0.000 effort -0.225 -0.220 0.000 0.000 viq -0.764 -0.300 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0 0 0 0 0 $white $white$type [1] "normalized" $white$cov achiev delinq ses effort viq achieve 0.584 delinq 1.051 -0.412 ses 1.115 0.401 0.000 effort 0.254 0.207 0.000 0.000 viq 0.684 0.200 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0 0 0 0 0 > lavaan::residuals(lynam1, type = "cor.bollen") $black $black$type [1] "cor.bollen" $black$cov achiev delinq ses effort viq achieve 0.000 delinq -0.102 0.000 ses -0.073 -0.034 0.000 effort -0.009 -0.012 0.000 0.000 viq -0.042 -0.017 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0 0 0 0 0 $white $white$type [1] "cor.bollen" $white$cov achiev delinq ses effort viq achieve 0.000 delinq 0.083 0.000 ses 0.080 0.027 0.000 effort 0.011 0.011 0.000 0.000 viq 0.042 0.009 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0 0 0 0 0 > > # model 2 > # parameter estimates, residuals > # all mean residuals are zero > > lavaan::summary(lynam2, standardized = TRUE, fit.measures = FALSE) lavaan 0.6.15 ended normally after 48 iterations Estimator ML Optimization method NLMINB Number of model parameters 40 Number of equality constraints 6 Number of observations per group: black 214 white 181 Model Test User Model: Test statistic 6.107 Degrees of freedom 6 P-value (Chi-square) 0.411 Test statistic for each group: black 2.989 white 3.118 Parameter Estimates: Standard errors Standard Information Expected Information saturated (h1) model Structured Group 1 [black]: Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all achieve ~ ses (.p1.) -0.002 0.003 -0.688 0.491 -0.002 -0.031 effort (.p2.) 0.037 0.029 1.302 0.193 0.037 0.062 viq (.p3.) 0.032 0.003 11.719 0.000 0.032 0.532 delinq ~ achieve -0.493 0.139 -3.555 0.000 -0.493 -0.244 ses (.p5.) -0.003 0.007 -0.494 0.621 -0.003 -0.022 effort (.p6.) -0.099 0.059 -1.688 0.091 -0.099 -0.081 viq (.p7.) -0.017 0.006 -2.768 0.006 -0.017 -0.144 Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all ses ~~ effort 1.137 0.975 1.167 0.243 1.137 0.080 viq 40.159 10.181 3.944 0.000 40.159 0.280 effort ~~ viq 5.490 1.306 4.204 0.000 5.490 0.300 Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve -0.395 0.251 -1.575 0.115 -0.395 -0.486 .delinq 4.380 0.566 7.739 0.000 4.380 2.668 ses 31.960 0.722 44.294 0.000 31.960 3.028 effort -0.010 0.092 -0.109 0.914 -0.010 -0.007 viq 93.760 0.929 100.940 0.000 93.760 6.900 Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve 0.463 0.045 10.344 0.000 0.463 0.702 .delinq 2.306 0.223 10.344 0.000 2.306 0.856 ses 111.413 10.771 10.344 0.000 111.413 1.000 effort 1.814 0.175 10.344 0.000 1.814 1.000 viq 184.638 17.850 10.344 0.000 184.638 1.000 Group 2 [white]: Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all achieve ~ ses (.p1.) -0.002 0.003 -0.688 0.491 -0.002 -0.030 effort (.p2.) 0.037 0.029 1.302 0.193 0.037 0.053 viq (.p3.) 0.032 0.003 11.719 0.000 0.032 0.558 delinq ~ achieve -0.087 0.125 -0.700 0.484 -0.087 -0.056 ses (.p5.) -0.003 0.007 -0.494 0.621 -0.003 -0.028 effort (.p6.) -0.099 0.059 -1.688 0.091 -0.099 -0.091 viq (.p7.) -0.017 0.006 -2.768 0.006 -0.017 -0.198 Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all ses ~~ effort 3.784 1.160 3.263 0.001 3.784 0.250 viq 69.238 14.831 4.669 0.000 69.238 0.370 effort ~~ viq 8.569 1.715 4.997 0.000 8.569 0.400 Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve -0.352 0.278 -1.264 0.206 -0.352 -0.379 .delinq 3.411 0.586 5.820 0.000 3.411 2.376 ses 34.640 0.855 40.531 0.000 34.640 3.013 effort 0.050 0.098 0.511 0.609 0.050 0.038 viq 104.180 1.210 86.120 0.000 104.180 6.401 Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve 0.580 0.061 9.513 0.000 0.580 0.674 .delinq 1.881 0.198 9.513 0.000 1.881 0.913 ses 132.206 13.897 9.513 0.000 132.206 1.000 effort 1.733 0.182 9.513 0.000 1.733 1.000 viq 264.871 27.843 9.513 0.000 264.871 1.000 > lavaan::fitted(lynam2) $black $black$cov achiev delinq ses effort viq achieve 0.659 delinq -0.456 2.696 ses 1.053 -1.717 111.413 effort 0.240 -0.397 1.137 1.814 viq 5.980 -6.846 40.159 5.490 184.638 $black$mean achieve delinq ses effort viq 2.51 1.40 31.96 -0.01 93.76 $white $white$cov achiev delinq ses effort viq achieve 0.860 delinq -0.264 2.060 ses 2.027 -2.215 132.206 effort 0.328 -0.362 3.784 1.733 viq 8.577 -6.450 69.238 8.569 264.871 $white$mean achieve delinq ses effort viq 2.88 1.22 34.64 0.05 104.18 > lavaan::residuals(lynam2, type = "raw") $black $black$type [1] "raw" $black$cov achiev delinq ses effort viq achieve -0.038 delinq 0.033 -0.051 ses -0.637 -0.171 0.000 effort -0.017 0.025 0.000 0.000 viq -0.625 1.101 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0 0 0 0 0 $white $white$type [1] "raw" $white$cov achiev delinq ses effort viq achieve 0.056 delinq -0.027 0.031 ses 0.945 0.386 0.000 effort 0.025 -0.018 0.000 0.000 viq 0.927 -0.845 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0 0 0 0 0 > lavaan::residuals(lynam2, type = "standardized.mplus") $black $black$type [1] "standardized.mplus" $black$cov achiev delinq ses effort viq achieve -1.956 delinq NA NA ses -2.224 -0.214 0.000 effort -0.490 0.264 0.000 0.000 viq -1.734 1.260 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0 0 0 0 0 $white $white$type [1] "standardized.mplus" $white$cov achiev delinq ses effort viq achieve 1.040 delinq -0.764 0.552 ses 1.723 0.493 0.000 effort 0.392 -0.194 0.000 0.000 viq 1.191 -0.901 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0 0 0 0 0 > lavaan::residuals(lynam2, type = "normalized") $black $black$type [1] "normalized" $black$cov achiev delinq ses effort viq achieve -0.632 delinq 0.363 -0.201 ses -1.119 -0.145 0.000 effort -0.225 0.164 0.000 0.000 viq -0.764 0.706 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0 0 0 0 0 $white $white$type [1] "normalized" $white$cov achiev delinq ses effort viq achieve 0.584 delinq -0.255 0.140 ses 1.115 0.310 0.000 effort 0.254 -0.126 0.000 0.000 viq 0.684 -0.462 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0 0 0 0 0 > lavaan::residuals(lynam2, type = "cor.bollen") $black $black$type [1] "cor.bollen" $black$cov achiev delinq ses effort viq achieve 0.000 delinq 0.012 0.000 ses -0.073 -0.011 0.000 effort -0.009 0.010 0.000 0.000 viq -0.042 0.047 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0 0 0 0 0 $white $white$type [1] "cor.bollen" $white$cov achiev delinq ses effort viq achieve 0.000 delinq -0.012 0.000 ses 0.080 0.024 0.000 effort 0.011 -0.008 0.000 0.000 viq 0.042 -0.034 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0 0 0 0 0 > > # model 3 > # retained model > # parameter estimates, residuals, predicted means > # not all mean residuals are zero > > lavaan::summary(lynam3, standardized = TRUE, fit.measures = FALSE) lavaan 0.6.15 ended normally after 53 iterations Estimator ML Optimization method NLMINB Number of model parameters 40 Number of equality constraints 7 Number of observations per group: black 214 white 181 Model Test User Model: Test statistic 6.409 Degrees of freedom 7 P-value (Chi-square) 0.493 Test statistic for each group: black 3.388 white 3.021 Parameter Estimates: Standard errors Standard Information Expected Information saturated (h1) model Structured Group 1 [black]: Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all achieve ~ ses (.p1.) -0.002 0.003 -0.679 0.497 -0.002 -0.031 effort (.p2.) 0.036 0.029 1.253 0.210 0.036 0.059 viq (.p3.) 0.032 0.003 12.557 0.000 0.032 0.538 delinq ~ achieve -0.493 0.138 -3.564 0.000 -0.493 -0.245 ses (.p5.) -0.003 0.007 -0.494 0.621 -0.003 -0.022 effort (.p6.) -0.099 0.059 -1.689 0.091 -0.099 -0.081 viq (.p7.) -0.017 0.006 -2.757 0.006 -0.017 -0.144 Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all ses ~~ effort 1.137 0.975 1.167 0.243 1.137 0.080 viq 40.159 10.182 3.944 0.000 40.159 0.280 effort ~~ viq 5.490 1.306 4.204 0.000 5.490 0.300 Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve (.16.) -0.426 0.245 -1.740 0.082 -0.426 -0.522 .delinq 4.380 0.566 7.733 0.000 4.380 2.666 ses 31.960 0.722 44.294 0.000 31.960 3.028 effort -0.010 0.092 -0.109 0.914 -0.010 -0.007 viq 93.760 0.929 100.940 0.000 93.760 6.900 Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve 0.463 0.045 10.344 0.000 0.463 0.697 .delinq 2.306 0.223 10.344 0.000 2.306 0.855 ses 111.413 10.771 10.344 0.000 111.413 1.000 effort 1.814 0.175 10.344 0.000 1.814 1.000 viq 184.638 17.850 10.344 0.000 184.638 1.000 Group 2 [white]: Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all achieve ~ ses (.p1.) -0.002 0.003 -0.679 0.497 -0.002 -0.029 effort (.p2.) 0.036 0.029 1.253 0.210 0.036 0.051 viq (.p3.) 0.032 0.003 12.557 0.000 0.032 0.564 delinq ~ achieve -0.087 0.124 -0.701 0.483 -0.087 -0.057 ses (.p5.) -0.003 0.007 -0.494 0.621 -0.003 -0.028 effort (.p6.) -0.099 0.059 -1.689 0.091 -0.099 -0.091 viq (.p7.) -0.017 0.006 -2.757 0.006 -0.017 -0.198 Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all ses ~~ effort 3.784 1.160 3.263 0.001 3.784 0.250 viq 69.238 14.831 4.669 0.000 69.238 0.370 effort ~~ viq 8.569 1.715 4.997 0.000 8.569 0.400 Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve (.16.) -0.426 0.245 -1.740 0.082 -0.426 -0.457 .delinq 3.411 0.586 5.823 0.000 3.411 2.376 ses 34.640 0.855 40.531 0.000 34.640 3.013 effort 0.050 0.098 0.511 0.609 0.050 0.038 viq 104.180 1.210 86.120 0.000 104.180 6.401 Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve 0.580 0.061 9.513 0.000 0.580 0.668 .delinq 1.881 0.198 9.513 0.000 1.881 0.913 ses 132.206 13.897 9.513 0.000 132.206 1.000 effort 1.733 0.182 9.513 0.000 1.733 1.000 viq 264.871 27.843 9.513 0.000 264.871 1.000 > lavaan::fitted(lynam3) $black $black$cov achiev delinq ses effort viq achieve 0.665 delinq -0.461 2.699 ses 1.074 -1.727 111.413 effort 0.239 -0.397 1.137 1.814 viq 6.062 -6.887 40.159 5.490 184.638 $black$mean achieve delinq ses effort viq 2.525 1.392 31.960 -0.010 93.760 $white $white$cov achiev delinq ses effort viq achieve 0.867 delinq -0.267 2.061 ses 2.059 -2.217 132.206 effort 0.330 -0.363 3.784 1.733 viq 8.693 -6.460 69.238 8.569 264.871 $white$mean achieve delinq ses effort viq 2.857 1.222 34.640 0.050 104.180 > lavaan::residuals(lynam3, type = "raw") $black $black$type [1] "raw" $black$cov achiev delinq ses effort viq achieve -0.044 delinq 0.038 -0.054 ses -0.658 -0.161 0.000 effort -0.017 0.025 0.000 0.000 viq -0.707 1.141 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq -0.015 0.008 0.000 0.000 0.000 $white $white$type [1] "raw" $white$cov achiev delinq ses effort viq achieve 0.049 delinq -0.024 0.030 ses 0.913 0.389 0.000 effort 0.023 -0.018 0.000 0.000 viq 0.811 -0.835 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0.023 -0.002 0.000 0.000 0.000 > lavaan::residuals(lynam3, type = "standardized.mplus") $black $black$type [1] "standardized.mplus" $black$cov achiev delinq ses effort viq achieve -2.159 delinq NA NA ses -2.321 -0.201 NA effort -0.496 0.263 0.000 0.000 viq -1.872 1.311 NA NA NA $black$mean achieve delinq ses effort viq -0.641 NA 0.000 0.000 0.000 $white $white$type [1] "standardized.mplus" $white$cov achiev delinq ses effort viq achieve 0.894 delinq -0.699 0.546 ses 1.674 0.497 0.005 effort 0.371 -0.193 0.000 0.000 viq 1.023 -0.894 0.010 NA NA $white$mean achieve delinq ses effort viq 0.510 -0.146 0.000 0.000 0.000 > lavaan::residuals(lynam3, type = "normalized") $black $black$type [1] "normalized" $black$cov achiev delinq ses effort viq achieve -0.732 delinq 0.411 -0.212 ses -1.156 -0.136 0.000 effort -0.223 0.163 0.000 0.000 viq -0.864 0.731 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq -0.283 0.068 0.000 0.000 0.000 $white $white$type [1] "normalized" $white$cov achiev delinq ses effort viq achieve 0.511 delinq -0.227 0.138 ses 1.078 0.313 0.000 effort 0.238 -0.125 0.000 0.000 viq 0.598 -0.456 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0.317 -0.018 0.000 0.000 0.000 > lavaan::residuals(lynam3, type = "cor.bollen") $black $black$type [1] "cor.bollen" $black$cov achiev delinq ses effort viq achieve 0.000 delinq 0.014 0.000 ses -0.075 -0.010 0.000 effort -0.008 0.009 0.000 0.000 viq -0.047 0.049 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq -0.019 0.005 0.000 0.000 0.000 $white $white$type [1] "cor.bollen" $white$cov achiev delinq ses effort viq achieve 0.000 delinq -0.010 0.000 ses 0.078 0.024 0.000 effort 0.011 -0.008 0.000 0.000 viq 0.036 -0.033 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0.024 -0.001 0.000 0.000 0.000 > > # model 4 > # parameter estimates, residuals, predicted means > # not all mean residuals are zero > > lavaan::summary(lynam4, standardized = TRUE, fit.measures = FALSE) lavaan 0.6.15 ended normally after 40 iterations Estimator ML Optimization method NLMINB Number of model parameters 40 Number of equality constraints 7 Number of observations per group: black 214 white 181 Model Test User Model: Test statistic 10.237 Degrees of freedom 7 P-value (Chi-square) 0.176 Test statistic for each group: black 5.392 white 4.845 Parameter Estimates: Standard errors Standard Information Expected Information saturated (h1) model Structured Group 1 [black]: Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all achieve ~ ses (.p1.) -0.002 0.003 -0.688 0.491 -0.002 -0.031 effort (.p2.) 0.037 0.029 1.302 0.193 0.037 0.062 viq (.p3.) 0.032 0.003 11.719 0.000 0.032 0.532 delinq ~ achieve -0.302 0.107 -2.831 0.005 -0.302 -0.153 ses (.p5.) -0.002 0.007 -0.329 0.742 -0.002 -0.015 effort (.p6.) -0.096 0.059 -1.638 0.101 -0.096 -0.081 viq (.p7.) -0.018 0.006 -2.867 0.004 -0.018 -0.153 Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all ses ~~ effort 1.137 0.975 1.167 0.243 1.137 0.080 viq 40.159 10.181 3.944 0.000 40.159 0.280 effort ~~ viq 5.490 1.306 4.204 0.000 5.490 0.300 Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve -0.395 0.251 -1.575 0.115 -0.395 -0.486 .delinq (.17.) 3.882 0.527 7.365 0.000 3.882 2.419 ses 31.960 0.722 44.294 0.000 31.960 3.028 effort -0.010 0.092 -0.109 0.914 -0.010 -0.007 viq 93.760 0.929 100.940 0.000 93.760 6.900 Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve 0.463 0.045 10.344 0.000 0.463 0.702 .delinq 2.332 0.225 10.344 0.000 2.332 0.906 ses 111.413 10.771 10.344 0.000 111.413 1.000 effort 1.814 0.175 10.344 0.000 1.814 1.000 viq 184.638 17.850 10.344 0.000 184.638 1.000 Group 2 [white]: Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all achieve ~ ses (.p1.) -0.002 0.003 -0.688 0.491 -0.002 -0.030 effort (.p2.) 0.037 0.029 1.302 0.193 0.037 0.053 viq (.p3.) 0.032 0.003 11.719 0.000 0.032 0.558 delinq ~ achieve -0.225 0.103 -2.173 0.030 -0.225 -0.141 ses (.p5.) -0.002 0.007 -0.329 0.742 -0.002 -0.018 effort (.p6.) -0.096 0.059 -1.638 0.101 -0.096 -0.086 viq (.p7.) -0.018 0.006 -2.867 0.004 -0.018 -0.200 Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all ses ~~ effort 3.784 1.160 3.263 0.001 3.784 0.250 viq 69.238 14.831 4.669 0.000 69.238 0.370 effort ~~ viq 8.569 1.715 4.997 0.000 8.569 0.400 Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve -0.352 0.278 -1.264 0.206 -0.352 -0.379 .delinq (.17.) 3.882 0.527 7.365 0.000 3.882 2.635 ses 34.640 0.855 40.531 0.000 34.640 3.013 effort 0.050 0.098 0.511 0.609 0.050 0.038 viq 104.180 1.210 86.120 0.000 104.180 6.401 Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .achieve 0.580 0.061 9.513 0.000 0.580 0.674 .delinq 1.899 0.200 9.513 0.000 1.899 0.875 ses 132.206 13.897 9.513 0.000 132.206 1.000 effort 1.733 0.182 9.513 0.000 1.733 1.000 viq 264.871 27.843 9.513 0.000 264.871 1.000 > lavaan::fitted(lynam4) $black $black$cov achiev delinq ses effort viq achieve 0.659 delinq -0.333 2.574 ses 1.053 -1.412 111.413 effort 0.240 -0.349 1.137 1.814 viq 5.980 -5.771 40.159 5.490 184.638 $black$mean achieve delinq ses effort viq 2.510 1.354 31.960 -0.010 93.760 $white $white$cov achiev delinq ses effort viq achieve 0.860 delinq -0.385 2.170 ses 2.027 -2.379 132.206 effort 0.328 -0.405 3.784 1.733 viq 8.577 -7.708 69.238 8.569 264.871 $white$mean achieve delinq ses effort viq 2.880 1.264 34.640 0.050 104.180 > lavaan::residuals(lynam4, type = "raw") $black $black$type [1] "raw" $black$cov achiev delinq ses effort viq achieve -0.038 delinq -0.090 0.070 ses -0.637 -0.476 0.000 effort -0.017 -0.023 0.000 0.000 viq -0.625 0.026 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0.000 0.046 0.000 0.000 0.000 $white $white$type [1] "raw" $white$cov achiev delinq ses effort viq achieve 0.056 delinq 0.094 -0.079 ses 0.945 0.550 0.000 effort 0.025 0.024 0.000 0.000 viq 0.927 0.412 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0.000 -0.044 0.000 0.000 0.000 > lavaan::residuals(lynam4, type = "standardized.mplus") $black $black$type [1] "standardized.mplus" $black$cov achiev delinq ses effort viq achieve -1.956 delinq -1.480 0.758 ses -2.224 -0.564 0.006 effort -0.490 -0.224 0.000 0.000 viq -1.734 0.024 0.040 NA NA $black$mean achieve delinq ses effort viq 0.000 1.585 0.000 0.000 0.000 $white $white$type [1] "standardized.mplus" $white$cov achiev delinq ses effort viq achieve 1.040 delinq 1.397 -2.023 ses 1.723 0.732 0.000 effort 0.392 0.264 0.000 0.000 viq 1.191 0.390 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0.000 -6.402 0.000 0.000 0.000 > lavaan::residuals(lynam4, type = "normalized") $black $black$type [1] "normalized" $black$cov achiev delinq ses effort viq achieve -0.632 delinq -0.976 0.274 ses -1.119 -0.403 0.000 effort -0.225 -0.151 0.000 0.000 viq -0.764 0.016 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0.000 0.416 0.000 0.000 0.000 $white $white$type [1] "normalized" $white$cov achiev delinq ses effort viq achieve 0.584 delinq 0.895 -0.358 ses 1.115 0.443 0.000 effort 0.254 0.167 0.000 0.000 viq 0.684 0.225 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0.000 -0.414 0.000 0.000 0.000 > lavaan::residuals(lynam4, type = "cor.bollen") $black $black$type [1] "cor.bollen" $black$cov achiev delinq ses effort viq achieve 0.000 delinq -0.074 0.000 ses -0.073 -0.027 0.000 effort -0.009 -0.008 0.000 0.000 viq -0.042 0.005 0.000 0.000 0.000 $black$mean achieve delinq ses effort viq 0.000 0.028 0.000 0.000 0.000 $white $white$type [1] "cor.bollen" $white$cov achiev delinq ses effort viq achieve 0.000 delinq 0.072 0.000 ses 0.080 0.030 0.000 effort 0.011 0.009 0.000 0.000 viq 0.042 0.012 0.000 0.000 0.000 $white$mean achieve delinq ses effort viq 0.000 -0.031 0.000 0.000 0.000