Designs with if-and-only-if constraints

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

Designs with if-and-only-if constraints

Postby paulm » Tue Mar 03, 2015 5:28 am

Hi all,

I'm wondering how to create designs with a particular type of constraint in Ngene. Here is a example of what I'd like to do:
Consider a design with 2 discrete attributes, a and b. Each of a and b has 4 levels. I want to impose the following constraint.
;cond:
if (alt1.a < 4, alt1.b < 4)
if (alt1.a = 4, alt1.b = 4)

That is, whenever a = 4, b =4 and whenever a <> 4, b <>4. Now, you will tell me that such a model is not identified. And I would respond that certainly I know that. We typically estimate it by creating one dummy variable for the condition where both attributes are equal to 4. That is, the dummy = 1 when both attributes = 4 and 0 otherwise. Then we parameterize the remaining levels as if they were 3-level effects coded - so two variables each, except they are all 0 when the dummy = 1. For our two four level variables here, that would be 5 variables in total, 1 dummy for the 4th level, 2 effects coded variables for levels 1-3 of attribute a and 2 effects coded variables for levels 1-3 of attribute b.

My question is: how do we specify these variables in Ngene. How do we set priors for them? How do we enter them in the utility equation?

Thanks much,
Paul
paulm
 
Posts: 25
Joined: Wed Jan 09, 2013 3:51 am

Re: Designs with if-and-only-if constraints

Postby Michiel Bliemer » Wed Mar 04, 2015 1:12 pm

Do you mean something like this?

Code: Select all
design
;alts = alt1, alt2
;rows = 8
;eff = (mnl,d)
;model:
U(alt1) = b1.dummy[0.1|0.2|0.3] * A[1,2,3,4] + b2.dummy[0.2|0.4|0.5] * B[1,2,3,4] + b3[0.1] * A.dummy[4] * B.dummy[4]
$
Michiel Bliemer
 
Posts: 1733
Joined: Tue Mar 31, 2009 4:13 pm

Re: Designs with if-and-only-if constraints

Postby paulm » Wed Mar 04, 2015 3:10 pm

Partly. I don't think it will run with this:

design
;alts = alt1, alt2
;rows = 8
;eff = (mnl,d)
;cond:
if (alt1.a < 4, alt1.b <4),
if (alt1.a = 4, alt1.b = 4)
;model:
U(alt1) = b1.dummy[0.1|0.2|0.3] * A[1,2,3,4] + b2.dummy[0.2|0.4|0.5] * B[1,2,3,4] + b3[0.1] * A.dummy[4] * B.dummy[4]
$

Once you add in the constraint, you can't estimate all three parameters of b1.dummy and b2.dummy anymore. You have a 4x4 matrix with 9 cells knocked out across the two attributes. So you can't estimate all these parameters; they aren't identified. What I need is a specification where there are only b1.dummy[0.1| 0.2| 0|NA] where the 4th level is explicitly excluded and the 3rd level is the new reference category.

Would this work:
;cond:
if (alt1.c = 1, alt1.a = 0),
if (alt1.c = 1, alt1.b = 0)
;model:
U(alt1) = b1.dummy[0.1|0.2]*a[1,2,3] + b2.dummy[0.1|0.2]*b[1,2,3] + b3.dummy[0.4]*c[1,0]
$

or this:
;model:
U(alt1) = b1.dummy[0.1|0.2]*c.dummy[2]*a[1,2,3] + b2.dummy[0.1|0.2]*c.dummy[2]*b[1,2,3] + b3.dummy[0.4]*c[1,2]
$

Maybe that works with no constraint? Have I just answered my own question?
paulm
 
Posts: 25
Joined: Wed Jan 09, 2013 3:51 am

Re: Designs with if-and-only-if constraints

Postby Michiel Bliemer » Wed Mar 04, 2015 4:08 pm

I am having problems understanding how you could estimate a dummy coded variable while the base variable does not appear as a main effect. Are you sure you can estimate such a model? The two syntaxes that you provide set the last level to zero, so that is not what you want I think.

All I can think of is doing something like:

;cond:
if(alt1.a1 + alt1.a2 + alt1.a3 + alt1.b1 + alt1.b2 + alt1.b3 = 0, alt1.c = 1)
U(alt1) = b1 * a1[0,1] + b2 * a2[0,1] + b3 * a3[0,1] + b4 * b1[0,1] + b5 * b2[0,1] + b6 * b3[0,1] + b7 * c[0,1]\

This is not exactly what you want, but perhaps it gives you an idea. But I do not quite understand your utility function. So perhaps the question first is to make sure that the utility function that you are suggesting is estimable.
Michiel Bliemer
 
Posts: 1733
Joined: Tue Mar 31, 2009 4:13 pm

Re: Designs with if-and-only-if constraints

Postby Michiel Bliemer » Thu Mar 05, 2015 2:49 pm

I tried the following:

Code: Select all
design
;alts = alt1, alt2
;rows = 8
;eff = (mnl,d)
;alg = mfederov
;reject:
alt1.A = 1 and alt1.B = 4,
alt1.A = 2 and alt1.B = 4,
alt1.A = 3 and alt1.B = 4,
alt1.B = 1 and alt1.A = 4,
alt1.B = 2 and alt1.A = 4,
alt1.B = 3 and alt1.A = 4
;model:
U(alt1) = b1.dummy[0|0|0] * A[1,2,3,4] + b2.dummy[0|0|0] * B[1,2,3,4] + b3[0] * A.dummy[4] * B.dummy[4]
$


This indicates that this model is not estimable.

I also tried the following:

Code: Select all
design
;alts = alt1, alt2
;rows = 8
;eff = (mnl,d)
;cond:
if(alt1.A = 4, alt1.B = 4),
if(alt1.B = 4, alt1.A = 4)
;model:
U(alt1) = b1.dummy[0|0|0] * A[1,2,3,4] + b2.dummy[0|0|0] * B[1,2,3,4] + b3[0] * A.dummy[4] * B.dummy[4]
$


This model is also not possible to estimate.

So I believe you can do in Ngene what you want, but I think the utility functions that you would like to estimate are not properly defined and therefore it will not work.
Michiel Bliemer
 
Posts: 1733
Joined: Tue Mar 31, 2009 4:13 pm

Re: Designs with if-and-only-if constraints

Postby paulm » Sat Mar 21, 2015 12:50 am

Thank you. The fact that the utility function, as written, is not estimable is exactly the problem.

Let me give an example and make it more clear what I want to do. Since many readers here work in transportation, I'll give an example that may be slightly relevant.

Suppose you want to design a new rail program. In additon to schedule, distance, travel time and other attributes you would normally test, you have the idea to test a loyalty program. This loyalty program has two components, how you get points and what they can be used for. The loyalty program may or may not be offered at all. Because there are two components, it takes two attributes to describe it.

Attribute 1: how you earn points.
level 1: distance traveled
level 2: trips taken
level 3: dollars spent
level 4: no loyalty program
Attribute 2: how you use points.
level 1: guaranteed parking
level 2: preferred parking (designated spaces)
level 3: discounted parking
level 4: no loyalty program

The constraint is that either both attributes are level 4, "no loyalty proogram" or neither is. That's what we want to design.

Of course, the full model is not estimable. So we need to alter the utility function. We create a dummy where 1 = no loyalty program and 0 = anything else. Then we effects code the two attributes as if they were 3-levels each, with level 3 the reference. In the situation where each is level 4, those effects-coded variables are set to 0. This formulation of a utility function is consistent with our model and can be estimated. But there is no way to tell Ngene about that utility function, no way to set priors for parameters, and therefore no way that I know of to create an efficient design for it.

Unless I'm missing a design trick...

Paul
paulm
 
Posts: 25
Joined: Wed Jan 09, 2013 3:51 am

Re: Designs with if-and-only-if constraints

Postby Michiel Bliemer » Sat Mar 21, 2015 7:52 am

It looks like a very tricky thing to do, but I gave it a try. The syntax below I believe replicates your wishes. I am using a dummy model to introduce the effects coded attributes B and C (which do not enter the main model), and in the main model I only include interactions in which B > 0 and C > 0. This model is estimable if I do not include constraints. However, when imposing constraints, I again am not able to estimate the model.

Code: Select all
design
;alts(dummy) = alt1, alt2
;alts(main) = alt1, alt2
;rows = 20
;eff = main(mnl,d)
;cond:
if(alt1.A = 0, alt1.B = 0),
if(alt1.A = 0, alt1.C = 0),
if(alt1.B = 0, alt1.A = 0),
if(alt1.C = 0, alt1.A = 0),
if(alt2.A = 0, alt2.B = 0),
if(alt2.A = 0, alt2.C = 0),
if(alt2.B = 0, alt2.A = 0),
if(alt2.C = 0, alt2.A = 0)
;model(dummy):
U(alt1) = b1[0.3] * A[0,1] + b2.effects[0.1|0.2|0.3] * B[1,2,3,0] + b3.effects[0.4|0.5|0.6] * C[1,2,3,0] /
U(alt2) = b1 * A + b2 * B + b3 * C
;model(main):
U(alt1) = b1[0.3] * A[0,1] + b2_1[0.1] * A * B.effects[1] + b2_2[0.2] * A * B.effects[2] + b2_3[0.3] * A * B.effects[3] + b3_1[0.4] * A * C.effects[1] + b3_2[0.5] * A * C.effects[2] + b3_3[0.6] * A * C.effects[3] /
U(alt2) = b1[0.3] * A[0,1] + b2_1[0.1] * A * B.effects[1] + b2_2[0.2] * A * B.effects[2] + b2_3[0.3] * A * B.effects[3] + b3_1[0.4] * A * C.effects[1] + b3_2[0.5] * A * C.effects[2] + b3_3[0.6] * A * C.effects[3]
$


Could you perhaps provide the exact model you would estimate and provide some data that you have been able to estimate the model with? By looking at the data and the utility function perhaps I get more ideas.

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


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 27 guests

cron