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

10 views

### James K

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

Jul 3, 2019, 3:27:23 PM7/3/19
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.