Closed aliciagf closed 2 years ago
The multigroup
function needs to parse model formulas so that it can refit with interactions. I couldn't say for certain without a reproducible example to work with, but my guess is that the function is unable to parse the model formulas.
I've found that the function doesn't like complicated RE structures, so that might be the issue. I've gotten past this by rewriting the parts of the function that do the parsing.
Closing this as a more robust implementation of multigroup is forthcoming
Hello I am experiencing a similar issue as alicia : I do not understand why the global SEM model fits but not the multigroup analysis. Does anyone know where the problem might lie?
Below is a reproducible example
sem_ex=data.frame( AMFprop=runif(70, min = 0, max = 1), SOIL_TRT=sample(0:1, 70, replace = TRUE), N.mmol.kg=rnorm(70, mean = 2078.708, sd = 296.3191), Tot_tuber.g=rnorm(70, mean = 43, sd = 15), groupAMF=rep(c("a", "b"), 70), data=sem_ex )
pmodel <- psem( lm(Tot_tuber.g ~ N.mmol.kg, data=sem_ex), lm(N.mmol.kg ~ AMFprop+SOIL_TRT,data=sem_ex), lm(AMFprop ~ SOIL_TRT,data=sem_ex), data=sem_ex)
pmultigroup <- multigroup(pmodel, group = "groupAMF") pmultigroup
Structural Equation Model of pmodel
Groups = groupAMF [ global ]
Global goodness-of-fit:
Fisher's C = 0.982 with P-value = 0.912 and on 4 degrees of freedom
Model-wide Interactions:
Response Predictor Test.Stat DF P.Value
Tot_tuber.g N.mmol.kg:groupAMF 173.2 1 0.0688 N.mmol.kg AMFprop:groupAMF 10.1 1 0.4819 N.mmol.kg groupAMF:SOIL_TRT 10.1 1 0.8229 AMFprop SOIL_TRT:groupAMF 0.0 1 0.1967
N.mmol.kg -> Tot_tuber.g constrained to the global model AMFprop -> N.mmol.kg constrained to the global model SOIL_TRT -> N.mmol.kg constrained to the global model SOIL_TRT -> AMFprop constrained to the global model
Global coefficients:
Response Predictor Estimate Std.Error DF Crit.Value P.Value Std.Estimate
Tot_tuber.g N.mmol.kg 0.0042 0.0047 138 0.9052 0.3669 0.0768 N.mmol.kg AMFprop 0.1147 70.5402 137 0.0016 0.9987 0.0001 N.mmol.kg SOIL_TRT -4.2492 46.1936 137 -0.0920 0.9268 -0.0079 AMFprop SOIL_TRT -0.0443 0.0556 138 -0.7973 0.4267 -0.0677
Signif. codes: 0 '' 0.001 '' 0.01 '' 0.05 c = constrained
This is the model I am trying to fit:
And here is the result:
I do not understand why the global SEM model fits but not the multigroup analysis. Does anyone know where the problem might lie? My database is quite complex, but I can provide a reduced example if needed.
Thank you!