require(OpenMx) library(metaSEM) # Use more than one cores mxOption(NULL, 'Number of Threads', parallel::detectCores()-2) # Load data R1 <- matrix(c(1.00, 0.41, 0.11, 0.31, 0.20, 0.53, 0.41, 1.00, 0.19, 0.01, 0.35, 0.55, 0.11, 0.19, 1.00, 0.18, 0.28, 0.09, 0.31, 0.01, 0.18, 1.00, 0.01, 0.55, 0.20, 0.35, 0.28, 0.01, 1.00, 0.51, 0.53, 0.55, 0.09, 0.55, 0.51, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R2 <- matrix(c(1.000, -0.045, -0.030, -0.021, 0.008, 0.090, -0.045, 1.000, 0.323, 0.504, 0.435, 0.520, -0.030, 0.323, 1.000, 0.351, 0.326, 0.409, -0.021, 0.504, 0.351, 1.000, 0.342, 0.536, 0.008, 0.435, 0.326, 0.342, 1.000, 0.588, 0.090, 0.520, 0.409, 0.536, 0.588, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R3 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, 0.580, -0.228, 0.866, 0.351, NA, 0.580, 1.000, -0.028, 0.395, 0.818, NA, -0.228, -0.028, 1.000, -0.015, 0.183, NA, 0.866, 0.395, -0.015, 1.000, 0.026, NA, 0.351, 0.818, 0.183, 0.026, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R4 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, 0.552, -0.098, 0.629, 0.741, NA, 0.552, 1.000, -0.365, 0.387, 0.780, NA, -0.098, -0.365, 1.000, 0.318, -0.468, NA, 0.629, 0.387, 0.318, 1.000, 0.663, NA, 0.741, 0.780, -0.468, 0.663, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R5 <- matrix(c(1.000, 0.410, 0.236, -0.166, 0.409, 0.368, 0.410, 1.000, 0.501, -0.220, 0.637, 0.615, 0.236, 0.501, 1.000, -0.071, 0.514, 0.574, -0.166, -0.220, -0.071, 1.000, -0.004, -0.090, 0.409, 0.637, 0.514, -0.004, 1.000, 0.653, 0.368, 0.615, 0.574, -0.090, 0.653, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R6 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.00, -0.02, 0.12, 0.28, 0.13, NA, -0.02, 1.00, 0.30, 0.32, 0.38, NA, 0.12, 0.30, 1.00, 0.26, 0.18, NA, 0.28, 0.32, 0.26, 1.00, 0.54, NA, 0.13, 0.38, 0.18, 0.54, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R7 <- matrix(c(1.000, -0.081, -0.347, -0.258, -0.176, -0.023, -0.081, 1.000, 0.156, 0.423, 0.223, 0.575, -0.347, 0.156, 1.000, 0.267, 0.407, -0.092, -0.258, 0.423, 0.267, 1.000, 0.362, 0.390, -0.176, 0.223, 0.407, 0.362, 1.000, 0.317, -0.023, 0.575, -0.092, 0.390, 0.317, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R8 <- matrix(c(1.000, 0.582, -0.731, -0.539, 0.501, 0.723, 0.582, 1.000, -0.317, -0.455, 0.451, 0.448, -0.731, -0.317, 1.000, 0.344, -0.484, -0.634, -0.539, -0.455, 0.344, 1.000, -0.661, -0.536, 0.501, 0.451, -0.484, -0.661, 1.000, 0.678, 0.723, 0.448, -0.634, -0.536, 0.678, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R9 <- matrix(c(1.000, 0.290, -0.167, 0.333, 0.432, -0.062, 0.290, 1.000, 0.513, 0.467, 0.610, 0.055, -0.167, 0.513, 1.000, 0.195, 0.245, -0.125, 0.333, 0.467, 0.195, 1.000, 0.397, -0.186, 0.432, 0.610, 0.245, 0.397, 1.000, 0.200, -0.062, 0.055, -0.125, -0.186, 0.200, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R10 <- matrix(c(1.00, 0.34, 0.36, 0.14, 0.40, 0.53, 0.34, 1.00, 0.19, 0.17, 0.24, 0.29, 0.36, 0.19, 1.00, 0.00, 0.29, 0.53, 0.14, 0.17, 0.00, 1.00, 0.03, 0.07, 0.40, 0.24, 0.29, 0.03, 1.00, 0.46, 0.53, 0.29, 0.53, 0.07, 0.46, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R11 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, -0.334, -0.645, -0.078, 0.000, NA, -0.334, 1.000, 0.345, -0.680, 0.009, NA, -0.645, 0.345, 1.000, -0.002, 0.252, NA, -0.078, -0.68, -0.002, 1, 0.309, NA, 0.000, 0.009, 0.252, 0.309, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R12 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, 0.139, 0.271, 0.413, 0.567, NA, 0.139, 1.000, 0.585, -0.393, -0.159, NA, 0.271, 0.585, 1.000, -0.288, 0.200, NA, 0.413, -0.393, -0.288, 1.000, 0.696, NA, 0.567, -0.159, 0.200, 0.696, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R13 <- matrix(c(1.00, -0.06, -0.11, -0.24, 0.06, -0.04, -0.06, 1.00, 0.07, -0.11, 0.32, 0.01, -0.11, 0.07, 1.00, -0.29, 0.13, 0.25, -0.24, -0.11, -0.29, 1.00, -0.07, -0.22, 0.06, 0.32, 0.13, -0.07, 1.00, 0.41, -0.04, 0.01, 0.25, -0.22, 0.41, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R14 <- matrix(c(1.00, 0.30, -0.22, 0.33, 0.07, 0.28, 0.30, 1.00, -0.06, 0.12, 0.20, 0.41, -0.22, -0.06, 1.00, -0.33, -0.20, 0.09, 0.33, 0.12, -0.33, 1.00, 0.03, 0.08, 0.07, 0.20, -0.20, 0.03, 1.00, 0.41, 0.28, 0.41, 0.09, 0.08, 0.41, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R15 <- matrix(c(1.000, -0.104, -0.361, -0.500, -0.072, -0.040, -0.104, 1.000, -0.048, 0.340, 0.731, 0.593, -0.361, -0.048, 1.000, 0.355, -0.061, -0.049, -0.500, 0.340, 0.355, 1.000, 0.275, 0.188, -0.072, 0.731, -0.061, 0.275, 1.000, 0.706, -0.040, 0.593, -0.049, 0.188, 0.706, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R16 <- matrix(c(1.00, 0.18, 0.13, 0.12, 0.26, 0.24, 0.18, 1.00, 0.10, 0.10, 0.31, 0.25, 0.13, 0.10, 1.00, 0.28, 0.21, -0.18, 0.12, 0.10, 0.28, 1.00, 0.10, 0.10, 0.26, 0.31, 0.21, 0.10, 1.00, 0.32, 0.24, 0.25, -0.18, 0.10, 0.32, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R17 <- matrix(c(1.00, 0.37, -0.09, 0.23, 0.32, 0.33, 0.37, 1.00, -0.36, 0.21, 0.50, 0.64, -0.09, -0.36, 1.00, -0.01, -0.43, -0.54, 0.23, 0.21, -0.01, 1.00, 0.22, 0.19, 0.32, 0.50, -0.43, 0.22, 1.00, 0.58, 0.33, 0.64, -0.54, 0.19, 0.58, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R18 <- matrix(c(1.000, 0.188, -0.137, 0.288, 0.231, 0.063, 0.188, 1.000, -0.536, 0.190, 0.472, 0.642, -0.137, -0.536, 1.000, -0.076, -0.482, -0.689, 0.288, 0.190, -0.076, 1.000, 0.121, 0.125, 0.231, 0.472, -0.482, 0.121, 1.000, 0.533, 0.063, 0.642, -0.689, 0.125, 0.533, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R19 <- matrix(c(1.000, 0.213, 0.388, 0.583, -0.018, 0.162, 0.213, 1.000, 0.275, 0.261, 0.302, 0.565, 0.388, 0.275, 1.000, 0.475, -0.159, 0.042, 0.583, 0.261, 0.475, 1.000, -0.059, 0.131, -0.018, 0.302, -0.159, -0.059, 1.000, 0.468, 0.162, 0.565, 0.042, 0.131, 0.468, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R20 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, -0.288, 0.041, 0.232, 0.483, NA, -0.288, 1.000, 0.260, -0.188, -0.158, NA, 0.041, 0.260, 1.000, 0.085, 0.044, NA, 0.232, -0.188, 0.085, 1.000, 0.379, NA, 0.483, -0.158, 0.044, 0.379, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R21 <- matrix(c(1.00, 0.22, 0.21, 0.22, 0.17, 0.22, 0.22, 1.00, -0.76, 0.10, 0.55, 0.67, 0.21, -0.76, 1.00, 0.26, -0.15, -0.11, 0.22, 0.10, 0.26, 1.00, 0.07, 0.00, 0.17, 0.55, -0.15, 0.07, 1.00, 0.66, 0.22, 0.67, -0.11, 0.00, 0.66, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R22 <- matrix(c(1.00, -0.06, -0.24, -0.05, -0.23, 0.09, -0.06, 1.00, -0.10, 0.03, 0.31, 0.51, -0.24, -0.10, 1.00, 0.23, 0.15, 0.15, -0.05, 0.03, 0.23, 1.00, 0.30, 0.11, -0.23, 0.31, 0.15, 0.30, 1.00, 0.42, 0.09, 0.51, 0.15, 0.11, 0.42, 1.00), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R23 <- matrix(c(1.000, 0.212, 0.256, 0.349, -0.165, 0.276, 0.212, 1.000, 0.533, 0.217, 0.311, 0.376, 0.256, 0.533, 1.000, 0.383, 0.033, 0.207, 0.349, 0.217, 0.383, 1.000, 0.052, 0.619, -0.165, 0.311, 0.033, 0.052, 1.000, 0.361, 0.276, 0.376, 0.207, 0.619, 0.361, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R24 <- matrix(c(1.000, 0.186, -0.203, -0.104, 0.178, 0.336, 0.186, 1.000, -0.158, 0.363, 0.492, 0.588, -0.203, -0.158, 1.000, 0.105, -0.211, -0.292, -0.104, 0.363, 0.105, 1.000, 0.075, 0.273, 0.178, 0.492, -0.211, 0.075, 1.000, 0.634, 0.336, 0.588, -0.292, 0.273, 0.634, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R25 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, 0.191, -0.073, 0.277, 0.566, NA, 0.191, 1.000, -0.092, 0.261, 0.252, NA, -0.073, -0.092, 1.000, 0.006, 0.086, NA, 0.277, 0.261, 0.006, 1.000, 0.525, NA, 0.566, 0.252, 0.086, 0.525, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R26 <- matrix(c(1.000, 0.189, 0.301, 0.504, 0.114, 0.203, 0.189, 1.000, 0.040, -0.010, 0.077, 0.268, 0.301, 0.040, 1.000, 0.289, -0.067, -0.158, 0.504, -0.010, 0.289, 1.000, 0.193, 0.136, 0.114, 0.077, -0.067, 0.193, 1.000, 0.477, 0.203, 0.268, -0.158, 0.136, 0.477, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R27 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, 0.396, 0.011, -0.056, 0.052, NA, 0.396, 1.000, 0.214, 0.580, 0.764, NA, 0.011, 0.214, 1.000, -0.306, -0.038, NA, -0.056, 0.580, -0.306, 1.000, 0.614, NA, 0.052, 0.764, -0.038, 0.614, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R28 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, 0.271, 0.671, 0.239, -0.211, NA, 0.271, 1.000, 0.307, 0.585, 0.255, NA, 0.671, 0.307, 1.000, -0.191, -0.339, NA, 0.239, 0.585, -0.191, 1.000, 0.455, NA, -0.211, 0.255, -0.339, 0.455, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R29 <- matrix(c(1.000, 0.059, -0.299, -0.116, 0.098, 0.174, 0.059, 1.000, 0.064, 0.192, 0.282, 0.324, -0.299, 0.064, 1.000, 0.146, 0.218, 0.437, -0.116, 0.192, 0.146, 1.000, 0.209, 0.162, 0.098, 0.282, 0.218, 0.209, 1.000, 0.357, 0.174, 0.324, 0.437, 0.162, 0.357, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R30 <- matrix(c(1.000, 0.521, 0.173, 0.448, 0.526, 0.407, 0.521, 1.000, 0.659, 0.657, 0.820, 0.556, 0.173, 0.659, 1.000, 0.559, 0.542, 0.597, 0.448, 0.657, 0.559, 1.000, 0.455, 0.559, 0.526, 0.820, 0.542, 0.455, 1.000, 0.601, 0.407, 0.556, 0.597, 0.559, 0.601, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R31 <- matrix(c(1.000, 0.344, 0.365, 0.549, -0.032, 0.165, 0.344, 1.000, 0.052, 0.340, 0.207, 0.514, 0.365, 0.052, 1.000, 0.346, -0.202, -0.207, 0.549, 0.340, 0.346, 1.000, 0.095, 0.175, -0.032, 0.207, -0.202, 0.095, 1.000, 0.279, 0.165, 0.514, -0.207, 0.175, 0.279, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R32 <- matrix(c(1.000, 0.194, 0.291, 0.232, 0.359, 0.374, 0.194, 1.000, 0.493, 0.405, 0.518, 0.474, 0.291, 0.493, 1.000, 0.383, 0.511, 0.445, 0.232, 0.405, 0.383, 1.000, 0.496, 0.402, 0.359, 0.518, 0.511, 0.496, 1.000, 0.539, 0.374, 0.474, 0.445, 0.402, 0.539, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R33 <- matrix(c(1.000, 0.283, 0.308, 0.412, 0.096, 0.304, 0.283, 1.000, 0.040, 0.352, 0.347, 0.544, 0.308, 0.040, 1.000, 0.258, -0.241, -0.065, 0.412, 0.352, 0.258, 1.000, 0.168, 0.388, 0.096, 0.347, -0.241, 0.168, 1.000, 0.502, 0.304, 0.544, -0.065, 0.388, 0.502, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) R34 <- matrix(c(NA, NA, NA, NA, NA, NA, NA, 1.000, 0.179, -0.050, 0.455, 0.224, NA, 0.179, 1.000, 0.052, 0.255, 0.206, NA, -0.050, 0.052, 1.000, 0.000, -0.042, NA, 0.455, 0.255, 0.000, 1.000, 0.306, NA, 0.224, 0.206, -0.042, 0.306, 1.000), nrow=6, ncol=6, byrow = TRUE, dimnames = list(c("LC","DA","MT","PK","PE","PS"), c("LC","DA","MT","PK","PE","PS"))) cordat <- list(R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R30, R31, R32, R33, R34) nvar <- 6 # number of observed variables # Use this code; Don't do this manually as doing so is error prone. # put NA on diagonal if variable is missing (adapted from http://www.suzannejak.nl/Roorda_SES.R). The original code is also found in Page 41 of Suzzane Jak (2015): Meta-analytic structural equation modeling. Springer. for (i in 1:length(cordat)){ for (j in 1:nrow(cordat[[i]])){ if (sum(is.na(cordat[[i]][j,]))==nvar-1) {cordat[[i]][j,j] <- NA} }} # put NA on diagonal for variable with least present correlations (adapted from http://www.suzannejak.nl/Roorda_SES.R). The original code is also found in Page 42 of Suzzane Jak (2015): Meta-analytic structural equation modeling. Springer. for (i in 1:length(cordat)){ for (j in 1:nrow(cordat[[i]])){ for (k in 1:nvar){ if (is.na(cordat[[i]][j,k])==TRUE &is.na(cordat[[i]][j,j])!=TRUE &is.na(cordat[[i]][k,k])!=TRUE){ if(sum(is.na(cordat[[i]])[j,])>sum(is.na(cordat[[i]])[k,])) {cordat[[i]][k,k] = NA} if(sum(is.na(cordat[[i]])[j,])<=sum(is.na(cordat[[i]])[k,])) {cordat[[i]][j,j] = NA} }}}} # Group 4 is not positive definite. Group 21 is not positive definite. The correlation matrices for these groups--R4 and R21 respectively--were removed from the analysis. # Research question 2 # Load the data, including column 1 (i.e., LC [listening comprehension]) cordat2 <- list(R1, R2, R3, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R22, R23, R24, R25, R26, R27, R28, R29, R30, R31, R32, R33, R34) N2 <- c(386, 250, 6, 310, 88, 46, 22, 22, 36, 17, 15, 100, 113, 41, 96, 501, 127, 182, 117, 76, 17, 67, 141, 232, 10, 10, 100, 30, 263, 106, 217, 877) pattern.na(cordat2, show.na=FALSE) stage1fixed2 <- tssem1(Cov = cordat2, n = N2, method = "FEM") summary(stage1fixed2) coef(stage1fixed2) stage1random2 <- tssem1(Cov = cordat2, n = N2, method = "REM", RE.type = "Diag") summary(stage1random2) # Research question 2 # Model 3 (one-factor model): One-factor model of the five metacognitive strategies explaining listening comprehension; Stage 2 random effects analysis. model3 <- '## Metacognitive strategy factor (META) is measured by DA, MT, PK, PE, and PS META =~ METAonDA*DA + METAonMT*MT + METAonPK*PK + METAonPE*PE + METAonPS*PS ## Listening comprehension is measured by LCompre (single-factor model) LCompre =~ LCompreonLC*LC ## LC is regressed on META LCompre ~ LCompreonMETA*META ## Correlations between the predictors ##DA ~~ DAwithMT*MT ##DA ~~ DAwithPK*PK ##DA ~~ DAwithPE*PE ##DA ~~ DAwithPS*PS ##MT ~~ MTwithPK*PK ##MT ~~ MTwithPE*PE ##MT ~~ MTwithPS*PS ##PK ~~ PKwithPE*PE ##PK ~~ PKwithPS*PS ##PE ~~ PEwithPS*PS ## Error variance ##META ~~ ErrMETA*META LC ~~ ErrLCompre*LC + 23.37*LC' # The residual variance of the observed variable LC was fixed to 23.37 following (1– reliability)*(measurement variance). plot(model3, col="yellow", layout="spring") RAM3 <- lavaan2RAM(model3, obs.variables=c("LC", "DA", "MT", "PK", "PE", "PS")) RAM3 stage2random_model3 <- tssem2(stage1random2, RAM=RAM3, diag.constraints=FALSE, intervals.type="LB") summary(stage2random_model3) stage2random_model3 <- rerun(stage2random_model3) summary(stage2random_model3) coef(stage2random_model3) vcov(stage2random_model3) plot(stage2random_model3) model3a <- '## Metacognitive strategy factor (META) is measured by DA, MT, PK, PE, and PS META =~ METAonDA*DA + METAonMT*MT + METAonPK*PK + METAonPE*PE + METAonPS*PS ## Listening comprehension is measured by LCompre (single-factor model) LCompre =~ LCompreonLC*LC ## LC is regressed on META LCompre ~ LCompreonMETA*META ## Correlations between the predictors ##DA ~~ DAwithMT*MT ##DA ~~ DAwithPK*PK ##DA ~~ DAwithPE*PE ##DA ~~ DAwithPS*PS ##MT ~~ MTwithPK*PK ##MT ~~ MTwithPE*PE ##MT ~~ MTwithPS*PS ##PK ~~ PKwithPE*PE ##PK ~~ PKwithPS*PS ##PE ~~ PEwithPS*PS ## Error variance ##META ~~ ErrMETA*META LC ~~ ErrLCompre*LC' # The residual variance of the observed variable LC was fixed but now freely estimated following the output messagge "The variances of the dependent variables in 'Smatrix' should be free". plot(model3a, col="yellow", layout="spring") RAM3a <- lavaan2RAM(model3a, obs.variables=c("LC", "DA", "MT", "PK", "PE", "PS")) RAM3a stage2random_model3a <- tssem2(stage1random2, RAM=RAM3a, diag.constraints=FALSE, intervals.type="LB") summary(stage2random_model3a) stage2random_model3 <- rerun(stage2random_model3a) summary(stage2random_model3a) sessionInfo()