在将missMech:TestMCARNormality
应用于下面的数据框时,其中有三列包含相同6行的NA
:
summary(TestMCARNormality(data = mvn.BN))
我收到一个错误信息:
Warning: More than one missing data pattern should be present.
Error in TestMCARNormality(data = mvn.BN) :
我的意图是使用这个数据来测试SEM的多元正态性假设。 我怀疑的是,因为这三列在相同的受试者中具有缺失值,所以不能将缺失机制视为随意的。 因为这三个向量反映了相同的现象,我尝试将它们合并成一个潜变量,如下所示:
sndPre <- 'sndPre =~ r + rlct + int'
summary(fit <- cfa(sndPre, data = mvn.BN, missing="fiml"))
df$sndPre <- lavPredict(fit)
然而,使用由潜变量组成的新数据进行多元正态性测试,而不是三个原始向量,结果与以前相同出现错误信息。
非常感谢您的帮助!
structure(list(supp = c(-1.17976111761186, -1.62219358531543,
1.17976111761186, 0.791638607743375, -0.0477634550971204, -1.22906451292704,
1.83391463581591, -0.167894004788105, 2.18934975552209, -0.824731912765719,
0.36610635680057, -1.00626998586084, -0.858754109904802, 0.0716792838286317,
-0.893800631179489, 1.39869400780818, 1.98075239664728, 0.417667173482733,
-0.697141434846342, -0.143729233705824, 0.167894004788105, 0,
1.22906451292704, 0.0477634550971205, -0.241040393886027, -0.497200570681554,
0.510753305626192, -0.637484160962377, -0.265692304601501, 1.08891702864054,
-1.83391463581591, -0.119648113039842, 0.637484160962377, 0.727913290881644,
-2.59265557628224, 0.391756559248618, 0.667016013542502, 0.697141434846342,
-1.46523379268552, -0.290506771123394, 0.119648113039842, -0.791638607743375,
-0.75939041152608, -0.0956361870412451, 1.46523379268552, 0.608498134499883,
-0.315501447257961, -0.0238749182045244, -2.18934975552208, -0.929980941397277,
0.510753305626192, -1.2815515655446, 0.929980941397277, -0.608498134499883,
0.551994121316888, 1.71845154339103, 0.290506771123394, -0.524400512708041,
-1.53897858737058, -0.192157229254373, -0.216534124449171, -0.580014615243761,
0.580014615243761, -1.13317003025956, 1.00626998586084, 0.0238749182045242,
-0.667016013542502, -1.71845154339103, -1.04669971498747, 0.443861311926248,
-0.551994121316888, -0.0716792838286317, 0.241040393886027, -0.391756559248618,
-0.443861311926248, -1.08891702864054, 0.315501447257961, 0.340694827087795,
-1.33782840232128, 1.33782840232128, 0.876142849246841, -1.98075239664728,
-0.340694827087795, 0.876142849246841, 0.216534124449171, -0.727913290881644,
0.0956361870412451, 1.53897858737058, 0.143729233705824, 0.75939041152608,
0.824731912765718, 0.265692304601501, 0.967421566101701, -0.470363638377999,
1.04669971498747, 1.2815515655446, 1.62219358531543, -1.39869400780818,
1.13317003025956, -0.417667173482733, 0.192157229254372, -0.36610635680057,
0.470363638377999, -0.967421566101701), rlct = c(0.280221077461472,
NA, -0.278381421551413, -1.57199071756635, -0.0270835525593782,
-0.278381421551413, -0.000969320386383176, -0.0386715802266045,
0.112842890058884, -1.57199071756635, 0.070371710196276, 0.483784267012041,
-0.742527151717587, -0.987610926853036, 1.47287509993123, -1.57199071756635,
-1.57199071756635, 1.05640868275726, 0.397314787799829, 1.57113538512573,
1.20942896447373, -0.145731148967403, 0.940631782306559, -1.57199071756635,
-0.278381421551413, 1.29238902437959, 0.483784267012041, -1.57199071756635,
-0.176380408081405, 2.02680058645422, 0.768023557290127, -0.596572861001164,
0.0634980873774587, -0.448435467665454, NA, -1.12096299160087,
-0.0202950841488239, -1.57199071756635, 0.940631782306559, 0.578005121810303,
0.886333728696478, -1.57199071756635, -1.23600381870389, NA,
0.483784267012041, 0.280221077461472, -1.57199071756635, -0.413265040032032,
-0.080245567392962, 0.483784267012041, NA, 0.483784267012041,
1.05640868275726, -0.38857492099479, -1.57199071756635, 1.08976703767843,
0.628343560444494, 0.443576137399824, -1.57199071756635, -0.831252344445635,
0.397314787799829, -0.68970672582913, -1.07206642789405, 0.535108926649084,
-1.57199071756635, -1.57199071756635, NA, 2.02680058645422, 0.645636548945714,
0.602890708565257, 1.05640868275726, 2.02680058645422, 0.343526991967889,
-0.145731148967403, 1.35769826997358, 0.550235890534656, -0.335915594040882,
-1.57199071756635, -0.38857492099479, 1.32107778862743, -1.04341784685432,
1.63987589158524, NA, 1.25033832194654, 0.42128422668948, -0.596572861001164,
-0.145731148967403, 0.280221077461472, -1.57199071756635, 0.834247192625187,
1.37009671045311, -0.859826671324634, 0.871914409639362, 0.112842890058884,
1.05640868275726, -1.57199071756635, -0.335915594040882, 1.32107778862743,
-0.278381421551413, -0.247571357064391, -0.481542338316402, -0.481542338316402,
0.254332998843991, 0.483784267012041), R = c(-1.44878316694673,
NA, -0.746570767383894, 1.26865645051899, -1.75176415239607,
0.271791827501559, 0.548071163669653, 0.0169765715809728, 1.63837513046467,
1.63837513046467, -0.635824706253966, -0.813925628689442, -0.939395691552569,
0.332386014965153, 0.118098142059536, 1.63837513046467, 1.63837513046467,
-0.471848700225964, 0.078276278612946, -1.09927490801355, -0.647637011302996,
-1.31494047461463, 0.0691453765779642, 0.666206157027453, -0.171784871082169,
-1.07711916265625, 0.118098142059536, -0.471848700225964, -1.12002951365366,
1.63837513046467, -0.754523167140249, -0.854074237671873, 0.169679176663998,
-0.156269780499957, NA, 0.186111327124178, 0.0434821717802274,
-0.230999511810527, -1.23964007778478, 0.305517687906991, -1.75176415239607,
1.22068945613712, 0.217906742740558, NA, 1.63837513046467, 1.63837513046467,
0.666206157027453, 0.873615040819669, 0.483819490193061, 0.118098142059536,
NA, -1.51990113386884, -0.781402829742699, -0.204631736602177,
-0.471848700225964, -0.583365501745861, 1.07438562229116, -0.471848700225964,
-1.75176415239607, -0.422187099553652, 1.00819175667281, 0.569705636106715,
0.271791827501559, 0.533157330977815, 1.63837513046467, -1.75176415239607,
NA, 1.63837513046467, -0.471848700225964, 0.358200131312215,
1.63837513046467, 1.63837513046467, 0.248351788877765, -0.781402829742699,
-0.826338490944626, -1.12725479815266, 0.118098142059536, -0.471848700225964,
0.620228020132514, -0.129738478713846, 1.00819175667281, -0.471848700225964,
NA, 0.305517687906991, -0.471848700225964, 0.452056881241183,
-0.129738478713846, -0.696094415081498, 1.63837513046467, 0.305517687906991,
-0.299167995749343, -1.2726642552484, -0.270700749601809, -1.43246808902724,
1.63837513046467, 1.63837513046467, -0.189158730641189, -1.75176415239607,
1.04312103048841, -0.320577789914539, -1.28026760416336, -1.09927490801355,
-1.11423481807787, 1.63837513046467), int = c(-0.782440086185924,
NA, 0.212924230491983, -0.136528542120466, 0.168286644091694,
0.569310284275056, 0.334351222252171, -0.239257767986, 0.939176254270868,
-1.23834899552138, 0.344133093176299, 0.514561454790373, -0.157941237779957,
1.07008109973545, -1.23834899552138, -1.23834899552138, -1.23834899552138,
0.514561454790373, 0.789682999928247, 1.09903381262152, -1.23834899552138,
0.694835866181609, 1.7700680825066, -1.23834899552138, 0.569310284275056,
-1.23834899552138, -1.23834899552138, 1.89862806024719, -0.0378230494652771,
-1.23834899552138, -0.385153852730917, 0.26169585941428, 1.07415499973807,
1.57970267890648, NA, 0.127231345700962, 0.870061292013265, -1.23834899552138,
-1.23834899552138, -0.136528542120466, 0.168286644091694, -1.23834899552138,
0.323374601090832, NA, 1.2973988974951, 2.53852130586226, 1.01510177359039,
0.19761523561581, 0.0213873960314485, 1.2973988974951, NA, 1.06441166488122,
0.0893044347685252, 0.464202232325543, 0.939176254270868, -0.373841392194834,
-0.113931433468044, 0.000778491766350194, -1.23834899552138,
-1.23834899552138, 0.26169585941428, 0.806796928486145, 0.212924230491983,
-0.46348137353114, -1.23834899552138, -1.23834899552138, NA,
-1.23834899552138, -1.23834899552138, 0.0213873960314485, 0.939176254270868,
-1.23834899552138, -1.23834899552138, -1.23834899552138, -1.23834899552138,
0.26169585941428, 1.89862806024719, -1.23834899552138, 0.127231345700962,
-1.23834899552138, -0.216014117336508, 0.939176254270868, NA,
0.374522129377425, 0.831454043920379, -1.23834899552138, -1.23834899552138,
1.09903381262152, 0.514561454790373, -0.136528542120466, -0.511175060632852,
-0.406654025323036, 0.228691531744415, 2.05858827694955, 1.89862806024719,
-1.23834899552138, -0.0378230494652771, -1.23834899552138, -0.250360697331749,
0.0213873960314485, 1.655550552844, 1.09903381262152, 0.228691531744415,
-1.23834899552138), gta = c(-0.143729233705824, 1.83391463581591,
-0.929980941397277, -1.46523379268552, 0.378900295495245, 0.948535040826638,
-1.46523379268552, 1.00626998586084, -1.46523379268552, -0.340694827087795,
-1.46523379268552, -0.340694827087795, -0.430727299295457, 0,
-0.697141434846342, -0.929980941397277, -0.143729233705824, -0.340694827087795,
-0.143729233705824, -0.697141434846342, 0.712443032389489, 1.04669971498747,
0.580014615243761, 0.315501447257961, 0.791638607743375, 1.46523379268552,
0.378900295495245, 0.580014615243761, -0.697141434846342, 1.17976111761186,
-0.538146096504187, 1.71845154339103, 0.948535040826638, -1.46523379268552,
1.39869400780818, 0.75939041152608, 0.180012369792705, -0.697141434846342,
-0.929980941397277, -0.143729233705824, 0, 1.2815515655446, -0.430727299295457,
1.98075239664728, -1.46523379268552, -0.697141434846342, 0, -0.697141434846342,
-1.46523379268552, -0.143729233705824, 0, 0.893800631179489,
0.580014615243761, 0.180012369792705, 0.858754109904802, 1.53897858737058,
0.470363638377999, -0.265692304601501, -1.46523379268552, 1.11077161663679,
-0.929980941397277, -0.430727299295457, 0.180012369792705, -1.46523379268552,
-1.46523379268552, 1.62219358531543, 0.824731912765718, 0.265692304601501,
2.18934975552209, 1.33782840232128, -0.538146096504187, -0.538146096504187,
-0.929980941397277, -1.46523379268552, -0.538146096504187, 0.580014615243761,
1.11077161663679, -0.430727299295457, 0.378900295495245, 0.265692304601501,
-1.46523379268552, -0.929980941397277, 0, -0.216534124449171,
0.180012369792705, 0, 0.470363638377999, -1.46523379268552, -0.697141434846342,
0.265692304601501, 0.378900295495245, -1.46523379268552, -0.265692304601501,
0.107634392383102, 0, -1.46523379268552, 0.470363638377999, 0.580014615243761,
0.712443032389489, 1.22906451292704, -0.265692304601501, 0.107634392383102,
0.667016013542502, -0.929980941397277), open = c(-1.92607985655617,
-0.316590285013791, -0.298402916907573, 0.514186833724082, -1.99813120048837,
1.94456677442047, 1.56354868020822, -1.08381975857325, 1.26217761908371,
0.640239717247926, -1.28204786305004, 1.83698930281509, 0.548241607933871,
1.69544910528848, -0.536011088711, 1.39498216003174, 0.221717933797518,
-0.695736069353309, 0.650300940259636, 1.14472608609363, 0.898853974686237,
-0.939565435048314, 1.92697093968417, 0.462290334362355, 1.51181974804599,
0.667723332853383, 0.845039882354954, -0.332191823394925, -0.858807626023951,
-0.125821462489645, -0.0634389303805822, -1.01790794895173, -0.723613330734455,
0.353967113044211, -0.419136624662771, 1.76967413361801, -0.332191823394925,
-0.570986894367983, -1.99813120048837, -0.274301006996328, -0.824199167288764,
-1.41980448798487, -0.905146599149194, -1.99813120048837, 0.189550652043953,
-0.4225531548638, -0.162030614403885, -0.248860637595393, -1.54408925271419,
0.415670050003845, -0.866109560271283, -1.42724348193835, 1.04110387420274,
0.6230351809389, -0.382192438913699, -1.15692512350599, -0.377326255741555,
1.53671972246414, -0.536011088711, 1.16672628385726, 1.42787540110868,
-1.73627009182479, 0.059953368893635, -0.31084522155919, 0.409150403085802,
-0.929716900165085, -0.171835768002707, -0.234047527328706, 0.289577319482922,
0.845039882354954, -0.675071329758215, -0.423570535825805, -0.515836566660935,
-0.284505490560708, -1.2021149504824, 0.983371293743114, -0.601461993496952,
0.51894868837645, 0.510699498840829, 0.935837993837305, 1.40235662672974,
0.845039882354954, -1.99813120048837, 0.746816399891108, 0.488128171705992,
-1.21266600238008, -0.596634202847598, -0.174599542608208, 1.89421201170045,
1.24955267381115, -0.517878789742744, -0.351296162327365, 0.68870382291801,
0.306336571728767, 0.438762693966707, 0.0676668116033076, 0.0232585007488503,
-0.0634389303805822, 1.62396386651223, -0.736326202021504, -1.21266600238008,
0.218324021776088, -0.695736069353309, -0.0916621988824299),
dtls = c(-1.57921951928357, 0.712443032389489, 0.858754109904802,
1.71845154339103, -1.57921951928357, 0.791638607743375, -1.57921951928357,
0.315501447257961, 0.551994121316888, 1.00626998586084, -1.57921951928357,
0.143729233705824, -0.192157229254373, 0.443861311926248,
0.929980941397277, 1.04669971498747, 1.53897858737058, 1.62219358531543,
-1.00626998586084, 0.167894004788105, -0.36610635680057,
-0.167894004788105, 1.98075239664728, 1.17976111761186, 0.0238749182045242,
1.98075239664728, -0.0716792838286317, -0.791638607743375,
-1.57921951928357, -0.241040393886027, 0.443861311926248,
0.824731912765718, -0.551994121316888, 0.0716792838286317,
0.75939041152608, -0.791638607743375, -0.68200135314244,
0.443861311926248, -1.57921951928357, -0.497200570681554,
-0.0716792838286317, -0.0716792838286317, -1.57921951928357,
-1.57921951928357, 0.608498134499883, -0.929980941397277,
1.17976111761186, 1.2815515655446, -0.791638607743375, -0.143729233705824,
-0.893800631179489, -1.57921951928357, -1.04669971498747,
-0.340694827087795, -1.15615185770811, 1.98075239664728,
0.278078133485501, 0.241040393886027, 0.443861311926248,
-0.637484160962377, 0.667016013542502, -1.15615185770811,
-0.580014615243761, 0, -0.216534124449171, 0.443861311926248,
1.39869400780818, 0.192157229254372, -0.858754109904802,
-0.68200135314244, 0.637484160962377, 0.443861311926248,
-0.727913290881644, -0.0716792838286317, -0.0716792838286317,
1.08891702864054, -0.470363638377999, -0.608498134499883,
0.0956361870412451, 0.278078133485501, 0.0477634550971205,
0.216534124449171, -1.57921951928357, -0.524400512708041,
0.443861311926248, -0.967421566101701, -0.278078133485501,
-0.443861311926248, 0.580014615243761, 0.340694827087795,
-0.315501447257961, 1.17976111761186, 0.967421566101701,
-0.404677904530048, 1.33782840232128, 1.46523379268552, 0.712443032389489,
-1.57921951928357, 0.119648113039842, -0.278078133485501,
-1.57921951928357, -0.404677904530048, -1.08891702864054,
0.893800631179489)), class = "data.frame", row.names = c(NA,
-104L))