error to run the model with two dummy variable

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

error to run the model with two dummy variable

Postby Chavez » Fri Nov 12, 2021 3:33 pm

Dear Michiel

Thank you for previous suggestions and aids to resolve my doubts,
now I get my priors, and I´m doing my design in the Ngene software, and I´m using the following code:

Design
;alts = A, B, C
;rows = 24
;block = 4
;eff = (mnl,d)
;model:
U(A) = b1[0] + b2[0.06] * A[10,25,50,75] + b3.dummy[-0.54|1.85|-0.23] * B[0,1,2,3] + b4[-0.01] * C[0,2,5,9] + b5.dummy[0.54|-0.14|0.11] * D[0,1,2,3] /
U(B) = b2 * A + b3 * B + b4 * C + b5 * D /
U(C) = b2 * A1[50] + b3 * B1[1] + b4 * C1[5] + b5 * D1[0]
$

When I tried to run the model, Ngene wouldn´t let me run it with the dummy variable, and I had the same problem when I included the status quo. (U(C) = b2 * A1[50] + b3 * B1[1] + b4 * C1[5] + b5 * D1[0]). I only can run the model with one dummy variable, but not with two dummy variables.
Could you help me check my code because I have checked several times and can´t find the mistake I am making?

Thank you very much again for you time.
Chavez
 
Posts: 3
Joined: Wed Nov 03, 2021 5:53 am

Re: error to run the model with two dummy variable

Postby Michiel Bliemer » Fri Nov 12, 2021 6:04 pm

Specifying b3.dummy[...] * B[...] means that b3 is a dummy coded parameter, while specifying b3 * B1[...] means that b3 is a regular parameter for a linear effect. This is inconsistent in the way Ngene reads the syntax.

There are two ways to specify the syntax. The first is by using constraints to set the levels for alternative C for the dummy coded variables:

Code: Select all
Design
;alts = A, B, C
;rows = 24
;block = 4
;eff = (mnl,d)
;alg = mfederov(candidates=2000)
;require:
C.B=1, C.D=0
;model:
U(A) = b1[0]
     + b2[0.06]                   * A[10,25,50,75](4-8,4-8,4-8,4-8)
     + b3.dummy[-0.54|1.85|-0.23] * B[0,1,2,3]
     + b4[-0.01]                  * C[0,2,5,9](4-8,4-8,4-8,4-8)
     + b5.dummy[0.54|-0.14|0.11]  * D[0,1,2,3]
     /
U(B) = b2 * A + b3 * B + b4 * C + b5 * D
     /
U(C) = b2 * A1[50] + b3 * B + b4 * C1[5] + b5 * D
$


Require constraints only work with the modified Federov algorithm. Further, the modified Federov algorithm relaxes attribute level balance, so if you want some balance in the attribute levels for the qualitative attributes you need to specify additional constraints as I have done with (5-7,5-7,5-7,5-7), where each of the 4 levels needs to appear between 5 and 7 times (6 times would be perfect attribute level balance given that you have 24 rows). This syntax takes a bit of time to find an intial design. Note that adding attribute level constraints is generally not needed for dummy coded variables since an efficient design will automatically result in high balance for such attributes since otherwise one or more dummy coded parameters cannot be estimated with high efficiency.

Alternatively, you can use the syntax below:

Code: Select all
Design
;alts = A, B, C
;rows = 24
;block = 4
;eff = (mnl,d)
;model:
U(A) = b1[0]
     + b2[0.06]                   * A[10,25,50,75]
     + b3.dummy[-0.54|1.85|-0.23] * B[0,2,3,1]
     + b4[-0.01]                  * C[0,2,5,9]
     + b5.dummy[0.54|-0.14|0.11]  * D[1,2,3,0]
     /
U(B) = b2 * A + b3 * B + b4 * C + b5 * D
     /
U(C) = b2 * A1[50] + b4 * C1[5]
$


Here I have set 1 the base level for dummy coded attribute B, and I have set 0 the base level for dummy coded attribute D by specifying this level as the last level for the attribute. In dummy coding, the contribution to utility of the base level is equal to zero, therefore I can omit this variable in the specification of C since it simply drops out. Note that if you change the base level, you also need to change your priors (which I have not done yet!).

The first syntax is generally my preferred syntax since it allows checking for dominance on all attributes by using ;alts = A*, B*, C*. Ngene is not able to check for dominance in the second syntax since attributes B and D are not included in the utility specification for alternative C.

Michiel
Michiel Bliemer
 
Posts: 1705
Joined: Tue Mar 31, 2009 4:13 pm


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 14 guests

cron