Labelled design

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

Labelled design

Postby Sameh » Wed Feb 05, 2025 9:17 am

Dear Dr. Michiel,

I would appreciate your guidance in improving this script. I believe there is an issue—specifically, with the definition of two attributes [cafeina, sabor].

To provide some context: this is a labelled design with seven labels (Coca-Cola, Fanta, Schweppes, Pepsi, Inca Kola, 7-Up), including a "none" option.

Regarding the required command: for alternatives 2, 3, 5, and 6, the attribute cafeina (which has two levels: sin cafeína and con cafeína) is fixed at sin cafeína. However, alternatives 1 and 4 can be either sin cafeína or con cafeína. The same logic applies to the sabor attribute: alt5.sabor is fixed to the original [5], while sabor are assigned specific levels for the other alternatives.

All the attributes are categorical except the price.

**************
Design
;alts = alt1* , alt2*, alt3*, alt4*, alt5*, alt6*, none
;rows = 42
;block = 3 , minsum
;eff = (mnl,d)
;require:
alt2.cafeina = 1,
alt3.cafeina = 1,
alt5.cafeina = 1,
alt6.cafeina = 1
alt5.sabor = 5
;model:
U(alt1) = b1 + b2.dummy[0] * Cafeina[1,2] + b3.dummy[0]* origen[1,2] + b4.dummy[0] * tipo[1,2] + b5.dummy[0|0] * sabor_cola[1,9,14] + b6* Price_cola[1, 1.15, 1.4, 1.6] (0-42, 2-12, 2-12, 2-12)/
U(alt2) = b7 + b2 * Cafeina + b3* origen + b4tipo + b8.dummy[0|0] * sabor_fan[2,11,13] + b9 Price_fan[0.85, 1, 1.1, 1.2](0-42, 2-12, 2-12, 2-12)/
U(alt3) = b10 + b2 * Cafeina + b3* origen + b4*tipo + b11.dummy[0|0] * sabor_shwep[1,3,11] + b12 * Price_shwep[0.9, 1, 1.15, 1.4](0-42, 2-12, 2-12, 2-12)/
U(alt4) = b13 + b2 * Cafeina + b3* origen + b4*tipo + b14.dummy[0|0] * sabor_pepsi[9,4,10] + b15 * Price_pepsi[1.05, 1.15, 1.35, 1.5](0-42, 2-12, 2-12, 2-12)/
U(alt5) = b16 +b2 * Cafeina + b3* origen + b4*tipo + b17 * sabor[5] + b20 * Price_inca[0.90, 1.05, 1.15, 1.30](0-42, 2-12, 2-12, 2-12)/
U(alt6) = b18+ b2 * Cafeina + b3* origen + b4*tipo + b19.dummy[0|0] * sabor_up[6,7,8] + b20 * Price_up[0.65, 0.85, 1, 1.15](0-42, 2-12, 2-12, 2-12)
$

I mean for example in alt 5, sabor (catego.var) has only one level, so how can I specify it in the script?
May I remove variables in each alternative with one level? but now I start to think about Zeros that I will obtain in the unspecified variable/alternative instead of the levels that has to be mentioned.
I don´t know if I well explained the issue that I have. Can you help me with this?
Greetings,
Sameh
 
Posts: 15
Joined: Wed Nov 03, 2021 6:26 pm
Location: Spain

Re: Labelled design

Postby Michiel Bliemer » Wed Feb 05, 2025 10:13 am

You need to remove the asterisk (*) in alts because this is for unlabelled alternatives, while your alternatives are labelled.
You need to add ;alg = mfederov as the require constraints only work with this algorithm.

There is no need to set alt5.sabor=5 because you can specify this attribute simply with a single level in the utility function, e.g. sabor_inca[5]. HOWEVER, you cannot estimate parameter b17 because you also have constant b16 and you cannot have two constants in the same utility function as this would result in an unidentifiable model. So you either need to remove this attribute, so that b17 will be absorbed into the constant b16, or level 5 should also appear in another alternative and you use a generic coefficient.

For example, you could use b5 across all alternatives, but you will need to make sure that there are no levels that are unique for one alternative, so sabor = 5 MUST also appear in another alternative.
;reject:
alt1.sabor <> 1 and alt1.sabor = <> 9 and alt1.sabor <> 14,
... etc
alt1.sabor <> 5,
... etc
;model:
U(alt1) = ... + b5.dummy[0|0|0|0|0|0|0|0|0|0|0|0|0] * sabor[1,2,3,4,5,6,7,8,9,10,11,12,13,14] + ...
U(alt2) = ... + b5 * sabor + ...
U(alt3) = ... + b5 * sabor + ...
U(alt4) = ... + b5 * sabor + ...
U(alt5) = ... + b5 * sabor + ...
U(alt6) = ... + b5 * sabor + ...

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

Re: Labelled design

Postby Sameh » Wed Feb 05, 2025 8:18 pm

Dr. Michiel,

thank you for replying. I get your point! the prob is that too many constraints will be applied which will impact the efficiency of the design. Anyway, I modified the design following your suggestions. However, the D-error is undefined.

Do you have any suggestion?

Merci,

Script:

Design
;alts = cola , fan, shwep, pepsi, inca, up, none
;rows = 42
;block = 3 , minsum
;eff = (mnl,d)
;alg = mfederov
;require:
fan.cafeina = 1,
shwep.cafeina = 1,
inca.cafeina = 1,
up.cafeina = 1,
Inca.sabor =5
;reject:
Cola.sabor <> 1 and cola.sabor <> 9 and cola.sabor <> 14,
Cola.sabor = 5,
Fan.sabor <> 2 and fan.sabor <> 11 and fan.sabor <> 13,
Fan.sabor = 5,
Shwep.sabor <> 1 and shwep.sabor <> 3 and shwep.sabor <> 11,
Shwep.sabor = 5,
Pepsi.sabor <> 9 and pepsi.sabor <> 4 and pepsi.sabor <> 10,
Pepsi.sabor = 5,
Up.sabor <> 6 and up.sabor <> 7 and up.sabor <> 8,
Up.sabor = 5
;model:
U(cola) = b1 + b2.dummy[0] * Cafeina[1,2] + b3.dummy[0]* origen[1,2] + b4.dummy[0] * tipo[1,2] + b5.dummy[0|0|0|0|0|0|0|0|0|0|0|0|0] * sabor[1,2,3,4,5,6,7,8,9,10,11,12,13,14] + b6* Price_cola[1, 1.15, 1.4, 1.6] (0-42, 2-12, 2-12, 2-12)/

U(fan) = b7 + b2 * Cafeina + b3* origen + b4*tipo + b5*sabor+ b8* Price_fan[0.85, 1, 1.1, 1.2](0-42, 2-12, 2-12, 2-12)/

U(shwep) = b9 + b2 * Cafeina + b3* origen + b4*tipo + b5 * sabor + b10* Price_shwep[0.9, 1, 1.15, 1.4](0-42, 2-12, 2-12, 2-12)/

U(pepsi) = b11 + b2 * Cafeina + b3* origen + b4*tipo + b5* sabor+ b12 * Price_pepsi[1.05, 1.15, 1.35, 1.5](0-42, 2-12, 2-12, 2-12)/

U(inca) = b13 +b2 * Cafeina + b3* origen + b4*tipo + b5 * sabor + b14 * Price_inca[0.90, 1.05, 1.15, 1.30](0-42, 2-12, 2-12, 2-12)/

U(up) = b15+ b2 * Cafeina + b3* origen + b4*tipo + b5* sabor + b16 * Price_up[0.65, 0.85, 1, 1.15](0-42, 2-12, 2-12, 2-12) $
Sameh
 
Posts: 15
Joined: Wed Nov 03, 2021 6:26 pm
Location: Spain

Re: Labelled design

Postby Michiel Bliemer » Thu Feb 06, 2025 5:12 pm

If you look at the Fisher information matrix of the design, you can see that b5(d11) does not get any information, which corresponds to sabor=12. I cannot see level 12 being used in any of your alternatives so that is likely the issue. Please check the constraints where you should allow level 12.

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

Re: Labelled design

Postby Sameh » Thu Feb 06, 2025 8:49 pm

Thank you for your suggestion.

But even after modifying the constraints, it still has the undefined D-error.

I´ve attached the modified script; if you can, please, help me with this. I don´t know if it can impact the design (I think yes), (0-42, 2-12, 2-12, 2-12), I removed it to see if it could be the prob.

Design

;alts = alt1 , alt2, alt3, alt4, alt5, alt6, none

;rows = 42

;block = 3 , minsum

;eff = (mnl,d)
;alg = mfederov

;reject:

Alt1.sabor <> 1 and alt1.sabor <> 9 and alt1.sabor <> 13,

Alt1.sabor = 5,

Alt2.sabor <> 2 and alt2.sabor <> 11 and alt2.sabor <> 12,

Alt2.sabor = 5,

Alt3.sabor <> 1 and alt3.sabor <> 3 and alt3.sabor <> 11,

Alt3.sabor = 5,

Alt4.sabor <> 9 and alt4.sabor <> 4 and alt4.sabor <> 10,

Alt4.sabor = 5,

Alt6.sabor <> 6 and alt6.sabor <> 7 and alt6.sabor <> 8,

Alt6.sabor = 5,

alt2.cafeina <> 1,

alt3.cafeina <> 1,

alt5.cafeina <> 1,

alt6.cafeina<> 1,

alt5.sabor <> 5

;model:

U(alt1) = b1 + b2.dummy[0] * Cafeina[1,2] + b3.dummy[0]* origen[1,2] + b4.dummy[0] * tipo[1,2] + b5.dummy[0|0|0|0|0|0|0|0|0|0|0|0] * sabor[1,2,3,4,5,6,7,8,9,10,11,12,13] + b6* Price_cola[1, 1.15, 1.4, 1.6] (0-42, 2-12, 2-12, 2-12)/



U(alt2) = b7 + b2 * Cafeina + b3* origen + b4*tipo + b5*sabor+ b8* Price_fan[0.85, 1, 1.1, 1.2]/



U(alt3) = b9 + b2 * Cafeina + b3* origen + b4*tipo + b5 * sabor + b10* Price_shwep[0.9, 1, 1.15, 1.4]/



U(alt4) = b11 + b2 * Cafeina + b3* origen + b4*tipo + b5* sabor+ b12 * Price_pepsi[1.05, 1.15, 1.35, 1.5]/



U(alt5) = b13 +b2 * Cafeina + b3* origen + b4*tipo + b5 * sabor + b14 * Price_inca[0.90, 1.05, 1.15, 1.30]/



U(alt6) = b15+ b2 * Cafeina + b3* origen + b4*tipo + b5* sabor + b16 * Price_up[0.65, 0.85, 1, 1.15] $
Sameh
 
Posts: 15
Joined: Wed Nov 03, 2021 6:26 pm
Location: Spain

Re: Labelled design

Postby Michiel Bliemer » Thu Feb 06, 2025 9:52 pm

As I commented previously, "or level 5 should also appear in another alternative and you use a generic coefficient." Since in your script sabor=5 only appears in alt5 so that it cannot be separately identified from constant b13.

You need to formulate an identifiable choice model as otherwise Ngene cannot generate a design for it. Choice model identifiability is always tricky and I do not have all the answers either. I believe that each level of sabor needs to appear in at least 2 alternatives for model identifiability reasons, each level can likely not uniquely appear in a single alternative.

You may want to consider a different model formulation as in the script below. This script runs fine and still allows you to estimate all the parameters that you want, whereby b1 represents in fact the alternative-specific constants related to the brand/type. For model identifiability reasons, you MUST specify multiple levels for sabor in case of brand=5, OR you must allow sabor=5 in one of the other brands.

Code: Select all
Design

;alts = alt1 , alt2, none
;rows = 42
;block = 3 , minsum

;eff = (mnl,d)

;cond:
if(alt1.brand=1, alt1.sabor=[1,9,13]),
if(alt1.brand=2, alt1.sabor=[2,11,12]),
if(alt1.brand=3, alt1.sabor=[1,3,11]),
if(alt1.brand=4, alt1.sabor=[4,9,10]),
if(alt1.brand=5, alt1.sabor=[1,5]), ? I added another level (1) to make the model identifiable
if(alt1.brand=6, alt1.sabor=[6,7,8]),

if(alt2.brand=1, alt2.sabor=[1,9,13]),
if(alt2.brand=2, alt2.sabor=[2,11,12]),
if(alt2.brand=3, alt2.sabor=[1,3,11]),
if(alt2.brand=4, alt2.sabor=[4,9,10]),
if(alt2.brand=5, alt2.sabor=[1,5]), ? I added another level (1) to make the model identifiable
if(alt2.brand=6, alt2.sabor=[6,7,8]),

if(alt1.brand=[2,3,5,6], alt1.cafeina=1),

if(alt2.brand=[2,3,5,6], alt2.cafeina=1),

if(alt1.brand=1, alt1.price=[1,1.15,1.4,1.6]),
if(alt2.brand=1, alt2.price=[1,1.15,1.4,1.6])  ? et cetera...  Are these specific prices really necessary?

;model:

U(alt1) = b1.dummy[0|0|0|0|0]               * brand[1,2,3,4,5,6]
        + b2.dummy[0]                       * cafeina[1,2]
        + b3.dummy[0]                       * origen[1,2]
        + b4.dummy[0]                       * tipo[1,2]
        + b5.dummy[0|0|0|0|0|0|0|0|0|0|0|0] * sabor[1,2,3,4,5,6,7,8,9,10,11,12,13]
        + b6[0]                             * price[0.65,0.85,0.9,1,1.05,1.1,1.15,1.2,1.3,1.35,1.4,1.5,1.6]
        /
U(alt2) = b1                                * brand
        + b2                                * cafeina[1,2]
        + b3                                * origen[1,2]
        + b4                                * tipo[1,2]
        + b5                                * sabor
        + b6                                * price
$



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

Re: Labelled design

Postby Sameh » Thu Feb 06, 2025 11:02 pm

At least I no longer have the undefined D-error, but the D-error is still too high at 0.79.
Sameh
 
Posts: 15
Joined: Wed Nov 03, 2021 6:26 pm
Location: Spain

Re: Labelled design

Postby Michiel Bliemer » Fri Feb 07, 2025 7:22 am

Why do you think that? You cannot compare D-errors across studies.
The D-error looks fine to me, it always has a higher D-error when estimating so many dummy coded coefficients.
Michiel Bliemer
 
Posts: 1943
Joined: Tue Mar 31, 2009 4:13 pm


Return to Choice experiments - Ngene

Who is online

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