Estimation when using dummy coding in efficient design

This forum is for posts that specifically focus on the Windows desktop version of Ngene (i.e. all version 1.x releases).

Moderators: Andrew Collins, Michiel Bliemer, johnr

Yuanyuan Gu
Posts: 12
Joined: Wed May 06, 2015 10:33 pm

Estimation when using dummy coding in efficient design

Post by Yuanyuan Gu »

Dear Michiel

I generated an efficient design using dummy coding for all attributes; see below:

Design
;alts = alt1, alt2
;rows = 16
;eff = (mnl, d)
;block = 2
;model:
U(alt1) = b1.dummy[0|0|0|0|0|0|0]*A[0,1,2,3,4,5,6,7] + b2.dummy[0|0|0]*B[0,1,2,3] + b3.dummy[0|0|0]*C[0,1,2,3]/
U(alt2) = b1*A + b2*B + b3*C$

We know that it would definately work if we estimate a model with all attributes dummy coded but I wonder

(1) if it is OK to estimate a model where some attributes (e.g., A) are continuous;

(2) and if yes, can we also test the functional form for A? For example, to include both A and A^2 in the regression?

Many thanks,
Yuanyuan
johnr
Posts: 172
Joined: Fri Mar 13, 2009 7:15 am

Re: Estimation when using dummy coding in efficient design

Post by johnr »

Hi Yuanyuan

Once you have located the design, you can save it and evaluate its performance under different scenarios. Hence, you can generate the design under the dummy coded assumption, save it, and then rewrite the utility functions under the assumption it will be linear coded. You use the ;eval = command to test how it would perform under this scenario. To test the square of the attribute, you can square the levels manually and test using the same syntax (but changing the priors suitably - assuming they are non zero).

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

Re: Estimation when using dummy coding in efficient design

Post by Michiel Bliemer »

Or you can do something more exotic like:

Code: Select all

Design
;alts(m1) = alt1, alt2
;alts(m2) = alt1, alt2
;rows = 16
;eff = m1(mnl, d) + 2*m2(mnl,d)
;block = 2
;model(m1):
U(alt1) = b1.dummy[0|0|0|0|0|0|0]*A[0,1,2,3,4,5,6,7] + b2.dummy[0|0|0]*B[0,1,2,3] + b3.dummy[0|0|0]*C[0,1,2,3]/
U(alt2) = b1*A + b2*B + b3*C 
;model(m2):
U(alt1) = b1a*A[0,1,2,3,4,5,6,7] + b2.dummy[0|0|0]*B[0,1,2,3] + b3.dummy[0|0|0]*C[0,1,2,3] + b4*A*A/
U(alt2) = b1a*A + b2*B + b3*C + b4*A*A
$
This will optimise on both models simulaneously.
Yuanyuan Gu
Posts: 12
Joined: Wed May 06, 2015 10:33 pm

Re: Estimation when using dummy coding in efficient design

Post by Yuanyuan Gu »

Many thanks John and Michiel. Your suggestions are very helpful.

If I want to enter all attributes in the utility function using their log form (i.e., to specify a multiplicative utility function), how do I write the code?

Many thanks!
Last edited by Yuanyuan Gu on Wed Jun 03, 2015 6:27 pm, edited 1 time in total.
Michiel Bliemer
Posts: 2057
Joined: Tue Mar 31, 2009 4:13 pm

Re: Estimation when using dummy coding in efficient design

Post by Michiel Bliemer »

Easy, just replace the levels in the attribute with their respective transformation. So instead of log(C[1,2,3]) you use C[0,0.693,1.098]. Note that log(0) is minus infinity so cannot be used.

Ngene does not recognise the 'log' operator, but the easy trick describe above works for your purpose.
Yuanyuan Gu
Posts: 12
Joined: Wed May 06, 2015 10:33 pm

Re: Estimation when using dummy coding in efficient design

Post by Yuanyuan Gu »

Thanks Michiel!

I have a quite silly question but I have been quite confused about what is the correct way to specify the attribute levels in Ngene.

Suppose I have an attribute 'cost' which has four levels: 10, 50, 100, 200

In terms of dummy coding, shall I specify it this way:

(A)
Design
;alts = alt1, alt2
;rows = 16
;eff = (mnl,d)
;block = 2
;model:
U(alt1) = b1.dummy[0|0|0]*cost[0,1,2,3] + b2.dummy[0|0|0]*B[0,1,2,3]/
U(alt2) = b1*cost + b2*B$

or

(B)
Design
;alts = alt1, alt2
;rows = 16
;eff = (mnl,d)
;block = 2
;model:
U(alt1) = b1.dummy[0|0|0]*cost[10,50,100,200] + b2.dummy[0|0|0]*B[0,1,2,3]/
U(alt2) = b1*cost + b2*B$

Or (A) and (B) lead to the same design?

And if I want to model cost as a continuous variable, which of the following is correct?

(C)
Design
;alts = alt1, alt2
;rows = 16
;eff = (mnl,d)
;block = 2
;model:
U(alt1) = b1*cost[0,1,2,3] + b2.dummy[0|0|0]*B[0,1,2,3]/
U(alt2) = b1*cost + b2*B$

or

(D)
Design
;alts = alt1, alt2
;rows = 16
;eff = (mnl,d)
;block = 2
;model:
U(alt1) = b1*cost[10,50,100,200] + b2.dummy[0|0|0]*B[0,1,2,3]/
U(alt2) = b1*cost + b2*B$

Or (C) and (D) are both OK?

Thanks again for your help.
Michiel Bliemer
Posts: 2057
Joined: Tue Mar 31, 2009 4:13 pm

Re: Estimation when using dummy coding in efficient design

Post by Michiel Bliemer »

(A) and (B) will generate the same efficient design, but in your output you would see levels 0,1,2,3 in case (A) and 10,50,100,200 in case (B). Since you are showing 10,50,100,200 to respondents, it is easier for your interpretation to use syntax (B), but all these levels are converted to zeros and ones in dummy coding, so for the efficiency it does not matter.

In case you are using linear coding, you HAVE to use the real values, so only syntax (D) is correct.

To summarise: simply always use the levels that you are showing to the respondent, then you never make a mistake.
Yuanyuan Gu
Posts: 12
Joined: Wed May 06, 2015 10:33 pm

Re: Estimation when using dummy coding in efficient design

Post by Yuanyuan Gu »

Thanks Michiel. I followed your suggestion and used the actual attribute levels in my code but found something strange when I included interaction terms:

When the levels are greater than one, adding interactions would work, e.g.,

Design
;alts = alt1, alt2
;rows = 16
;eff = (mnl,d)
;block = 2
;model:
U(alt1) = b1.dummy[0|0|0]*cost[10,50,100,200] + b2.dummy[0|0|0]*B[0,1,2,3] + i1*cost.dummy[10]*B.dummy[0]/
U(alt2) = b1*cost + b2*B + i1*cost.dummy[10]*B.dummy[0]$

However, when the levels are less than one, adding interactions caused error, e.g.,

Design
;alts = alt1, alt2
;rows = 16
;eff = (mnl,d)
;block = 2
;model:
U(alt1) = b1.dummy[0|0|0]*cost[0.1,0.5,1,2] + b2.dummy[0|0|0]*B[0,1,2,3] + i1*cost.dummy[0.1]*B.dummy[0]/
U(alt2) = b1*cost + b2*B + i1*cost.dummy[0.1]*B.dummy[0]$

Do you know why this happened?

Thanks!
Andrew Collins
Posts: 77
Joined: Sat Mar 28, 2009 4:48 pm

Re: Estimation when using dummy coding in efficient design

Post by Andrew Collins »

Hi Yuanyuan

There is a syntax parsing bug that preventing the second syntax from being loaded into Ngene. We will have this fixed in the next point release. Since in that syntax you are referencing a dummy coded attribute, it will not be necessary to use the exact attribute levels.

Andrew
Yuanyuan Gu
Posts: 12
Joined: Wed May 06, 2015 10:33 pm

Re: Estimation when using dummy coding in efficient design

Post by Yuanyuan Gu »

Hi Andrew many thanks for your reply!
Post Reply