Attachment | Size |
---|---|
ZyphurPGS.drawio.png | 127.27 KB |
Hi all,
I am trying to specify the CLPM in the attached figure (It's an extension of Zyphur's 2020 general CLPM, but with PGSs). I specified both using lavaan syntax in umx and matrix algebra (first time, hope it is correct, but looks like so). It is identified, the model runs ok. But when I try to get power or the ncp statistic it fails, as the model's implied cov is not positive definite.
- What can I do to avoid this? lbounds and ubounds will help me there?
Lavaan code:
model = " # random intercepts xir =~ 1*X1 + 1*X2 + 1*X3 +1*X4 + 1*X5 + 1*X6 yir =~ 1*Y1 + 1*Y2 + 1*Y3 + 1*Y4 + 1*Y5 + 1*Y6 # crosslaged Y2 ~ X1 X2 ~ Y1 Y3 ~ X2 X3 ~ Y2 Y4 ~ X3 X4 ~ Y3 Y5 ~ X4 X5 ~ Y4 Y6 ~ X5 X6 ~ Y5 # instrument X1 + X2 + X3 + X4 + X5 + X6 ~ PGSx Y1 + Y2 + Y3 + Y4 + Y5 + Y6 ~ PGSy # innovations innoX1 =~ 1*X1 innoX2 =~ 1*X2 innoX3 =~ 1*X3 innoX4 =~1*X4 innoX5 =~1*X5 innoX6 =~1*X6 innoY1 =~1*Y1 innoY2 =~1*Y2 innoY3 =~1*Y3 innoY4 =~1*Y4 innoY5 =~1*Y5 innoY6 =~1*Y6 X2 ~ innoX1 X3 ~ innoX2 X4 ~ innoX3 X5 ~ innoX4 X6 ~ innoX5 Y2 ~ innoY1 Y3 ~ innoY2 Y4 ~ innoY3 Y5 ~ innoY4 Y6 ~ innoY5 # # correlations xir ~~ yir #means X1 ~ 1 X2 ~ 1 X3 ~ 1 X4 ~ 1 X5 ~ 1 Y1 ~ 1 Y2 ~ 1 Y3 ~ 1 Y4 ~ 1 Y5 ~ 1 # variances innoX1 ~~ 1*innoX1 innoX2 ~~ 1*innoX2 innoX3 ~~ 1*innoX3 innoX4 ~~ 1*innoX4 innoX5 ~~ 1*innoX5 innoX6 ~~ 1*innoX6 innoY1 ~~ 1*innoY1 innoY2 ~~ 1*innoY2 innoY3 ~~ 1*innoY3 innoY4 ~~ 1*innoY4 innoY5 ~~ 1*innoY5 innoY6 ~~ 1*innoY6 " m1 <- umxRAM(model, lavaanMode = "lavaan") m1 <- mxGenerateData(m1,nrows = 1000, returnModel = T) m1 <- umxRAM(m1, tryHard = "yes") umxSummary(m1) plot(m1) id <- mxCheckIdentification(m1) # Identified!
Now where it errs:
umxPower(m1, update = "Y2_to_X3", sig.level = 0.05, explore = T)
gives me:
Error incurred trying to run model: model = mxTryHard(model) might help? The job for model 'drop_Y2_to_X3' exited abnormally with the error message: fit is not finite (The continuous part of the mode l implied covariance (loc2) is not positive definite in data 'drop_Y2_to_X3.data' row 488. Detail: covariance = matrix(c( # 16x16
and,
mxCompare(m1, mxTryHard(omxSetParameters(m1, labels=c('Y2_to_X3','X2_to_Y3'), values= 0, free= F),2))
Gives me:
All fit attempts resulted in errors - check starting values or model specification Error in if (rfu == "r'Wr") { : argument is of length zero
P.S.:Is it possible to inline the image in this quesiton instead of using the attachment function?
This was discussed last meeting, the trick is setting the starting values.