Include conmtratints on one level of a given attribute
Posted:
Thu Jul 27, 2023 10:20 am
by NormaB
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.
Re: Include conmtratints on one level of a given attribute
Posted:
Fri Jul 28, 2023 8:51 am
by Michiel Bliemer
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
Re: Include constraints on one level of a given attribute
Posted:
Fri Jul 28, 2023 9:27 am
by NormaB
Hi Michiel,
thank you very much.
Kind regards
Norma
Re: Include conmtratints on one level of a given attribute
Posted:
Wed Aug 09, 2023 9:30 pm
by NormaB
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]
$
Re: Include conmtratints on one level of a given attribute
Posted:
Thu Aug 10, 2023 9:49 am
by Michiel Bliemer
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=0Michiel
Re: Include conmtratints on one level of a given attribute
Posted:
Thu Aug 10, 2023 10:53 pm
by NormaB
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.