Page 1 of 1

an error message of " worng number of levels for dummy

PostPosted: Thu Aug 20, 2020 7:19 am
by wxy008
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

$

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

PostPosted: Thu Aug 20, 2020 10:33 am
by Michiel Bliemer
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

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

PostPosted: Fri Aug 21, 2020 12:24 am
by wxy008
Dear Michiel,

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

Wei