Page 1 of 2
Estimation when using dummy coding in efficient design
Posted: Wed Jun 03, 2015 1:08 am
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
Re: Estimation when using dummy coding in efficient design
Posted: Wed Jun 03, 2015 1:50 am
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
Re: Estimation when using dummy coding in efficient design
Posted: Wed Jun 03, 2015 10:22 am
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.
Re: Estimation when using dummy coding in efficient design
Posted: Wed Jun 03, 2015 5:43 pm
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!
Re: Estimation when using dummy coding in efficient design
Posted: Wed Jun 03, 2015 6:25 pm
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.
Re: Estimation when using dummy coding in efficient design
Posted: Thu Jun 04, 2015 2:14 pm
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.
Re: Estimation when using dummy coding in efficient design
Posted: Thu Jun 04, 2015 3:38 pm
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.
Re: Estimation when using dummy coding in efficient design
Posted: Fri Jun 05, 2015 11:33 am
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!
Re: Estimation when using dummy coding in efficient design
Posted: Fri Jun 05, 2015 1:44 pm
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
Re: Estimation when using dummy coding in efficient design
Posted: Mon Jun 08, 2015 11:30 am
by Yuanyuan Gu
Hi Andrew many thanks for your reply!