Hello, I am new to Ngene and am working through some coding issues. Please see my code below - it is well commented to describe the 4 alternatives and 5 attributes. All five attribute are dummy coded.
Most of my questions are about using ;require and ;cond. I want to use both, to restrict the levels of attributes to plausible values. Some of these restrictions are for one alternative. Some apply to all alternatives. I find that the only way to logically express these restrictions is by using BOTH ;require and ;cond, but this poses problems for the algorithm - if using ;require, I need to use an mfederov algorithm, but mfederov doesn't work with ;cond. Does this mean that I can't use ;require and ;cond together? If so, how can I impose these restrictions?
Also, is it possible to impose conditions on all alternatives?
Also, in the below code I am getting the error: "Error: An attribute has the wrong number of levels for dummy or effects coding. 'freq'", and I can't figure out what's wrong with the levels of freq.
Thanks a lot!!
????????????????????????????????????????????????????????????????????????????
?????? 1. Design details
????????????????????????????????????????????????????????????????????????????
Design
? 4 alternatives, in 2 blocks,
;alts = IMIN, SCIN, IMPL, ORAL
;rows = 64
;block = 4
? D-efficient design with multinomial logit
;eff = (mnl, d)
? Algorithm
? if using the require property, I need to use mfederov, but I can't use that with cond
?;alg = mfederov(stop=noimprov(4 secs))
?;alg=all
????????????????????????????????????????????????????????????????????????????
????? 2. Restrict attribute levels
????????????????????????????????????????????????????????????????????????????
? loca: 0 home, 1 pharm, 2 clinic
? freq: numeric in weeks: 0 1, 1 4, 2 8, 3 12, 4 26, 5 52
? pain: 0 none, 1 minimal, 2 mild, 3 moderate
? lead: numeric in months: 0 0, 1 1, 2 3
? buff: numeric in weeks: 0 0, 1 2, 2 4, 3 6, 4 13, 5 26
;require:
IMIN.loca>=1,
IMIN.freq>=1 and IMIN.freq<=3,
IMIN.pain>=2,
IMIN.lead>=1,
SCIN.freq<=3,
SCIN.pain>=1 and SCIN.pain<=2,
SCIN.lead>=1,
IMPL.loca=2,
IMPL.freq>=3,
IMPL.pain>=2,
IMPL.lead>=1,
ORAL.loca=0,
ORAL.freq<=1,
ORAL.pain=0,
ORAL.lead=0
?any way to impose conditions on all alternatives?
;cond:
if(IMIN.freq=1, IMIN.buff=1),
if(IMIN.freq=2, IMIN.buff=2),
if(IMIN.freq=3, IMIN.buff=3),
if(SCIN.freq=0, SCIN.buff=0),
if(SCIN.freq=1, SCIN.buff=1),
if(SCIN.freq=2, SCIN.buff=2),
if(SCIN.freq=3, SCIN.buff=3),
if(IMPL.freq=3, IMPL.buff=3),
if(IMPL.freq=4, IMPL.buff=4),
if(IMPL.freq=5, IMPL.buff=5),
if(SCIN.freq=0, SCIN.loca=0),
if(SCIN.freq=0, SCIN.buff=0),
if(IMIN.loca=[1,2], IMIN.freq>=1),
if(SCIN.loca=[1,2], SCIN.freq>=1)
???????????????????????????????????????????????????????????????????????????
????? 3. Specify attributes and levels for each alternative
???????????????????????????????????????????????????????????????????????????
?Priors
? loca: Home (0) is best. Pharmacy (1) and clinic (2) are equal
? freq: all frequencies equal
? pain: each successive pain level is worse
? lead: less lead in is better
? buff: bigger buffer is better
;model:
? IMIN
U(IMIN) = b1.dummy[0.01|0]*loca[0,1,2]
+ b2.dummy*freq[0,1,2,3,4,5]
+ b3.dummy[0.03|0.02|0.01]*pain[0,1,2,3]
+ b4.dummy[0.02|0.01]*lead[0,1,2]
+ b5.dummy[-0.02|-0.01]*buff[0,1,2,3,4,5]
/
? SCIN
U(SCIN) = b1*loca
+ b2*freq
+ b3*pain
+ b4*lead
+ b5*buff
/
? IMPL:
U(IMPL) = b1*loca
+ b2*freq
+ b3*pain
+ b4*lead
+ b5*buff
/
? ORAL:
U(ORAL) = b1*loca
+ b2*freq
+ b3*pain
+ b4*lead
+ b5*buff
$