library(minvariance)
library(tidyverse)
#> ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
#> ✓ ggplot2 3.3.3     ✓ purrr   0.3.4
#> ✓ tibble  3.1.0     ✓ dplyr   1.0.5
#> ✓ tidyr   1.1.3     ✓ stringr 1.4.0
#> ✓ readr   1.4.0     ✓ forcats 0.5.1
#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag()    masks stats::lag()
library(lavaan)
#> This is lavaan 0.6-8
#> lavaan is FREE software! Please report any bugs.
library(semPlot)

Load data

data_url <- "https://quantdev.ssri.psu.edu/sites/qdev/files/ECLS_Science.csv"

df <- read_csv(file = url(data_url)) %>% 
  select("id", 
         "s_g3", "r_g3", "m_g3", 
         "s_g5", "r_g5", "m_g5", 
         "s_g8", "r_g8", "m_g8")
#> 
#> ── Column specification ────────────────────────────────────────────────────────
#> cols(
#>   id = col_double(),
#>   s_g3 = col_double(),
#>   r_g3 = col_double(),
#>   m_g3 = col_double(),
#>   s_g5 = col_double(),
#>   r_g5 = col_double(),
#>   m_g5 = col_double(),
#>   s_g8 = col_double(),
#>   r_g8 = col_double(),
#>   m_g8 = col_double(),
#>   st_g3 = col_double(),
#>   rt_g3 = col_double(),
#>   mt_g3 = col_double(),
#>   st_g5 = col_double(),
#>   rt_g5 = col_double(),
#>   mt_g5 = col_double(),
#>   st_g8 = col_double(),
#>   rt_g8 = col_double(),
#>   mt_g8 = col_double()
#> )

# Rename so functions work
timepoints <- list(t3 = c("s_g3", "r_g3", "m_g3"), 
                   t5 = c("s_g5", "r_g5", "m_g5"), 
                   t8 = c("s_g8", "r_g8", "m_g8"))

lavaan objects


minvariance(data = df, 
            var_list = timepoints, 
            return = "lavaan_objects")
#> $configural
#> lavaan 0.6-8 ended normally after 280 iterations
#> 
#>   Estimator                                         ML
#>   Optimization method                           NLMINB
#>   Number of model parameters                        43
#>   Number of equality constraints                     4
#>                                                       
#>                                                   Used       Total
#>   Number of observations                          1478        2108
#>   Number of missing patterns                        24            
#>                                                                   
#> Model Test User Model:
#>                                                       
#>   Test statistic                                35.522
#>   Degrees of freedom                                15
#>   P-value (Chi-square)                           0.002
#> 
#> $weak
#> lavaan 0.6-8 ended normally after 210 iterations
#> 
#>   Estimator                                         ML
#>   Optimization method                           NLMINB
#>   Number of model parameters                        43
#>   Number of equality constraints                     8
#>                                                       
#>                                                   Used       Total
#>   Number of observations                          1478        2108
#>   Number of missing patterns                        24            
#>                                                                   
#> Model Test User Model:
#>                                                       
#>   Test statistic                               116.826
#>   Degrees of freedom                                19
#>   P-value (Chi-square)                           0.000
#> 
#> $strong
#> lavaan 0.6-8 ended normally after 210 iterations
#> 
#>   Estimator                                         ML
#>   Optimization method                           NLMINB
#>   Number of model parameters                        43
#>   Number of equality constraints                    12
#>                                                       
#>                                                   Used       Total
#>   Number of observations                          1478        2108
#>   Number of missing patterns                        24            
#>                                                                   
#> Model Test User Model:
#>                                                       
#>   Test statistic                               540.750
#>   Degrees of freedom                                23
#>   P-value (Chi-square)                           0.000
#> 
#> $strict
#> lavaan 0.6-8 ended normally after 231 iterations
#> 
#>   Estimator                                         ML
#>   Optimization method                           NLMINB
#>   Number of model parameters                        43
#>   Number of equality constraints                    18
#>                                                       
#>                                                   Used       Total
#>   Number of observations                          1478        2108
#>   Number of missing patterns                        24            
#>                                                                   
#> Model Test User Model:
#>                                                       
#>   Test statistic                               600.614
#>   Degrees of freedom                                29
#>   P-value (Chi-square)                           0.000

Fit statistics


minvariance(data = df, 
            var_list = timepoints, 
            return = "fit_statistics") %>% 
  knitr::kable(digits = 3)
model chisq npar aic bic cfi rmsea srmr tli converged
configural 35.522 39 83914.19 84120.83 0.998 0.030 0.008 0.996 TRUE
weak 116.826 35 83987.49 84172.94 0.992 0.059 0.062 0.984 TRUE
strong 540.750 31 84403.42 84567.67 0.955 0.123 0.096 0.930 TRUE
strict 600.614 25 84451.28 84583.74 0.951 0.115 0.111 0.939 TRUE

Model tests


minvariance(data = df, 
                 var_list = timepoints, 
                 return = "model_tests") %>% 
  knitr::kable(digits = 3)
Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
configural 15 83914.19 84120.83 35.522 NA NA NA
weak 19 83987.49 84172.94 116.826 81.304 4 0
strong 23 84403.42 84567.67 540.750 423.924 4 0
strict 29 84451.28 84583.74 600.614 59.863 6 0

lavaan syntax


lminvar_syntax <- minvariance(data = df, 
                              var_list = timepoints, 
                              return = "lavaan_syntax") 
#> Warning in lav_data_full(data = data, group = group, cluster = cluster, : lavaan WARNING: some cases are empty and will be ignored:
#>   1 2 5 6 9 11 17 26 37 43 44 53 59 61 65 66 73 77 78 81 90 91 94 95 105 106 108 109 112 115 119 120 125 126 127 129 132 136 137 142 149 150 153 155 156 158 159 160 161 162 164 170 172 176 177 178 180 181 182 183 186 191 192 193 199 206 211 213 218 231 232 237 239 241 260 263 264 271 273 276 279 281 299 300 301 308 310 315 323 324 325 326 327 350 351 352 353 356 362 364 370 372 373 375 376 378 381 386 387 392 393 402 403 404 405 406 409 412 415 420 421 422 429 438 439 443 444 449 455 458 462 464 470 476 478 480 481 483 484 485 486 489 491 494 503 508 518 523 524 541 543 548 552 554 559 561 565 569 573 574 576 579 587 593 595 600 605 607 627 632 642 643 644 646 647 648 663 664 665 666 667 677 680 682 683 687 693 695 698 701 704 713 717 719 720 731 733 734 736 751 755 758 763 764 765 767 768 769 770 772 774 781 782 799 802 818 820 822 827 829 843 846 848 850 857 860 875 878 879 883 891 892 895 897 898 899 900 906 910 911 912 913 915 916 917 918 919 920 923 926 928 929 932 936 938 945 946 948 959 960 964 966 969 970 976 978 980 981 982 983 990 992 993 994 997 998 1002 1005 1009 1016 1022 1025 1035 1043 1044 1045 1047 1054 1056 1057 1061 1062 1080 1087 1088 1090 1095 1096 1098 1099 1104 1105 1106 1107 1109 1113 1115 1117 1118 1125 1126 1127 1128 1129 1131 1133 1139 1146 1149 1152 1153 1157 1163 1164 1165 1167 1172 1183 1185 1186 1195 1198 1200 1202 1211 1215 1218 1228 1229 1236 1238 1247 1248 1249 1250 1251 1252 1255 1259 1262 1263 1264 1266 1267 1270 1275 1276 1277 1279 1280 1281 1286 1289 1290 1302 1303 1306 1309 1310 1311 1314 1317 1320 1329 1330 1336 1338 1339 1343 1344 1353 1354 1356 1357 1358 1360 1367 1372 1379 1384 1386 1389 1399 1403 1405 1410 1411 1412 1414 1418 1421 1422 1423 1428 1429 1430 1434 1437 1439 1441 1445 1449 1451 1455 1459 1462 1464 1465 1466 1467 1469 1471 1480 1483 1487 1488 1493 1496 1497 1506 1507 1516 1528 1530 1531 1533 1534 1535 1536 1537 1538 1543 1544 1545 1549 1553 1555 1556 1557 1558 1559 1562 1565 1568 1570 1573 1579 1580 1581 1586 1587 1593 1594 1597 1601 1602 1605 1606 1610 1612 1615 1620 1622 1626 1629 1634 1636 1638 1648 1654 1657 1659 1662 1663 1669 1670 1671 1672 1681 1682 1685 1686 1687 1688 1690 1699 1702 1705 1706 1710 1712 1717 1719 1720 1727 1728 1729 1736 1742 1745 1748 1751 1762 1765 1766 1771 1777 1778 1780 1787 1788 1789 1790 1794 1796 1797 1804 1809 1822 1826 1828 1831 1836 1838 1839 1840 1841 1844 1845 1846 1854 1855 1860 1862 1863 1865 1866 1867 1869 1874 1875 1876 1878 1879 1885 1886 1891 1895 1897 1899 1902 1903 1906 1911 1914 1915 1916 1924 1925 1926 1930 1931 1933 1943 1944 1950 1954 1959 1960 1964 1965 1969 1978 1980 1985 1986 1990 1993 1994 1996 1997 2000 2004 2008 2009 2010 2012 2013 2014 2016 2017 2019 2021 2029 2030 2031 2032 2033 2034 2035 2043 2045 2050 2051 2052 2053 2056 2061 2066 2069 2073 2075 2076 2079 2080 2090 2101 2102 2105 2108

#> Warning in lav_data_full(data = data, group = group, cluster = cluster, : lavaan WARNING: some cases are empty and will be ignored:
#>   1 2 5 6 9 11 17 26 37 43 44 53 59 61 65 66 73 77 78 81 90 91 94 95 105 106 108 109 112 115 119 120 125 126 127 129 132 136 137 142 149 150 153 155 156 158 159 160 161 162 164 170 172 176 177 178 180 181 182 183 186 191 192 193 199 206 211 213 218 231 232 237 239 241 260 263 264 271 273 276 279 281 299 300 301 308 310 315 323 324 325 326 327 350 351 352 353 356 362 364 370 372 373 375 376 378 381 386 387 392 393 402 403 404 405 406 409 412 415 420 421 422 429 438 439 443 444 449 455 458 462 464 470 476 478 480 481 483 484 485 486 489 491 494 503 508 518 523 524 541 543 548 552 554 559 561 565 569 573 574 576 579 587 593 595 600 605 607 627 632 642 643 644 646 647 648 663 664 665 666 667 677 680 682 683 687 693 695 698 701 704 713 717 719 720 731 733 734 736 751 755 758 763 764 765 767 768 769 770 772 774 781 782 799 802 818 820 822 827 829 843 846 848 850 857 860 875 878 879 883 891 892 895 897 898 899 900 906 910 911 912 913 915 916 917 918 919 920 923 926 928 929 932 936 938 945 946 948 959 960 964 966 969 970 976 978 980 981 982 983 990 992 993 994 997 998 1002 1005 1009 1016 1022 1025 1035 1043 1044 1045 1047 1054 1056 1057 1061 1062 1080 1087 1088 1090 1095 1096 1098 1099 1104 1105 1106 1107 1109 1113 1115 1117 1118 1125 1126 1127 1128 1129 1131 1133 1139 1146 1149 1152 1153 1157 1163 1164 1165 1167 1172 1183 1185 1186 1195 1198 1200 1202 1211 1215 1218 1228 1229 1236 1238 1247 1248 1249 1250 1251 1252 1255 1259 1262 1263 1264 1266 1267 1270 1275 1276 1277 1279 1280 1281 1286 1289 1290 1302 1303 1306 1309 1310 1311 1314 1317 1320 1329 1330 1336 1338 1339 1343 1344 1353 1354 1356 1357 1358 1360 1367 1372 1379 1384 1386 1389 1399 1403 1405 1410 1411 1412 1414 1418 1421 1422 1423 1428 1429 1430 1434 1437 1439 1441 1445 1449 1451 1455 1459 1462 1464 1465 1466 1467 1469 1471 1480 1483 1487 1488 1493 1496 1497 1506 1507 1516 1528 1530 1531 1533 1534 1535 1536 1537 1538 1543 1544 1545 1549 1553 1555 1556 1557 1558 1559 1562 1565 1568 1570 1573 1579 1580 1581 1586 1587 1593 1594 1597 1601 1602 1605 1606 1610 1612 1615 1620 1622 1626 1629 1634 1636 1638 1648 1654 1657 1659 1662 1663 1669 1670 1671 1672 1681 1682 1685 1686 1687 1688 1690 1699 1702 1705 1706 1710 1712 1717 1719 1720 1727 1728 1729 1736 1742 1745 1748 1751 1762 1765 1766 1771 1777 1778 1780 1787 1788 1789 1790 1794 1796 1797 1804 1809 1822 1826 1828 1831 1836 1838 1839 1840 1841 1844 1845 1846 1854 1855 1860 1862 1863 1865 1866 1867 1869 1874 1875 1876 1878 1879 1885 1886 1891 1895 1897 1899 1902 1903 1906 1911 1914 1915 1916 1924 1925 1926 1930 1931 1933 1943 1944 1950 1954 1959 1960 1964 1965 1969 1978 1980 1985 1986 1990 1993 1994 1996 1997 2000 2004 2008 2009 2010 2012 2013 2014 2016 2017 2019 2021 2029 2030 2031 2032 2033 2034 2035 2043 2045 2050 2051 2052 2053 2056 2061 2066 2069 2073 2075 2076 2079 2080 2090 2101 2102 2105 2108

#> Warning in lav_data_full(data = data, group = group, cluster = cluster, : lavaan WARNING: some cases are empty and will be ignored:
#>   1 2 5 6 9 11 17 26 37 43 44 53 59 61 65 66 73 77 78 81 90 91 94 95 105 106 108 109 112 115 119 120 125 126 127 129 132 136 137 142 149 150 153 155 156 158 159 160 161 162 164 170 172 176 177 178 180 181 182 183 186 191 192 193 199 206 211 213 218 231 232 237 239 241 260 263 264 271 273 276 279 281 299 300 301 308 310 315 323 324 325 326 327 350 351 352 353 356 362 364 370 372 373 375 376 378 381 386 387 392 393 402 403 404 405 406 409 412 415 420 421 422 429 438 439 443 444 449 455 458 462 464 470 476 478 480 481 483 484 485 486 489 491 494 503 508 518 523 524 541 543 548 552 554 559 561 565 569 573 574 576 579 587 593 595 600 605 607 627 632 642 643 644 646 647 648 663 664 665 666 667 677 680 682 683 687 693 695 698 701 704 713 717 719 720 731 733 734 736 751 755 758 763 764 765 767 768 769 770 772 774 781 782 799 802 818 820 822 827 829 843 846 848 850 857 860 875 878 879 883 891 892 895 897 898 899 900 906 910 911 912 913 915 916 917 918 919 920 923 926 928 929 932 936 938 945 946 948 959 960 964 966 969 970 976 978 980 981 982 983 990 992 993 994 997 998 1002 1005 1009 1016 1022 1025 1035 1043 1044 1045 1047 1054 1056 1057 1061 1062 1080 1087 1088 1090 1095 1096 1098 1099 1104 1105 1106 1107 1109 1113 1115 1117 1118 1125 1126 1127 1128 1129 1131 1133 1139 1146 1149 1152 1153 1157 1163 1164 1165 1167 1172 1183 1185 1186 1195 1198 1200 1202 1211 1215 1218 1228 1229 1236 1238 1247 1248 1249 1250 1251 1252 1255 1259 1262 1263 1264 1266 1267 1270 1275 1276 1277 1279 1280 1281 1286 1289 1290 1302 1303 1306 1309 1310 1311 1314 1317 1320 1329 1330 1336 1338 1339 1343 1344 1353 1354 1356 1357 1358 1360 1367 1372 1379 1384 1386 1389 1399 1403 1405 1410 1411 1412 1414 1418 1421 1422 1423 1428 1429 1430 1434 1437 1439 1441 1445 1449 1451 1455 1459 1462 1464 1465 1466 1467 1469 1471 1480 1483 1487 1488 1493 1496 1497 1506 1507 1516 1528 1530 1531 1533 1534 1535 1536 1537 1538 1543 1544 1545 1549 1553 1555 1556 1557 1558 1559 1562 1565 1568 1570 1573 1579 1580 1581 1586 1587 1593 1594 1597 1601 1602 1605 1606 1610 1612 1615 1620 1622 1626 1629 1634 1636 1638 1648 1654 1657 1659 1662 1663 1669 1670 1671 1672 1681 1682 1685 1686 1687 1688 1690 1699 1702 1705 1706 1710 1712 1717 1719 1720 1727 1728 1729 1736 1742 1745 1748 1751 1762 1765 1766 1771 1777 1778 1780 1787 1788 1789 1790 1794 1796 1797 1804 1809 1822 1826 1828 1831 1836 1838 1839 1840 1841 1844 1845 1846 1854 1855 1860 1862 1863 1865 1866 1867 1869 1874 1875 1876 1878 1879 1885 1886 1891 1895 1897 1899 1902 1903 1906 1911 1914 1915 1916 1924 1925 1926 1930 1931 1933 1943 1944 1950 1954 1959 1960 1964 1965 1969 1978 1980 1985 1986 1990 1993 1994 1996 1997 2000 2004 2008 2009 2010 2012 2013 2014 2016 2017 2019 2021 2029 2030 2031 2032 2033 2034 2035 2043 2045 2050 2051 2052 2053 2056 2061 2066 2069 2073 2075 2076 2079 2080 2090 2101 2102 2105 2108

#> Warning in lav_data_full(data = data, group = group, cluster = cluster, : lavaan WARNING: some cases are empty and will be ignored:
#>   1 2 5 6 9 11 17 26 37 43 44 53 59 61 65 66 73 77 78 81 90 91 94 95 105 106 108 109 112 115 119 120 125 126 127 129 132 136 137 142 149 150 153 155 156 158 159 160 161 162 164 170 172 176 177 178 180 181 182 183 186 191 192 193 199 206 211 213 218 231 232 237 239 241 260 263 264 271 273 276 279 281 299 300 301 308 310 315 323 324 325 326 327 350 351 352 353 356 362 364 370 372 373 375 376 378 381 386 387 392 393 402 403 404 405 406 409 412 415 420 421 422 429 438 439 443 444 449 455 458 462 464 470 476 478 480 481 483 484 485 486 489 491 494 503 508 518 523 524 541 543 548 552 554 559 561 565 569 573 574 576 579 587 593 595 600 605 607 627 632 642 643 644 646 647 648 663 664 665 666 667 677 680 682 683 687 693 695 698 701 704 713 717 719 720 731 733 734 736 751 755 758 763 764 765 767 768 769 770 772 774 781 782 799 802 818 820 822 827 829 843 846 848 850 857 860 875 878 879 883 891 892 895 897 898 899 900 906 910 911 912 913 915 916 917 918 919 920 923 926 928 929 932 936 938 945 946 948 959 960 964 966 969 970 976 978 980 981 982 983 990 992 993 994 997 998 1002 1005 1009 1016 1022 1025 1035 1043 1044 1045 1047 1054 1056 1057 1061 1062 1080 1087 1088 1090 1095 1096 1098 1099 1104 1105 1106 1107 1109 1113 1115 1117 1118 1125 1126 1127 1128 1129 1131 1133 1139 1146 1149 1152 1153 1157 1163 1164 1165 1167 1172 1183 1185 1186 1195 1198 1200 1202 1211 1215 1218 1228 1229 1236 1238 1247 1248 1249 1250 1251 1252 1255 1259 1262 1263 1264 1266 1267 1270 1275 1276 1277 1279 1280 1281 1286 1289 1290 1302 1303 1306 1309 1310 1311 1314 1317 1320 1329 1330 1336 1338 1339 1343 1344 1353 1354 1356 1357 1358 1360 1367 1372 1379 1384 1386 1389 1399 1403 1405 1410 1411 1412 1414 1418 1421 1422 1423 1428 1429 1430 1434 1437 1439 1441 1445 1449 1451 1455 1459 1462 1464 1465 1466 1467 1469 1471 1480 1483 1487 1488 1493 1496 1497 1506 1507 1516 1528 1530 1531 1533 1534 1535 1536 1537 1538 1543 1544 1545 1549 1553 1555 1556 1557 1558 1559 1562 1565 1568 1570 1573 1579 1580 1581 1586 1587 1593 1594 1597 1601 1602 1605 1606 1610 1612 1615 1620 1622 1626 1629 1634 1636 1638 1648 1654 1657 1659 1662 1663 1669 1670 1671 1672 1681 1682 1685 1686 1687 1688 1690 1699 1702 1705 1706 1710 1712 1717 1719 1720 1727 1728 1729 1736 1742 1745 1748 1751 1762 1765 1766 1771 1777 1778 1780 1787 1788 1789 1790 1794 1796 1797 1804 1809 1822 1826 1828 1831 1836 1838 1839 1840 1841 1844 1845 1846 1854 1855 1860 1862 1863 1865 1866 1867 1869 1874 1875 1876 1878 1879 1885 1886 1891 1895 1897 1899 1902 1903 1906 1911 1914 1915 1916 1924 1925 1926 1930 1931 1933 1943 1944 1950 1954 1959 1960 1964 1965 1969 1978 1980 1985 1986 1990 1993 1994 1996 1997 2000 2004 2008 2009 2010 2012 2013 2014 2016 2017 2019 2021 2029 2030 2031 2032 2033 2034 2035 2043 2045 2050 2051 2052 2053 2056 2061 2066 2069 2073 2075 2076 2079 2080 2090 2101 2102 2105 2108

Configural


lminvar_syntax$configural %>% 
  cat()
#> #### CONFIGURAL INVARIANCE MODEL ####
#> # Specify Latent Factors ----
#> eta1 =~ NA * s_g3 + lambda1 * s_g3 + r_g3 + m_g3
#> eta2 =~ NA * s_g5 + lambda1 * s_g5 + r_g5 + m_g5
#> eta3 =~ NA * s_g8 + lambda1 * s_g8 + r_g8 + m_g8
#> # Specify Latent Variable Means ----
#> eta1 ~ 0 * 1 
#> eta2 ~ 1 
#> eta3 ~ 1 
#> # Specify Latent Variable Variances ----
#> eta1 ~~ 1 * eta1
#> eta2 ~~ eta2
#> eta3 ~~ eta3
#> # Specify Latent Variable Covariances ----
#> eta1 ~~ eta2
#> eta1 ~~ eta3
#> eta2 ~~ eta3
#> # Specify Observed Variable Intercepts ----
#> s_g3 ~ tau1 * 1 
#> r_g3 ~ 1 
#> m_g3 ~ 1 
#> s_g5 ~ tau1 * 1 
#> r_g5 ~ 1 
#> m_g5 ~ 1 
#> s_g8 ~ tau1 * 1 
#> r_g8 ~ 1 
#> m_g8 ~ 1 
#> # Specify Unique Variances ----
#> s_g3 ~~ s_g3 
#> r_g3 ~~ r_g3 
#> m_g3 ~~ m_g3 
#> s_g5 ~~ s_g5 
#> r_g5 ~~ r_g5 
#> m_g5 ~~ m_g5 
#> s_g8 ~~ s_g8 
#> r_g8 ~~ r_g8 
#> m_g8 ~~ m_g8 
#> # Specify Unique Covariances ----
#> s_g3 ~~ s_g5
#> s_g3 ~~ s_g8
#> s_g5 ~~ s_g8
#> r_g3 ~~ r_g5
#> r_g3 ~~ r_g8
#> r_g5 ~~ r_g8
#> m_g3 ~~ m_g5
#> m_g3 ~~ m_g8
#> m_g5 ~~ m_g8

Weak


lminvar_syntax$weak %>% 
  cat()
#> #### WEAK INVARIANCE MODEL ####
#> # Specify Latent Factors ----
#> eta1 =~ NA * s_g3 + lambda1 * s_g3 + lambda2 * r_g3 + lambda3 * m_g3
#> eta2 =~ NA * s_g5 + lambda1 * s_g5 + lambda2 * r_g5 + lambda3 * m_g5
#> eta3 =~ NA * s_g8 + lambda1 * s_g8 + lambda2 * r_g8 + lambda3 * m_g8
#> # Specify Latent Variable Means ----
#> eta1 ~ 0 * 1 
#> eta2 ~ 1 
#> eta3 ~ 1 
#> # Specify Latent Variable Variances ----
#> eta1 ~~ 1 * eta1
#> eta2 ~~ eta2
#> eta3 ~~ eta3
#> # Specify Latent Variable Covariances ----
#> eta1 ~~ eta2
#> eta1 ~~ eta3
#> eta2 ~~ eta3
#> # Specify Observed Variable Intercepts ----
#> s_g3 ~ tau1 * 1 
#> r_g3 ~ 1 
#> m_g3 ~ 1 
#> s_g5 ~ tau1 * 1 
#> r_g5 ~ 1 
#> m_g5 ~ 1 
#> s_g8 ~ tau1 * 1 
#> r_g8 ~ 1 
#> m_g8 ~ 1 
#> # Specify Unique Variances ----
#> s_g3 ~~ s_g3 
#> r_g3 ~~ r_g3 
#> m_g3 ~~ m_g3 
#> s_g5 ~~ s_g5 
#> r_g5 ~~ r_g5 
#> m_g5 ~~ m_g5 
#> s_g8 ~~ s_g8 
#> r_g8 ~~ r_g8 
#> m_g8 ~~ m_g8 
#> # Specify Unique Covariances ----
#> s_g3 ~~ s_g5
#> s_g3 ~~ s_g8
#> s_g5 ~~ s_g8
#> r_g3 ~~ r_g5
#> r_g3 ~~ r_g8
#> r_g5 ~~ r_g8
#> m_g3 ~~ m_g5
#> m_g3 ~~ m_g8
#> m_g5 ~~ m_g8

Strong


lminvar_syntax$strong %>% 
  cat()
#> #### STRONG INVARIANCE MODEL ####
#> # Specify Latent Factors ----
#> eta1 =~ NA * s_g3 + lambda1 * s_g3 + lambda2 * r_g3 + lambda3 * m_g3
#> eta2 =~ NA * s_g5 + lambda1 * s_g5 + lambda2 * r_g5 + lambda3 * m_g5
#> eta3 =~ NA * s_g8 + lambda1 * s_g8 + lambda2 * r_g8 + lambda3 * m_g8
#> # Specify Latent Variable Means ----
#> eta1 ~ 0 * 1 
#> eta2 ~ 1 
#> eta3 ~ 1 
#> # Specify Latent Variable Variances ----
#> eta1 ~~ 1 * eta1
#> eta2 ~~ eta2
#> eta3 ~~ eta3
#> # Specify Latent Variable Covariances ----
#> eta1 ~~ eta2
#> eta1 ~~ eta3
#> eta2 ~~ eta3
#> # Specify Observed Variable Intercepts ----
#> s_g3 ~ tau1 * 1 
#> r_g3 ~ tau2 * 1 
#> m_g3 ~ tau3 * 1 
#> s_g5 ~ tau1 * 1 
#> r_g5 ~ tau2 * 1 
#> m_g5 ~ tau3 * 1 
#> s_g8 ~ tau1 * 1 
#> r_g8 ~ tau2 * 1 
#> m_g8 ~ tau3 * 1 
#> # Specify Unique Variances ----
#> s_g3 ~~ s_g3 
#> r_g3 ~~ r_g3 
#> m_g3 ~~ m_g3 
#> s_g5 ~~ s_g5 
#> r_g5 ~~ r_g5 
#> m_g5 ~~ m_g5 
#> s_g8 ~~ s_g8 
#> r_g8 ~~ r_g8 
#> m_g8 ~~ m_g8 
#> # Specify Unique Covariances ----
#> s_g3 ~~ s_g5
#> s_g3 ~~ s_g8
#> s_g5 ~~ s_g8
#> r_g3 ~~ r_g5
#> r_g3 ~~ r_g8
#> r_g5 ~~ r_g8
#> m_g3 ~~ m_g5
#> m_g3 ~~ m_g8
#> m_g5 ~~ m_g8

Strict


lminvar_syntax$strict %>% 
  cat()
#> #### STRICT INVARIANCE MODEL ####
#> # Specify Latent Factors ----
#> eta1 =~ NA * s_g3 + lambda1 * s_g3 + lambda2 * r_g3 + lambda3 * m_g3
#> eta2 =~ NA * s_g5 + lambda1 * s_g5 + lambda2 * r_g5 + lambda3 * m_g5
#> eta3 =~ NA * s_g8 + lambda1 * s_g8 + lambda2 * r_g8 + lambda3 * m_g8
#> # Specify Latent Variable Means ----
#> eta1 ~ 0 * 1 
#> eta2 ~ 1 
#> eta3 ~ 1 
#> # Specify Latent Variable Variances ----
#> eta1 ~~ 1 * eta1
#> eta2 ~~ eta2
#> eta3 ~~ eta3
#> # Specify Latent Variable Covariances ----
#> eta1 ~~ eta2
#> eta1 ~~ eta3
#> eta2 ~~ eta3
#> # Specify Observed Variable Intercepts ----
#> s_g3 ~ tau1 * 1 
#> r_g3 ~ tau2 * 1 
#> m_g3 ~ tau3 * 1 
#> s_g5 ~ tau1 * 1 
#> r_g5 ~ tau2 * 1 
#> m_g5 ~ tau3 * 1 
#> s_g8 ~ tau1 * 1 
#> r_g8 ~ tau2 * 1 
#> m_g8 ~ tau3 * 1 
#> # Specify Unique Variances ----
#> s_g3 ~~ theta1 * s_g3 
#> r_g3 ~~ theta2 * r_g3 
#> m_g3 ~~ theta3 * m_g3 
#> s_g5 ~~ theta1 * s_g5 
#> r_g5 ~~ theta2 * r_g5 
#> m_g5 ~~ theta3 * m_g5 
#> s_g8 ~~ theta1 * s_g8 
#> r_g8 ~~ theta2 * r_g8 
#> m_g8 ~~ theta3 * m_g8 
#> # Specify Unique Covariances ----
#> s_g3 ~~ s_g5
#> s_g3 ~~ s_g8
#> s_g5 ~~ s_g8
#> r_g3 ~~ r_g5
#> r_g3 ~~ r_g8
#> r_g5 ~~ r_g8
#> m_g3 ~~ m_g5
#> m_g3 ~~ m_g8
#> m_g5 ~~ m_g8