我正在 lavaan 中(使用序数)进行路径分析,并希望使用估算数据。
但是,无论我是单独估算数据并使用 runMI 还是让原始数据作为 sem.mi 命令的一部分,我都会得到相同的错误:
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Error during wrapup: evaluation nested too deeply: infinite recursion / options(expressions=)?
如果我运行:options(expressions = 100000) 错误消息更改为:Error:protect(): protection stack overflow
我试图改变
--max-ppsize=500000
但是在命令行中我无法访问 rstudio.exe (说:系统找不到指定的路径, - 即使我仔细检查了路径:
C:\Program Files\RStudio\bin\rstudio.exe --max-ppsize=500000)
我可以做些什么来使用推算数据运行我的分析或将其推算为路径分析估计的一部分?
这是我的代码:
imp <- mice(dat2,m=5,print=F)
imputedData <- NULL
for(i in 1:5) {
imputedData[[i]] <- complete(x=imp, action=i, include=FALSE)
}
model5 <- 'ceadiff ~ mompa + cdpea + momabhx
mompa ~ b1*peadiff + c*momabhx + cdpea + b2*mommhpsi
peadiff ~ a1*momabhx + mommhpsi
cdpea ~ momabhx + mommhpsi
mommhpsi ~ a2*momabhx
peadiff ~~ cdpea
direct := c
indirect1 := a1 * b1
indirect1 := a2 * b2
total := c + (a1 * b1) + (a2 * b2)'
fit5 <- runMI(model5, data = imputedData, fun="sem", ordered = "mompa")
summary(fit5, standardized = TRUE, fit = TRUE, ci = T)
# or:
fit5 <- sem.mi(model5, data = dat2, m=5, ordered = "mompa")
summary(fit5, standardized = TRUE, fit = TRUE, ci = T)
PS 在这种情况下它会打印带有警告的摘要,但不会打印 p 值或 CI,因此我无法确定哪些系数是 sig。:
fit5 <- sem.mi(model5, data = dat2, m=5, ordered = "mompa")
summary(fit5)
** WARNING ** lavaan (0.5-23.1097) model has NOT been fitted
** WARNING ** Estimates below are simply the starting values
谢谢!
PS我不知道如何提供我的数据样本。
这是未经估算的数据输出:
> dput(dat2)
structure(list(id = structure(c(145, 253, 189, 305, 149, 567,
151, 853, 272, 67, 111, 695, 1695, 1301, 2322, 1335, 1490, 580,
209, 1109, 1317, 812, 1459, 2150, 685, 1583, 839, 2156, 1627,
1103, 649, 2294, 1712, 1711, 793, 1425, 1114, 146, 1529, 985,
1889, 1974, 444, 1664, 1569, 859, 1947, 1219, 1427, 1533, 2143,
769, 256, 147, 1393, 1847, 1967, 1651, 1084, 1343, 996, 1765,
1596, 2157, 978, 1448, 915, 1411, 1412, 675, 1876, 53, 400, 2103,
1028, 663, 1090, 360, 2134, 1937, 1061, 1823, 935, 891, 1968,
34, 487, 207, 295, 1118, 1164, 1053, 1511, 777, 1760, 38, 480,
459, 307, 1962, 199, 499, 1375, 782, 1855, 1624, 109, 1481, 483,
536, 972, 1151, 19, 403, 543, 502, 2251, 254, 429, 2118, 1272,
1995, 982, 1748, 1641, 1994, 1718, 510, 494, 273, 602, 549, 293,
1796, 1497, 1197, 1874, 1179, 159, 205, 242, 299, 100, 1200,
579, 870, 1482, 2131, 33, 1319, 148, 1297, 626, 1051, 1948, 1057,
1581, 1349, 1284, 1178, 1178, 1044, 1001, 547, 276, 507, 871,
698, 1006, 1946, 2101, 68, 265, 1186, 1895, 1864, 1884, 1553,
1761, 2171, 168, 30, 1132, 1983, 1897, 1383, 1353, 1697, 1752,
505, 1605, 1144, 1358, 1052, 1645, 1346, 14, 439, 2154, 932,
971, 2104, 1345, 1821, 52, 1642, 1661, 1835, 1232, 2132, 809,
606, 54, 528, 59, 1848, 232, 1750, 2340, 882, 716, 2105, 711,
2109, 2353, 41, 2144, 552, 304, 2404, 1527, 1980, 927, 1586,
1805, 1982, 1181, 2163, 861, 198, 1404, 986, 1404, 238, 2115,
1125), format.spss = "F4.0", display_width = 11L), peadiff = structure(c(4,
7, 2, 2, 3, 4, 5, 5, 2, 6, 2, 6, 4, 3, 4, 5, 2, 3, 2, 1, 1, 3,
3, 3, 3, 5, 6, 3, 2, 2, 2, 4, 2, 2, 3, 5, 2, 4, 6, 2, 2, 3, 2,
1, 7, 7, 2, 5, 6, 4, 4, 4, 2, 9, 3, 4, 6, 7, 3, 3, 4, 3, 7, 5,
7, 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, 8, 3, 6, 5, 6, 3, 5, 4, 3, 3, 4, 6, 4,
2, 6, 2, 3, 4, 2, 7, 4, 7, 4, 3, 0, 3, 0, 2, 2, 1, 3, 5,
1, 4, 2, 1, 2, 7, 4, 4, 4, 8, 6, 2, 6, 1, 1, 5, 3, 0, 5,
8, 4, 8, 3, 0, 3, 4, 5, 5, 2, 6, 0, 6, NA, 4, 4, 1, 3, 12,
2, 0, 4, 0, 5, 4, 3, 2, 1, 1, 5, 5, 6, 3, 1, 2, 1, 4, 2,
8, 6, 3, 0, 1, 3), format.spss = "F8.2", display_width = 10L),
cdpea = structure(c(22, 18, 17, 13, 19, 20, 19, 20, 17, 17,
17, 14, 17, 15, 21, 12, 16, 15, 14, 17, 19, 18, 17, 18, 19,
16, 18, 15, 16, 18, 17, 19, 18, 15, 16, 18, 18, 17, 22, 18,
18, 12, 19, 16, 15, 17, 14, 17, 15, 19, 17, 18, 14, 17, 19,
20, 16, 6, 12, 17, 17, 16, 13, 20, 18, 16, 16, 18, 21, 17,
21, 13, 17, 14, 18, 15, 18, 17, 23, 19, 17, 18, 15, 17, 19,
15, 21, 17, 20, 16, 15, 18, 15, 18, 17, 18, 16, 18, 21, 16,
19, 21, 18, 16, 19, 18, 18, 18, 18, 18, 19, 20, 20, 22, 14,
19, 18, 16, 22, 14, 16, 17, 18, 15, 16, 19, 16, 19, 18, 18,
15, 18, 19, 16, 16, 18, 15, 13, 12, 20, 19, 18, 19, 13, 19,
19, 16, 20, 18, 18, 18, 18, 18, 18, 19, 15, 14, 18, 16, 15,
15, 18, 18, 18, 18, 20, 17, 16, 19, 18, 19, 17, 18, 18, 16,
16, 18, 15, 19, 19, 17, 17, 16, 15, 15, 15, 17, 12, 17, 17,
19, 14, 21, 19, 19, 18, 23, 18, 21, 18, 16, 17, 18, 13, 14,
17, 18, 16, 18, 16, 18, 18, 17, 17, 6, 22, 17, 18, 20, 18,
10, 18, 15, 10, 16, 16, 18, 18, 17, 21, 18, 18, 15, 13, 15,
17, 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, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1,
0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1,
1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0,
0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1,
1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1,
1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 1, 0, 1), format.spss = "F8.2", display_width = 10L),
capiabr1 = structure(c(36, 43, NA, NA, 90, 95, 128, 137,
136, 245, 322, 154, 87, 111, 181, 278, 173, 137, 69, 24,
27, 70, 34, 27, 11, 53, 31, 49, 14, 54, 131, 35, 43, 43,
60, 58, 55, 60, 18, 38, 76, 98, 41, 20, 117, 58, 98, 10,
16, 101, 120, 165, 44, 96, 23, 19, 53, 57, 77, 41, 53, 100,
90, 96, 91, 29, 54, 134, 134, 105, 106, NA, 125, 61, 72,
34, 215, 42, NA, 106, 47, 45, 107, 208, 191, NA, 50, 56,
222, 47, 89, 134, 204, 211, 228, NA, 24, 34, 34, 135, 174,
112, 239, 104, 102, 129, 71, 100, 159, 280, 97, 105, NA,
56, 76, 120, 176, 89, 154, 46, 59, 214, 53, 245, 197, 60,
425, 25, 62, 137, 199, 171, 191, 46, 49, 117, 183, 79, 47,
76, NA, 158, 151, 47, 70, 118, 198, 94, 43, 296, 108, 56,
277, 214, 331, NA, 293, 277, 41, 134, 134, 283, 87, 96, 126,
305, 152, 82, 308, 168, 274, NA, 48, 171, 98, 90, 84, 257,
144, 255, NA, 106, 67, 184, 173, 156, 243, 357, 116, 132,
226, 260, 308, 358, 225, 312, 102, 244, 87, 176, 270, 224,
136, 243, NA, 117, 234, 280, 133, 143, 234, 273, NA, 169,
145, 310, 255, 280, 58, 152, 239, 254, 322, 342, 288, NA,
155, 179, 206, 270, 173, 319, 194, 206, 319, 111, 408, 310,
324, 296, 288, 391, 409, 379, 311, 338), format.spss = "F3.0", display_width = 11L),
cbclint = structure(c(51, 55, NA, NA, 65, 57, 46, 58, 53,
56, 75, 65, 33, NA, 65, NA, 51, 65, 34, 60, 45, 29, 43, 37,
65, 49, 56, 64, 53, 51, 39, 43, 64, 61, 74, 29, 60, 53, 45,
43, 45, 49, 47, 47, 66, 57, 73, 41, 56, 37, 65, 45, 53, 60,
53, 33, 43, 51, 53, 45, 47, 59, NA, 47, 79, 68, 56, 66, 70,
47, 63, 61, 61, 56, 33, 53, 56, 43, 51, 55, 51, 73, 56, 88,
56, 59, 30, 54, 82, 50, 63, 51, 58, 37, 67, 58, 51, 52, 40,
72, 63, NA, 43, 56, 60, 48, 66, NA, 55, 47, 61, 56, 55, 51,
55, 40, 64, 40, 66, 76, 45, 63, 53, 47, 51, 70, 80, 40, 53,
51, 43, 54, 64, 53, 64, 58, 56, 60, 55, 40, 40, 49, 48, 41,
47, 56, 60, 53, 55, 49, 55, 33, 67, 58, 41, 46, 67, 63, 64,
73, 73, 60, 49, 40, 51, 45, 53, 49, 65, 54, 58, 51, 68, 45,
41, 53, 60, 55, 61, 66, 69, 66, 67, 70, 66, NA, 56, 58, 61,
67, 73, 47, 74, 65, 62, 72, 59, 60, 73, 64, 48, 56, 53, 81,
65, 65, 65, 65, 59, 56, 70, 68, 63, 64, 74, 60, 75, 58, 63,
43, 72, 69, 59, 71, 71, 64, 66, 63, 46, 66, 66, 66, 53, NA,
73, 68, 65, 68, 62, 57, 68, 69, 74, 65, 78, 47), format.spss = "F8.0", display_width = 10L),
bpsidrr1 = structure(c(NA, 21, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, 18, NA, NA, NA, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 8, 9, 10, 10, 10, 11,
11, 11, 9, 11, 8, 11, 9, 10, 12, 11, 13, 10, 8, 11, 10, 13,
12, 14, 9, 10, 13, 11, 11, 10, 13, 13, 13, 12, 10, 11, 13,
10, 13, 16, 12, 15, 10, 12, 13, 13, 11, 14, 15, 13, 13, 14,
13, 14, 13, 18, 13, 14, 14, 14, 15, 16, 17, 16, 14, 15, 14,
14, 15, 14, 20, 16, 16, 13, 17, 16, 15, 14, 16, 18, 17, 17,
19, 14, 17, 16, 16, 17, 16, 14, 14, 15, 17, 18, 17, 14, 14,
18, 17, 19, 16, 16, 17, 18, 15, 19, 16, 21, 18, 17, 19, 15,
20, 18, 19, 16, 18, 23, 15, 18, 20, 19, 12, 12, 21, 16, 17,
17, 20, 20, 19, 19, 22, 20, 19, 22, 14, 19, 19, 23, 19, 20,
19, 19, 20, 20, 23, 18, 19, 25, 20, 23, 20, 21, 22, 21, 21,
24, 22, 24, 22, 22, 18, 23, 24, 22, 22, 24, 21, 23, 21, 20,
21, 23, 23, 25, 24, 22, 23, 26, 23, 26, 26, 23, 26, 26, 23,
25, 24, 22, 27, 25, 24, 27, 23, 25, 25, 26, 23, 27, 30, 28,
29, 27, 31, 34, 32, 31, 34), format.spss = "F2.0", display_width = 11L),
ecbiir1 = structure(c(177, 197, 148, 133, 172, 133, 129,
NA, 159, 67, 141, 167, 111, 190, 174, NA, 137, 93, 99, 136,
54, 36, 36, 75, 126, 97, 68, 205, 110, NA, 109, 47, 93, 200,
183, 42, 73, 132, 82, 91, 154, 157, 82, 124, 207, 84, 188,
76, 104, 73, 185, 108, 140, 183, 52, 48, 100, 110, 109, 56,
88, 69, 189, 82, 210, 159, 68, 144, 119, 81, 190, 180, 199,
206, 72, 153, 151, NA, 115, 111, NA, 161, 118, 159, 127,
124, 136, 174, 232, 48, 161, 54, 74, 53, NA, 112, 148, 135,
137, 159, 75, 74, 36, 101, 142, 83, 132, 99, 141, 117, 117,
134, 105, 134, 147, 54, 206, 170, 69, 134, 64, 55, 129, 79,
110, 173, 159, 113, 163, 139, 111, 103, 93, 86, 179, 144,
167, 118, 124, 118, 91, 166, 66, 127, 54, 177, 108, 125,
115, 142, 130, 156, 152, 51, 132, 76, 155, 185, 148, 132,
146, 147, 134, 50, 158, 143, 142, 98, 111, 150, 138, NA,
221, 150, 167, 145, 146, 63, 201, 195, 192, 183, 168, 162,
170, NA, 87, 119, 171, 136, 66, 183, 162, NA, 168, 153, 151,
109, 147, 214, 156, 147, 148, 117, NA, 140, 124, 165, 175,
106, 198, 141, 183, 208, 201, 139, 171, 170, 165, 116, 226,
102, 157, 182, 161, 169, 208, 144, 140, 139, 128, 174, 158,
231, 168, 181, 211, 176, 159, 180, 110, 188, 151, 206, 205,
67), format.spss = "F3.0", display_width = 11L), mommhpsi = c(NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, 35.75, 32.75, 32.75, 32.75, 32.75, 38.5, 38.5,
32.75, 32.75, 32.75, 32.75, 34.25, 36.5, 43, 43, 49, 33,
38, NA, 33.5, 36.5, 36.75, 43.75, NA, 33.75, 50, 35.75, 49.25,
34, 39, 45.25, 50.75, 50, NA, NA, 34.25, 34.25, 34.25, 38.25,
42.75, NA, 34.5, 42.75, 36.25, 43, NA, 34.75, 34.75, 39.5,
39.5, 39, 48, NA, NA, 35, 35, 38.5, 50.5, NA, 41.5, 38.25,
43.5, 44.5, 43, 51.75, 44.5, NA, NA, NA, NA, 35.5, 38.5,
35.5, 38.5, 42.75, 50.25, NA, NA, NA, NA, NA, NA, 35.75,
35.75, 45, 40.5, 46, NA, NA, NA, NA, 47, 45.75, NA, NA, NA,
NA, NA, NA, NA, 47, 39.25, 50.75, 42.25, 42.25, 44.75, 44,
43.75, NA, NA, NA, NA, NA, NA, 45.75, 40.5, 38.25, 42.25,
51.75, NA, NA, NA, NA, NA, 39.75, 43.25, 50.5, 53.5, 54,
NA, 52.75, NA, 37.25, 41.5, 46.5, NA, 55.25, NA, 59.75, 42.25,
44.25, 44.25, 48.25, 47, NA, NA, NA, 46.5, 49.75, 50, 49.25,
56.25, NA, NA, NA, 39.75, 47, 44, 41, 54.75, 55.25, NA, NA,
38.25, 51, 48.75, NA, 43.75, 50.25, NA, NA, 46.25, 57, 59.75,
58.5, 62.5, 62.25, NA, NA, 46.75, 46, 56.25, 55, 55.75, 58.25,
NA, 44.75, 49.5, 46.5, 57.25, 53, 60.5, 63, NA, NA, NA, 56.75,
NA, 60.5, 43.75, 39.75, 59.25, 58.75, 57.5, 56.5, 63, NA,
NA, NA, NA, 55.5, 50, NA, 61.25, 61.5, 61, 62.75, 66.5, 57,
64.75, NA, 59.25, 68.25, 65.25, NA, 68.75, 50)), .Names = c("id",
"peadiff", "ceadiff", "cdpea", "mompa", "momabhx", "capiabr1",
"cbclint", "bpsidrr1", "ecbiir1", "mommhpsi"), row.names = c(NA,
-246L), class = "data.frame")