an error message of " worng number of levels for dummy

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

an error message of " worng number of levels for dummy

Postby wxy008 » Thu Aug 20, 2020 7:19 am

Dear Michiel,

When I run an orthogonal design (shown below), I got an error message "Error: An attribute has the wrong number of levels for dummy or effects coding. 'tech'". Could you help me to figure out why I got this message and how should I solve it?
Code: Select all
Design;

;alts = alt1*,alt2*,alt3*,nobuy;
;rows = 40;
;orth = ood;
;block = 4;

;model:
U(alt1) = b0 + b1 * price[200,300,400,500,600] +
               b2.dummy * tech[1,2,3] +
               b3.dummy  * spec[1,2,3,4] +
               b4.dummy  * timing[1,2] +
               b5.dummy  * life[1,2,3,4]
                /
U(alt2) = b0 + b1 * price +
               b2 * tech  +
               b3 * spec +
               b4 * timing +
               b5 * life
               /
U(alt3) =  b0 + b1 * price +
                b2 * tech  +
                b3 * spec +
                b4 * timing +
                b5 * life

$
wxy008
 
Posts: 33
Joined: Wed Mar 04, 2020 3:22 am

Re: an error message of " worng number of levels for dummy

Postby Michiel Bliemer » Thu Aug 20, 2020 10:33 am

Optimal orthogonal designs (OOD) do not consider dummy coding so you can just remove ".dummy" from the syntax and it will run. Note that OOD have some limitations and a design with 40 rows does not exist with your design dimensions (Ngene finds a design with 60 rows). It will show up as 0% D-optimality according to the definition of Street and Burgess, but you can still use this design. Note further that orthogonal designs cannot remove dominant alternatives so putting an asterisk (*) behind the alternative names does not do anything.

If you want to have more flexibility and optimise for a design with dummy coding as well as automatically remove dominant alternatives in your design, then you should use an efficient design with priors indicating the sign, for example (I do not know what your attributes mean, so I just guessed the signs for the first two attributes and left the other ones zero):

Code: Select all
Design
;alts = alt1*,alt2*,alt3*,nobuy
;rows = 40
;eff = (mnl,d)
;block = 4

;model:
U(alt1) = b0
        + b1[-0.00001]            * price[200,300,400,500,600]
        + b2.dummy[0.0002|0.0001] * tech[1,2,3] ? 1 = best, 2 = medium, 3 = worst (reference)
        + b3.dummy[0|0|0]         * spec[1,2,3,4]
        + b4.dummy[0]             * timing[1,2]
        + b5.dummy[0|0|0]         * life[1,2,3,4]
        /
U(alt2) = b0
        + b1 * price
        + b2 * tech 
        + b3 * spec
        + b4 * timing
        + b5 * life
        /
U(alt3) = b0
        + b1 * price
        + b2 * tech 
        + b3 * spec
        + b4 * timing
        + b5 * life
$


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

Re: an error message of " worng number of levels for dummy

Postby wxy008 » Fri Aug 21, 2020 12:24 am

Dear Michiel,

Thanks for your quick response and really helpful suggestion. I really appreciate it.

Wei
wxy008
 
Posts: 33
Joined: Wed Mar 04, 2020 3:22 am


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: Google [Bot] and 4 guests