help! Model won't run when applying constraint with multiple operations

10 views
Skip to first unread message

James K

unread,
Jul 3, 2019, 3:13:26 PM7/3/19
to lavaan
I cannot for the life of me figure out why my model is not running. I am trying to apply a specific constraint where b4 = -2 * sqrt(b3 * b5).
Here is the model:

      model <- "
      outcome ~ b1*X.c + b2*Y.c + b3*X.c2 + b4*XY
      + b5*Y.c2 
      b4 == -2*sqrt(b3*b5)
      "

Then I play around with the constraint to identify which part of it is screwing things up. The following models run, however:
 
     model <- "
      outcome ~ b1*X.c + b2*Y.c + b3*X.c2 + b4*XY
      + b5*Y.c2 
      b4 == sqrt(b3*b5)
      "

      model <- "
      outcome ~ b1*X.c + b2*Y.c + b3*X.c2 + b4*XY
      + b5*Y.c2 
      b4 == -2*sqrt(b3)
      "

      model <- "
      outcome ~ b1*X.c + b2*Y.c + b3*X.c2 + b4*XY
      + b5*Y.c2 
      b4 == -2*b3*b5
      "

Any insights would be greatly appreciated!

Edward Rigdon

unread,
Jul 3, 2019, 3:27:23 PM7/3/19
to lav...@googlegroups.com
Is it possible that b3*b5 is negative?
sqrt(b3) runs, so b3 is positive.
The final estimate of b5 may be positive, but maybe not the starting value or some early iteration.
You could add a positive start value to your first line of code:
      model <- "
      outcome ~ b1*X.c + b2*Y.c + b3*X.c2 + start(0.3)*X.c2 + b4*XY + b5*Y.c2 + start(0.3)*Y.c2
      b4 == -2*sqrt(b3*b5)
      "
Just a thought.

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/26fe2f4d-ef3d-4782-b846-321f8e8c89b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James K

unread,
Jul 5, 2019, 4:17:23 PM7/5/19
to lavaan
Thanks for your response. 
I was able to resolve the issue by setting the constraint as b4^2 = 4*b3*b5
To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages