我的SEM
模型似乎还不错,但是当试图让组适合进行多组分析时,R会大喊再次警告。
这是我的模型(数据将在后面显示):
model <- '
sndPre =~ R + int + rldct
dtls ~ d*open + e*supp
open ~ c*gta
gta ~ b*sndPre
sndPre ~ a*supp + age
open ~~ gta
R ~~ dtls
R ~~ int
int ~~ dtls
indirect := a*b*c*d
direct := e
total := e + (a*b*c*d)
'
运行它可以很好地适应一切:
summary(fit <- sem(model, data = df), fit.measures = T)
但是适合“免费”或“受限”模型以应用多组分析:
summary(fit.mg.gdr <- sem(model, data = df,
group = "gender"),
fit.measures = T)
summary(fit.mg.gdr.cnst <- sem(model,
data = df,
group = "gender",
group.equal = c("intercepts",
"regressions")),
fit.measures = T)
产生警告:
lavaan警告:优化器警告未找到解决方案!
按组拟合type
而不是fmly
时,也会发生同样的情况。
如果有人可以帮助我,我将不胜感激。
乌里
这是我的数据
df <- structure(list(supp = c(-1.26105699321048, 1.23539204000555,
0.998851022079735, -0.190921681071981, -1.28050150562454, 1.88566871428553,
-0.346185741866873, 2.22353594331693, -0.899501224645076, 0.456412565066874,
-1.04706110379691, -0.921732740299538, -0.0748627524431053, -0.936373552588429,
1.34849384296525, 2.00592623479799, 0.541045414056009, -0.793261814499457,
-0.340594037718542, 0.0501766033631645, -0.133884381988423, 1.25734187466122,
-0.118313651917272, -0.376004851315653, -0.578002604556701, 0.61490135465745,
-0.731484429737429, -0.443541245848682, 1.127203874985, -1.94705304738397,
-0.262864086600616, 0.836658140574031, 0.932007060340215, 0.462261173870058,
0.842275379483654, 0.909358352545815, -1.57531188615793, -0.44738703049337,
0.0313710067871067, -0.83968986365572, -0.82420486119427, 1.37752074578506,
0.808173067751332, -0.459141855711599, -0.143956128586532, -2.0662260120717,
-0.94160943714496, -1.33187171317916, 1.090350360849, -0.682954192050242,
0.710637734125368, 1.65867082804067, 0.325637630371078, -0.611847463704592,
-1.60568458666961, -0.355403157908715, -0.373464430910395, -0.676545468797976,
0.740129996103287, -1.20452185918761, 1.09947403532858, -0.129112612454232,
-1.91125544865754, -1.0797149516082, 0.575532093748616, -0.621895872474711,
-0.215693078909198, 0.141524098826785, -0.492789877905876, -0.508654550919966,
-1.155140140116, 0.383157434711058, 0.420161412281436, -1.40552653940339,
1.31607100170934, 1.05443856378575, -2.04814817005446, 1.05443856378575,
0.117203553157344, -0.799247977488777, -0.071283009062627, 1.42448397835845,
0.043033574527453, 0.989878845252324, 1.00469999108005, 0.321136912972101,
1.09523404904648, -0.544087482645234, 1.10318971667871, 1.27607992892502,
1.45254026399367, -1.44247186686377, 1.18575360443271, -0.498083362700643,
0.111118998026078, -0.474752580097199, 0.608318711719373, -1.02659137731459
), rldct = c(0.245353729370027, -0.308948664922806, -1.52257018899952,
-0.0622393093563785, -0.308948664922806, -0.0363613989903612,
-0.0737075536591954, 0.0769747339892045, -1.52257018899952, 0.0345745707698335,
0.45304032418845, -0.754467922085042, -0.984915246362911, 1.51806368492016,
-1.52257018899952, -1.52257018899952, 1.05685750405161, 0.364414652288875,
1.63017529926735, 1.22387411707763, -0.179234164546305, 0.932198355591301,
-1.52257018899952, -0.308948664922806, 1.31556690619222, 0.45304032418845,
-1.52257018899952, -0.209305380528335, 2.1704980278988, 0.748880570563087,
-0.615704912542176, 0.0277244738595314, -0.473637451978715, -1.10902161083733,
-0.0555167627056605, -1.52257018899952, 0.932198355591301, 0.550319749201526,
0.874213648556419, -1.52257018899952, -1.21539315694016, 0.45304032418845,
0.245353729370027, -1.52257018899952, -0.439719946239881, -0.11477704827939,
0.45304032418845, 0.45304032418845, 1.05685750405161, -0.415865290238098,
-1.52257018899952, 1.093042242413, 0.602605507008429, 0.411753554392421,
-1.52257018899952, -0.838256632288651, 0.364414652288875, -0.704385361705819,
-1.06361686987651, 0.505937570708358, -1.52257018899952, -1.52257018899952,
2.1704980278988, 0.620619013038226, 0.576140282545116, 1.05685750405161,
2.1704980278988, 0.309589702123866, -0.179234164546305, 1.38835015610913,
0.521570543504756, -0.364864803986247, -1.52257018899952, -0.415865290238098,
1.34747237595098, -1.03695973787835, 1.70944951184896, 1.26898550689769,
0.388920757552106, -0.615704912542176, -0.179234164546305, 0.245353729370027,
-1.52257018899952, 0.818867582143915, 1.402229007164, -0.865152553192795,
0.858865137379816, 0.0769747339892045, 1.05685750405161, -1.52257018899952,
-0.364864803986247, 1.34747237595098, -0.308948664922806, -0.278920309198924,
-0.505498127259985, -0.505498127259985, 0.219174133457963, 0.45304032418845
), R = c(-1.62786138011885, -0.666153591682604, 1.18212856421831,
-2.13876864272561, 0.385714301919543, 0.624775186829122, 0.150095893752662,
1.43758219552169, 1.43758219552169, -0.535576887649234, -0.747965538962771,
-0.905544215743782, 0.439530798801513, 0.245465249439257, 1.43758219552169,
1.43758219552169, -0.35059322360196, 0.208211594874181, -1.11695411751209,
-0.549279381282365, -1.42349847507615, 0.199614597666856, 0.72231202787223,
-0.0350328555213155, -1.08690074912346, 0.245465249439257, -0.35059322360196,
-1.14533785432358, 1.43758219552169, -0.675716027078987, -0.797637078382872,
0.293149927282554, -0.0194496274679506, 0.30820824660149, 0.175340723199114,
-0.0951395922985812, -1.31345691082239, 0.415767670308176, -2.13876864272561,
1.14760780323137, 0.337166552984059, 1.43758219552169, 1.43758219552169,
0.72231202787223, 0.887374374252874, 0.570588052916284, 0.245465249439257,
-1.7413963273648, -0.708228307426689, -0.0682497363719096, -0.35059322360196,
-0.475349648191982, 1.04020988016088, -0.35059322360196, -2.13876864272561,
-0.296406089689122, 0.990538340740777, 0.642837564800068, 0.385714301919543,
0.612270463618467, 1.43758219552169, -2.13876864272561, 1.43758219552169,
-0.35059322360196, 0.462213785090608, 1.43758219552169, 1.43758219552169,
0.3646769440475, -0.708228307426689, -0.763249089553571, -1.1552721622076,
0.245465249439257, -0.35059322360196, 0.68466622957489, 0.00704186022277019,
0.990538340740777, -0.35059322360196, 0.415767670308176, -0.35059322360196,
0.543494485959865, 0.00704186022277019, -0.606046854905338, 1.43758219552169,
0.415767670308176, -0.165609559554686, -1.36130106919359, -0.136012173307121,
-1.60231601698851, 1.43758219552169, 1.43758219552169, -0.0525639870813512,
-2.13876864272561, 1.01683503808083, -0.188031821863446, -1.37240774881547,
-1.11695411751209, -1.13739040801637, 1.43758219552169), int = c(-0.782440086185924,
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,
0.127231345700962, 0.870061292013265, -1.23834899552138, -1.23834899552138,
-0.136528542120466, 0.168286644091694, -1.23834899552138, 0.323374601090832,
1.2973988974951, 2.53852130586226, 1.01510177359039, 0.19761523561581,
0.0213873960314485, 1.2973988974951, 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, -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,
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.0523056654603556, -0.905574735031486,
-1.26662014513624, 0.321500553719341, 1.16041248486007, -1.26662014513624,
1.19689471990447, -1.26662014513624, -0.379110683630176, -1.26662014513624,
-0.379110683630176, -0.479987402698209, 0.0171606652023762, -0.729825945573633,
-0.905574735031486, -0.0523056654603556, -0.379110683630176,
-0.0523056654603556, -0.729825945573633, 0.529649771425558, 1.23285983544422,
0.428638771973688, 0.265253295539288, 0.6716817891566, 1.78151096253304,
0.321500553719341, 0.428638771973688, -0.729825945573633, 1.43889513669411,
-0.594377425827543, 2.51873437284103, 1.16041248486007, -1.26662014513624,
0.578162271181421, 0.146389826471304, -0.729825945573633, -0.905574735031486,
-0.0523056654603556, 0.0171606652023762, 1.50425961122799, -0.479987402698209,
-1.26662014513624, -0.729825945573633, 0.0171606652023762, -0.729825945573633,
-1.26662014513624, -0.0523056654603556, 1.085803027997, 0.428638771973688,
0.146389826471304, 1.04762441782462, 1.86860983569454, 0.375905733507812,
-0.287855674587523, -1.26662014513624, 1.37195606876229, -0.905574735031486,
-0.479987402698209, 0.146389826471304, -1.26662014513624, -1.26662014513624,
1.98119109903622, 0.206963125543075, 4.37996216642634, 1.56815564296818,
-0.594377425827543, -0.594377425827543, -0.905574735031486, -1.26662014513624,
-0.594377425827543, 0.428638771973688, 1.37195606876229, -0.479987402698209,
0.321500553719341, 0.206963125543075, -1.26662014513624, -0.905574735031486,
-0.203902824073653, 0.146389826471304, 0.0171606652023762, 0.375905733507812,
-1.26662014513624, -0.729825945573633, 0.206963125543075, 0.321500553719341,
-1.26662014513624, -0.287855674587523, 0.0832420537401138, 0.0171606652023762,
-1.26662014513624, 0.375905733507812, 0.428638771973688, 0.529649771425558,
1.47176727449541, -0.287855674587523, 0.0832420537401138, 0.479844981074861,
-0.905574735031486), open = c(-2.71169575965644, -0.209097482550277,
0.50560915634724, -3.20060970700141, 1.59346417087657, 1.31576547813975,
-1.06393989164985, 1.09124379538569, 0.607930008338505, -1.33080848406126,
1.51563755175227, 0.533427293539046, 1.41257639062312, -0.443946923919009,
1.19080512522592, 0.260701952710064, -0.611534032576005, 0.616022675721283,
1.00227202629075, 0.812802415572515, -0.886844705883976, 1.58076208069512,
0.462955243034846, 1.27757411888952, 0.630011338474181, 0.770681970027667,
-0.241573435142371, -0.792671039233291, -0.0473564170202226,
0.00954909351080915, -0.981492844447624, -0.641723991667056,
0.372849594227513, 1.46672229313645, -0.241573435142371, -0.479906436371576,
-3.20060970700141, -0.186102142441323, -0.753272409037418, -1.53805823098238,
-0.846310049314386, 0.233039654067813, -0.329862505834441, -0.0807494341978701,
-0.161979121302261, -1.74689108560237, 0.424358479842289, -1.54990010900638,
0.922984174180756, 0.594066972200716, -0.290160929872162, -1.15877721649827,
-0.285403735688911, 1.2959742304722, -0.443946923919009, 1.01900766907579,
1.21530728865036, -2.13584417695826, 0.119932655934373, -0.221023541046415,
0.418939187164455, -0.875183724660615, -0.148002202442958, 0.318555365188846,
0.770681970027667, -0.589345595899002, -0.330869011202815, -0.423380338407185,
-0.195821112713554, -1.21938746506679, 0.878461496152556, -0.511563500037005,
0.509506995833185, 0.502752903872746, 0.841606517859255, 1.19630357779639,
0.770681970027667, 0.693130514397687, 0.484231585775341, -1.23377540652952,
-0.506527823349666, -0.0924053916179411, 1.55708589487454, 1.0817233084139,
-0.42545652977841, -0.260061839769347, 0.646815489952607, 0.33274196045253,
0.443510545428015, 0.126742502857288, 0.0873945982749442, 0.00954909351080915,
1.36020672502613, -0.655592142541709, -1.23377540652952, 0.257790730279347,
-0.611534032576005, -0.0161004019609583), dtls = c(-1.86097518116627,
0.678721316726936, 2.02527281588554, -1.86097518116627, 0.615211034221858,
-1.86097518116627, 0.350336978501181, 0.510448717779935, 0.811739813018322,
-1.86097518116627, 0.199632666845107, -0.0725365480050633, 0.465731796861761,
0.697476702494682, 1.07828385637704, 1.66945158326344, 1.79655107481788,
-1.07162254421297, 0.215449676693839, -0.227758842475223, -0.0535628781170335,
2.4147798816948, 1.14842669921474, 0.0883212285107371, 2.4147798816948,
0.0370856330272501, -0.870717600518437, -1.86097518116627, -0.129643359444495,
0.465731796861761, 0.62663440532446, -0.407753005726132, 0.147997436020873,
-0.870717600518437, -0.636833829275557, 0.465731796861761, -1.86097518116627,
-0.360930615535855, 0.0370856330272501, 0.0370856330272501, -1.86097518116627,
0.549664714821692, -0.982528835958725, 1.14842669921474, 1.16662018375511,
-0.870717600518437, -0.046342902387748, -1.86097518116627, -1.07823704951995,
-0.223700678106128, -1.29934629547221, 2.4147798816948, 0.324543567821472,
0.272790407667578, 0.465731796861761, -0.55248188913846, 0.5760507289196,
-1.29934629547221, -0.461691765791785, 0.0766962755628196, -0.106300645377285,
0.465731796861761, 0.253325341679819, -0.907145169428865, -0.636833829275557,
0.56558687692412, 0.465731796861761, -0.766157356157486, 0.0370856330272501,
0.0370856330272501, 1.08180016211422, -0.301531991821356, -0.508992170719494,
0.161132374705502, 0.324543567821472, 0.121259028522074, 0.263525268593586,
-0.372918028207157, 0.465731796861761, -1.02945886656297, -0.170123496935577,
-0.297960614539564, 0.546447152682192, 0.384478021549047, -0.183197248689694,
1.14842669921474, 0.726141019394613, -0.257562441044542, 1.33690688688965,
1.47649168415188, 0.6053022045385, -1.86097518116627, 0.181681342008202,
-0.170123496935577, -1.86097518116627, -0.257562441044542, -1.23123035536903,
0.681633497464021), age = c(-1.72159800445673, 0.047164351680815,
0.824642310422593, -1.11905258643185, 0.824642310422593, -0.520394558200683,
1.21338128979348, 0.047164351680815, 0.276520349509639, 0.225984282191424,
0.435903331051704, -1.69438627590077, 1.10064698577592, 0.0743760802367773,
1.50882291411536, 1.50882291411536, 1.36498949174813, -0.703101878505001,
1.18616956123752, 1.11619654495076, 1.21338128979348, -0.49707021943843,
1.55158420184616, -0.372673746039745, -1.88875576558621, -0.411547643976834,
0.0199526231248527, -0.469858490882467, 0.824642310422593, -1.69438627590077,
1.60212026916437, 0.245421231159968, 0.824642310422593, 0.0549391312682326,
0.0743760802367773, 0.824642310422593, -1.73714756363157, -0.543718896962936,
0.513651126925881, -1.3134220761173, 1.64099416710146, -0.333799848102656,
0.750781904342124, -0.53205672758181, -0.831385741697394, 0.047164351680815,
-0.959669604889787, -0.341574627690074, -0.730313607060963, 1.64876894668888,
-0.893583978396736, -0.427097203151669, 0.824642310422593, -0.322137678721529,
-2.09090003485907, -1.11905258643185, 0.307619467859311, 0.824642310422593,
0.824642310422593, 0.047164351680815, 0.047164351680815, -0.924683096746407,
-0.341574627690074, -0.341574627690074, -1.11127780684443, -0.341574627690074,
-0.516507168406974, 0.933489224646442, -1.97816573084152, -0.955782215096079,
-0.660340590774203, -0.730313607060963, -0.147205138004629, -1.7954584105372,
1.84702582616803, 1.71874196297564, 0.995687461345784, 0.863516208359682,
-0.788624453966596, -0.823610962109976, -1.11905258643185, 0.428128551464286,
1.33777776319217, 0.529200686100717, 0.381479873939779, -1.11905258643185,
0.385367263733488, -0.730313607060963, 0.194885163841753, 0.824642310422593,
1.21338128979348, -0.800286623347723, 0.047164351680815, -0.123880799242376,
-1.64385020858255, 1.05399830825142, -0.563155845931481, 1.60212026916437
), gender = c(1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0,
0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0,
1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0,
1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1), type = c(1,
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0,
0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1,
1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1,
0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1), fmly = c(0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1,
1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 0)), row.names = c(NA, -98L), class = "data.frame")
答案 0 :(得分:0)
感谢您发布数据,但是您没有提供model.mg
对象,因此这仍然不是可重复的示例。我会说SEM是基于渐近理论的,而 N = 98已经是一个小样本。将其分为50组和48组使其更不合适,并且更有可能遇到收敛问题(例如,找不到解决方案,无法计算 SE 或Heywood案例的解决方案)。
考虑到您的小 N ,我会考虑采用单组方法进行中度调解。
https://doi.org/10.1080/00273170701341316
您可以在lavaan的Google论坛上搜索“仲裁中介”语法示例。