Include conmtratints on one level of a given attribute

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

Include conmtratints on one level of a given attribute

Postby NormaB » Thu Jul 27, 2023 10:20 am

Hi, I need help with my utility specification, to create constraints on just one level of a given attribute.
This is my syntax
design
;alts = alt1*, alt2*
;rows = 36
;eff =(mnl,d)
;block = 4
;model:
U(alt1)= b1.dummy[0|0|0]*test[1,2,3,4] + b2.dummy[0|0|0]*risk[1,5,20,50] + b3*cost[0,50,200] + b4.dummy[0|0]*time[1,2,3] + b5*dist[1,2,3] /
U(alt2)= b1.dummy[0|0|0]*test[1,2,3,4] + b2.dummy[0|0|0]*risk[1,5,20,50] + b3*cost[0,50,200] + b4.dummy[0|0]*time[1,2,3] + b5*dist[1,2,3]

$

But for test 1, the risk level should be set to 1,5, 20 only. All other attributes are the same for all four tests.
How do I do that?
Thank you.
NormaB
 
Posts: 7
Joined: Fri Jul 23, 2021 9:16 pm

Re: Include conmtratints on one level of a given attribute

Postby Michiel Bliemer » Fri Jul 28, 2023 8:51 am

You can use the ;cond property, see script below.

Code: Select all
design
;alts = alt1*, alt2*
;rows = 36
;eff =(mnl,d)
;block = 4
;cond:
if(alt1.test = 1, alt1.risk = [1,5,20]),
if(alt2.test = 1, alt2.risk = [1,5,20])
;model:
U(alt1)= b1.dummy[0|0|0]*test[1,2,3,4] + b2.dummy[0|0|0]*risk[1,5,20,50] + b3*cost[0,50,200] + b4.dummy[0|0]*time[1,2,3] + b5*dist[1,2,3] /
U(alt2)= b1.dummy[0|0|0]*test[1,2,3,4] + b2.dummy[0|0|0]*risk[1,5,20,50] + b3*cost[0,50,200] + b4.dummy[0|0]*time[1,2,3] + b5*dist[1,2,3]
$


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

Re: Include constraints on one level of a given attribute

Postby NormaB » Fri Jul 28, 2023 9:27 am

Hi Michiel,
thank you very much.
Kind regards
Norma
NormaB
 
Posts: 7
Joined: Fri Jul 23, 2021 9:16 pm

Re: Include conmtratints on one level of a given attribute

Postby NormaB » Wed Aug 09, 2023 9:30 pm

Hi Michiel,
I have included the following constraints in my model but I keep getting scenarios comparing the same test, although with different levels of the remaining attributes.
What could be wrong in my syntax? I have run it over three days but get the same challenge.

design
;alts = alt1*, alt2*
;rows = 36
;eff =(mnl,d)
;block = 4
;cond:
if(alt1.test = 1, alt1.risk = [1,5,20]),
if(alt2.test = 1, alt2.risk = [1,5,20]),
if(alt1.test = 1, alt1.time = [3]),
if(alt2.test = 1, alt2.time = [3]),
if(alt1.test = 2, alt1.time = [2,3]),
if(alt2.test = 2, alt2.time = [2,3]),
if(alt1.test = 4, alt1.time = [2]),
if(alt2.test = 4, alt2.time = [2]),
if(alt1.test = 3, alt1.time = [1,2]),
if(alt2.test = 3, alt2.time = [1,2])
;model:
U(alt1)= b1.dummy[0|0|0]*test[1,2,3,4] + b2.dummy[0|0|0]*risk[1,5,20,50] + b3*cost[0,50,200] + b4.dummy[0|0]*time[1,2,3] + b5*dist[1,2,3] /
U(alt2)= b1.dummy[0|0|0]*test[1,2,3,4] + b2.dummy[0|0|0]*risk[1,5,20,50] + b3*cost[0,50,200] + b4.dummy[0|0]*time[1,2,3] + b5*dist[1,2,3]
$
NormaB
 
Posts: 7
Joined: Fri Jul 23, 2021 9:16 pm

Re: Include conmtratints on one level of a given attribute

Postby Michiel Bliemer » Thu Aug 10, 2023 9:49 am

Hi Norma,

I do not see anything wrong with your script or with your design. Could you please clarify what you mean with "I keep getting scenarios comparing the same test"?

Below is the design that I got after a few minutes running the script.

https://www.dropbox.com/scl/fi/fmyxzkwl69vrn3mckv1b3/design_NormaB.png?rlkey=cbcgux0469hfc2gyi0r03g252&dl=0

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

Re: Include conmtratints on one level of a given attribute

Postby NormaB » Thu Aug 10, 2023 10:53 pm

Hi Michiel,
this is the same kind of output am getting, but for scenario 1 and 34,
atl1.test =3 and alt2.test = 3.
This means I would be comparing the same type of test.
The type of tests are 1, 2, 3 and 4.
In this case the respondent would just choose one with better attribute level yet the aim is to compare the different tests.
That is what I do not understand.
NormaB
 
Posts: 7
Joined: Fri Jul 23, 2021 9:16 pm


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 32 guests