Page 1 of 2

Error in scenario in scenario with Bayesian design

PostPosted: Sat Mar 29, 2014 12:55 am
by tzruyac
Dear Ngene users,
I have ran the following labeled Bayesian efficient design (after conducting a pilot):
Design
;alts = small, large, optout
;rows=54
;block=9
;eff=(mnl,d)
;rep = 450
;rdraws=halton
;model:
U(small) = c2+ b4.dummy[(u, 1.96, 3.34)|(u, 2.34, 3.81)]*engagement[0,1,2]+ b5[(u,-0.01,-0.004)]*costA[3,4,5]/
U(large)= c3+ b4*engagement[engagement]+b5*costB[6,7,8]$

I received the following error: An attribute has the wrong number of levels for dummy or effects coding. 'engagement'
Any ideas what went wrong?
Best,
Tzruya

Re: Error in scenario in scenario with Bayesian design

PostPosted: Thu Apr 03, 2014 8:25 pm
by Andrew Collins
Hi Tzruya

At this stage, there is an incompatibility between the scenarios (e.g. engagement[engagement]), and dummy or effects coded variables. We will try and remove this restriction in the next point release.

An alternative might be to use the reject command to ensure that the engagement levels remain the same. When using this, you might want to specify attribute level frequency ranges to keep a reasonable balance of attribute levels, although this should be achieved naturally with dummy coded attributes.

I don't have Ngene with me just now to test the syntax, but you could try the following:

Code: Select all
Design
;alts = small, large, optout
;rows=54
;block=9
;eff=(mnl,d)
;rep = 450
;rdraws=halton
;reject:
small.engagement<>large.engagement
;alg=mfederov
;model:
U(small) = c2 + b4.dummy[(u, 1.96, 3.34)|(u, 2.34, 3.81)]*engagement[0,1,2] + b5[(u,-0.01,-0.004)]*costA[3,4,5](16-20,16-20,16-20) /
U(large) = c3 + b4*engagement[0,1,2]                                        + b5*costB[6,7,8](16-20,16-20,16-20)
$


I should be able to check this tomorrow, but let me know if it works in the meantime.

Andrew

Re: Error in scenario in scenario with Bayesian design

PostPosted: Mon Apr 07, 2014 8:45 am
by Andrew Collins
An update on my last post. The reject approach will not work with so many design rows/choice sets, because the total candidate set for modified Federov algorithm will be smaller than the number of rows specified. In the code below, I cut the number of rows back to 18, and retained the blocking into 6 rows per block.

Code: Select all
Design
;alts=small, large, optout
;rows=18
;block=3
;eff=(mnl,d)
;rep=450
;rdraws=halton
;reject:
small.engagement<>large.engagement
;alg=mfederov
;model:
U(small) = c2 + b4.dummy[(u, 1.96, 3.34)|(u, 2.34, 3.81)]*engagement[0,1,2] + b5[(u,-0.01,-0.004)]*costA[3,4,5](5-7,5-7,5-7) /
U(large) = c3 + b4*engagement                                               + b5*costB[6,7,8](5-7,5-7,5-7)
$


Andrew

Re: Error in scenario in scenario with Bayesian design

PostPosted: Wed Apr 16, 2014 8:18 am
by tzruyac
Dear Andrew,
Thank you very much for your replies! Actually the first code worked perfectly though I never used the this type of programming (16-20,16-20,16-20), and I'll be happy to know what it stands for (I did not find in the manual)
The question I still have is does it possible to attach different cost levels to each engagement type that is being employed (1,2 and 3) here, is this possible?
This is the code I run:
Design
;alts = small, large, optout
;rows=48
;block=8
;eff=(mnl,d)
;rep = 450
;rdraws=halton
;reject:small.engagement<>large.engagement
;alg=mfederov
;model:
U(small) = c2[0.08]+ b1.dummy[(n,2.7, 0.214)|(n, 3.6, 0.141)]*engagement[1,2,3]+b2[(n,-0.008,0.0004)]*cost[20,40,80](16-20,16-20,16-20)+b3.dummy[(n,-0.11,0.00017)]*nolocal[1,0]/
U(large) = c3[0.05]+ b1*engagement + b2*cost[20,40,80](16-20,16-20,16-20)+b3*nolocal $

Thanks much,
Tzruya

Re: Error in scenario in scenario with Bayesian design

PostPosted: Wed Apr 16, 2014 10:00 am
by tzruyac
Hi again,
I tried to figure out my self how to solve the question I asked in my last post (it possible to attach different cost levels to each engagement type that is being employed (1,2 and 3) here, by running this design. since I am running a "scenario in scenario" type of design in which the engagement type remains fix along each menu, and each engagement type entails different cost ranges. I added two more cost attributes with the same cost parameter (b2) to each raw in the following manner, but the software shut down when I run it. any ideas? maybe the is a simpler way to do it?
Thanks Tzruya

Design
;alts = small, large, optout
;rows=18
;block=3
;eff=(mnl,d)
;rdraws=halton
;reject:small.engagement<>large.engagement
;alg=mfederov
;model:
U(small) = c2[0.08]+ b1.dummy[(n,2.7, 0.214)|(n, 3.6, 0.141)]*engagement[1,2,3]+b2[(n,-0.008,0.0004)]*costA[70,120,150](5-7,5-7,5-7)+b2*costB[8,13,18](5-7,5-7,5-7)+b2*costC[40,55,70](5-7,5-7,5-7)+b3.dummy[(n,-0.11,0.00017)]*nolocal[1,0]/
U(large) = c3[0.05]+ b1*engagement + b2*costt[200,300,400](5-7,5-7,5-7)+b2*costtt[15,25,24](5-7,5-7,5-7)+b2*costttt[100,120,150](5-7,5-7,5-7)+b3*nolocal $

Re: Error in scenario in scenario with Bayesian design

PostPosted: Thu Apr 17, 2014 6:27 pm
by Andrew Collins
The problem with the syntax you have posted is that the parameters are entering multiple times per alternative.

I have found a way to do it. It is not simple, and I am actually very surprised any design could be generated at all with all the constraints, but try the code below. I changed one of the costs to 71, as each level can be specified only once. But you could change back to 70 and update the reject statement appropriately. Basically this approach is specifying all possible levels for cost, with attribute frequency ranges which limit the number of times each level appears (the round brackets), in this case to force each level to appear at least once. Any row that has an inappropriate cost for that scenario is rejected.

Andrew

Code: Select all
Design
;alts = small, large, optout
;rows=18
;block=3
;eff=(mnl,d)
;rdraws=halton
;reject:
small.engagement<>large.engagement,

small.engagement=1 and small.costA=8,
small.engagement=1 and small.costA=13,
small.engagement=1 and small.costA=18,
small.engagement=1 and small.costA=40,
small.engagement=1 and small.costA=55,
small.engagement=1 and small.costA=71,

small.engagement=2 and small.costA=70,
small.engagement=2 and small.costA=120,
small.engagement=2 and small.costA=150,
small.engagement=2 and small.costA=40,
small.engagement=2 and small.costA=55,
small.engagement=2 and small.costA=71,

small.engagement=3 and small.costA=70,
small.engagement=3 and small.costA=120,
small.engagement=3 and small.costA=150,
small.engagement=3 and small.costA=8,
small.engagement=3 and small.costA=13,
small.engagement=3 and small.costA=18,

large.engagement=1 and large.costB=15,
large.engagement=1 and large.costB=25,
large.engagement=1 and large.costB=24,
large.engagement=1 and large.costB=100,
large.engagement=1 and large.costB=120,
large.engagement=1 and large.costB=150,

large.engagement=2 and large.costB=200,
large.engagement=2 and large.costB=300,
large.engagement=2 and large.costB=400,
large.engagement=2 and large.costB=100,
large.engagement=2 and large.costB=120,
large.engagement=2 and large.costB=150,

large.engagement=3 and large.costB=200,
large.engagement=3 and large.costB=300,
large.engagement=3 and large.costB=400,
large.engagement=3 and large.costB=15,
large.engagement=3 and large.costB=25,
large.engagement=3 and large.costB=24

;alg=mfederov
;model:
U(small) = c2[0.08] +
           b1.dummy[(n,2.7, 0.214)|(n, 3.6, 0.141)]*engagement[1,2,3] +
           b2[(n,-0.008,0.0004)]*costA[70,120,150,8,13,18,40,55,71](1-3,1-3,1-3,1-3,1-3,1-3,1-3,1-3,1-3) +
           b3.dummy[(n,-0.11,0.00017)]*nolocal[1,0] /
U(large) = c3[0.05] +
           b1*engagement +
           b2*costB[200,300,400,15,25,24,100,120,150](1-3,1-3,1-3,1-3,1-3,1-3,1-3,1-3,1-3) +
           b3*nolocal
$

Re: Error in scenario in scenario with Bayesian design

PostPosted: Fri Apr 18, 2014 3:13 am
by tzruyac
Hi Andrew,thanks much!
I've tried the design, yet it retrieved the following error massage: Error in Command 1: Unexpected command ';alg=neldermead' or missing a main command such as 'Design'.

I actually run a shorter code since there are only 3 cost level for each engagement type for each system size, this is what I ran, and ideas?
Tzruya
Design
;alts = small, large, optout
;rows=18
;block=3
;eff=(mnl,d)
;rdraws=halton
;reject:
small.engagement<>large.engagement,
small.engagement=3 and small.costA=70,
small.engagement=3 and small.costA=120,
small.engagement=3 and small.costA=150,

small.engagement=1 and small.costA=8,
small.engagement=1 and small.costA=13,
small.engagement=1 and small.costA=18,

small.engagement=2 and small.costA=40,
small.engagement=2 and small.costA=55,
small.engagement=2 and small.costA=71,

large.engagement=1 and large.costB=200,
large.engagement=1 and large.costB=300,
large.engagement=1 and large.costB=400,

large.engagement=2 and large.costB=15,
large.engagement=2 and large.costB=25,
large.engagement=2 and large.costB=35,

large.engagement=3 and large.costB=100,
large.engagement=3 and large.costB=120,
large.engagement=3 and large.costB=150
;alg=mfederov
;model:
U(small) = c2[0.08] +
b1.dummy[(n,2.7, 0.214)|(n, 3.6, 0.141)]*engagement[1,2,3] +
b2[(n,-0.008,0.0004)]*costA[70,120,150,8,13,18,40,55,71](1-3,1-3,1-3,1-3,1-3,1-3,1-3,1-3,1-3) +
b3.dummy[(n,-0.11,0.00017)]*nolocal[1,0] /
U(large) = c3[0.05] +
b1*engagement +
b2*costB[200,300,400,15,25,24,100,120,150](1-3,1-3,1-3,1-3,1-3,1-3,1-3,1-3,1-3) +
b3*nolocal $

Re: Error in scenario in scenario with Bayesian design

PostPosted: Tue Apr 22, 2014 11:05 am
by Michiel Bliemer
Hi Tzruya, I am posting through Michiel as there is currently an issue with the forum affecting some users.

I have no problems running the design that you have posted. Make sure that the entire syntax is highlighted, or alternatively that there is no other syntax in the syntax window if you are not highlighting what you want to run. Also check that you are running version 1.1.1, if you are not, best upgrade (point releases are free).

Also, be careful with the constraints, as they are reject commands. So for each engagement level, if you reject three cost levels, you have 6 remaining for that engagement level. My understanding was that you wanted three remaining, but I may have misread.

Andrew

Re: Error in scenario in scenario with Bayesian design

PostPosted: Wed Apr 23, 2014 1:26 am
by tzruyac
Hi Andrew,
Yes for some reason it did worked now! I'm so glad, this is a great solution for many of my designs...
Last thing..your understanding was right - I wanted the three remaining levels.
So just to be by writing :
;reject:
small.engagement<>large.engagement,

small.engagement=1 and small.costA=8,
small.engagement=1 and small.costA=13,
small.engagement=1 and small.costA=18,
small.engagement=1 and small.costA=40,
small.engagement=1 and small.costA=55,
small.engagement=1 and small.costA=71,
it actually "tell" the software that if engagement type 1 is assigned to the labeled alt. small DON NOT USE the levels 8,13,....55.71 ???
is that correct?
Many Thanks
Tzruya

Re: Error in scenario in scenario with Bayesian design

PostPosted: Wed Apr 23, 2014 8:56 am
by Michiel Bliemer
I can confirm that is indeed what the reject command will do, if engagement = 1, then costA cannot be 8, 13, 18, etc.