## Unbalanced attribute levels in the generated experiments wit

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

### Unbalanced attribute levels in the generated experiments wit

Unbalanced attribute levels in the generated experiments with conditions

Hi all, I am designing an SP experiment with two unlabeled alternatives with four attributes, A, B, C, and D. A and C are continuous, while B and D are both binary. Moreover, If B=0, C would be less than 20 and D would be 1. Then I found in the generated experiments, that the frequency of B=0 would be much lesser than that of B=1, which I think is not consistent with the reality. Can anyone give a hand and some clues about what really happened and how to fix it? Thanks.
The code is attached.
Code: Select all
`?SP testDesign;alts=alt1, alt2;rows=50;eff=(mnl,d);cond:if(alt1.B=0, alt1.C<20),if(alt2.B=0, alt2.C<20),if(alt1.B=0, alt1.D=1),if(alt2.B=0, alt2.D=1);model:U(alt1)=b1 * A[0:10:1] + b2 * B[0,1] + b3 * C[0:25:5] + b4 * D[0,1]/U(alt2)=b1 * A + b2 * B + b3 * C + b4 * D\$`
dzhang

Posts: 5
Joined: Sat Nov 27, 2021 1:41 am

### Re: Unbalanced attribute levels in the generated experiments

The fact that B=0 appears much less is because of your constraints. In particular your constraint if(altx.B=0, altx.D=1). Namely, The combination B=0 and D=0 is not allowed according to this constraint, so this removes B=0 from many choice tasks.

You can consider using the modified Federov algorithm, which allows imposing constraints on the number of times each attribute level must appear within the design. This algorithm only accepts reject constraints, so I have rewritten the conditional constraints to reject constraints. Note that imposing constraints of the number of times each attribute level must appear makes it much more difficult for Ngene to find a feasible design. I was able to run the syntax below, it took several minutes before Ngene could find a feasible design. The more you relax the constraints, the more efficient your design will be.

Code: Select all
`?SP testDesign;alts=alt1, alt2;rows=50;eff=(mnl,d);alg = mfederov;reject:alt1.B = 0 and alt1.C = 20,alt2.B = 0 and alt2.C = 20,alt1.B = 0 and alt1.D = 0,alt2.B = 0 and alt2.D = 0;model:U(alt1) = b1 * A[0,1,2,3,4,5,6,7,8,9,10](3-6,3-6,3-6,3-6,3-6,3-6,3-6,3-6,3-6,3-6,3-6)         + b2 * B[0,1](20-30,20-30)        + b3 * C[0,5,10,15,20,25](8-12,8-12,8-12,8-12,8-12,8-12)         + b4 * D[0,1](20-30,20-30)        /U(alt2) = b1 * A + b2 * B + b3 * C + b4 * D\$`

Michiel
Michiel Bliemer

Posts: 1631
Joined: Tue Mar 31, 2009 4:13 pm

### Re: Unbalanced attribute levels in the generated experiments

Thanks Michiel, it really helps!!
dzhang

Posts: 5
Joined: Sat Nov 27, 2021 1:41 am

### Re: Unbalanced attribute levels in the generated experiments

One more question, how should the required appearance times for the level be decided? Any calculation method or just a rule of thump? Thanks.
dzhang

Posts: 5
Joined: Sat Nov 27, 2021 1:41 am

### Re: Unbalanced attribute levels in the generated experiments

You have 50 rows. If you have an attribute with 2 levels, then perfect balance will be that each level appears 25 times. So you could use (25,25) but that is too strict and Ngene will not be able to find a design. I relaxed it to (20-30,20-30). How far you need to relax depends on whether Ngene is able to find a design or not.

Michiel
Michiel Bliemer

Posts: 1631
Joined: Tue Mar 31, 2009 4:13 pm

### Re: Unbalanced attribute levels in the generated experiments

I see. Thank you for your instruction, Michiel !!
dzhang

Posts: 5
Joined: Sat Nov 27, 2021 1:41 am