Open pmpharm opened 4 years ago
Same in different, gave the same NM error:
> m5 <- reset_lv_models(m4)
> m11 <- add_lv_model(m5, "linear", c(2,4,8,10,14,19,25,29,34,36,41,47,50,52,57))
> m11 <- add_lv_model(m11, "linear", c(3,5,12,16,20,23,26,30,32,37,40,42,43,53,55,58))
> m11 <- add_lv_model(m11, "linear", c(6,11,17,27,35,45,49))
> m11 <- add_lv_model(m11, "linear", c(1,7,13,15,18,21,24,28,31,38,39,44,48,51,54,56))
> m11 <- add_lv_model(m11, "linear", c(9,22,33,46))
> save_model_code(m11, "run11.mod")
Fixed by changing:
> IF (PSI_MODEL.EQ.1) THEN
> BASE=THETA(233)+ETA(1)
> SLP=THETA(234)+ETA(2)
> PSI=BASE+SLP*TIME
> ELSE IF (PSI_MODEL.EQ.2) THEN
> BASE=THETA(235)+ETA(3)
> SLP=THETA(236)+ETA(4)
> PSI=BASE+SLP*TIME
> ELSE IF (PSI_MODEL.EQ.3) THEN
> BASE=THETA(237)+ETA(5)
> SLP=THETA(238)+ETA(6)
> PSI=BASE+SLP*TIME
> ELSE IF (PSI_MODEL.EQ.4) THEN
> BASE=THETA(239)+ETA(7)
> SLP=THETA(240)+ETA(8)
> PSI=BASE+SLP*TIME
> ELSE IF (PSI_MODEL.EQ.5) THEN
> BASE=THETA(241)+ETA(9)
> SLP=THETA(242)+ETA(10)
> PSI=BASE+SLP*TIME
> END IF
to
> IF (PSI_MODEL.EQ.1) THEN
> BASE=THETA(233)+ETA(1)
> SLP=THETA(234)+ETA(2)
> PSI=BASE+SLP*TIME
> ENDIF
> IF (PSI_MODEL.EQ.2) THEN
> BASE=THETA(235)+ETA(3)
> SLP=THETA(236)+ETA(4)
> PSI=BASE+SLP*TIME
> ENDIF
> IF (PSI_MODEL.EQ.3) THEN
> BASE=THETA(237)+ETA(5)
> SLP=THETA(238)+ETA(6)
> PSI=BASE+SLP*TIME
> ENDIF
> IF (PSI_MODEL.EQ.4) THEN
> BASE=THETA(239)+ETA(7)
> SLP=THETA(240)+ETA(8)
> PSI=BASE+SLP*TIME
> ENDIF
> IF (PSI_MODEL.EQ.5) THEN
> BASE=THETA(241)+ETA(9)
> SLP=THETA(242)+ETA(10)
> PSI=BASE+SLP*TIME
> ENDIF
Thanks for reporting this. It is indeed a bug.
Tried to add two complementary LV models as follows:
When run got the NM error: RANDOM VARIABLE IS DEFINED IN A NESTED IF STRUCTURE. Fixed the problem by modified the output code from piraid from:
to
Models run without NM error after.