## Bayesian design

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

### Bayesian design

Dear Ngene team,

I am currently working on a new consumer survey that will include a CE. I would like to use a Bayesian design.
As a first step, following the indications in the manual and those that I found in this forum I run a d-efficient design based on a mnl model, setting all priors equal to zero. This is because I cannot really guess about the direction of the attribute levels, except for price which is expected to be negative. Using the sintax below I obtained a d-error equal to 0.345, which I suppose (please correct me if I am wrong!) may be good enough for a pilot survey.

Design
;alts = alt1, alt2, alt3
;rows = 28
;block = 4
;eff = (mnl,d)
;model:
U(alt1)= b1[0]*price[0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69] + b2.dummy[0|0|0]*Plastic[0,1,2,3] + b3[0]*Colour[0,1]/
U(alt2)= b1*Price + b2.dummy*Plastic + b3*Colour
\$

However, I was wondering whether, in this phase, it would be better to use uninformed Bayesian priors with uniform distribution e.g., [(u, 0, 1)] (assuming that attribute levels would have the same impact on the utility) instead of setting priors equal to zero.
Furthermore, since I cannot refer to the S-estimate how can I establish the proper number of respondents for the pilot test in order to obtain reliable priors for the final Bayesian design?
Thank you very much for your help.
Eli
eliD

Posts: 6
Joined: Thu Mar 30, 2017 2:17 am

### Re: Bayesian design

Hi Eli,

The actual value of the D-error does not have much meaning, so it is not possible to say whether 0.345 is good or bad, all we know is the lower the better, but what is achievable depends entirely on the study (sometimes 0.1 is bad, in other cases 0.1 is very good). I think that your syntax looks fine.

Using priors equal to zero or using Bayesian priors around zero (or constrained with a sign as you indicate) are both fine. I generally have a preference for Bayesian priors since it makes the design more robust, but without any information from a pilot study it is sometimes a bit difficult to set the priors. If you know the design you could indeed use (u,0,1) and if you do not know the sign you could use for example (n,0,1).

Without informative priors you cannot determine an appropriate sample size for the pilot study. Most people keep the sample size for a pilot study relatively small. It is not necessary that all parameters can be estimated with a high level of significance based on the pilot study, you simply insert them as Bayesian priors with uncertainty. So if the parameter estimate for b1 is 0.5 and its standard error is 0.7 (i.e., it is not statistically significant), then you use as Bayesian prior (n,0.5,0.7) when generating a design for your main study.

Michiel
Michiel Bliemer

Posts: 610
Joined: Tue Mar 31, 2009 4:13 pm

### Re: Bayesian design

Michiel,

Thanks again,
Eli
eliD

Posts: 6
Joined: Thu Mar 30, 2017 2:17 am

### Re: Bayesian design

Dear Michiel,

I'm sorry to disturb you again, but I have a further question.
I just ran the design, but checking the output I found some repetitions (same choice situation in block 1 and 3). So I added the star to alt1 and alt2 as follows:

Design
;alts = alt1*, alt2*, alt3
;rows = 28
;block = 4
;eff = (mnl,d)
;model:
U(alt1)= b1[0]*price[0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69] + b2.dummy[0|0|0]*Plastic[0,1,2,3] + b3[0]*Colour[0,1]/
U(alt2)= b1*Price + b2.dummy*Plastic + b3*Colour
\$

I obtained a design without repetitions (d-error is unchanged), but I am not sure that using the * command is appropriate in this case. If I have understood well reading some posts in this forum, it is not recommended to use the * command when using priors equal to 0 and when the signs are unknown. Any feedback will be much appreciated.

Eli
eliD

Posts: 6
Joined: Thu Mar 30, 2017 2:17 am

### Re: Bayesian design

Adding the * is a good idea to avoid repetitions. Since you are using zero priors, Ngene cannot check for dominance but that is fine.

I only now notice that you have a no-choice alternative (alt3). Note that you need add either a constant for alt1 and alt2 (the same constant, eg b0), or a constant in alt3.

Michiel
Michiel Bliemer

Posts: 610
Joined: Tue Mar 31, 2009 4:13 pm

### Re: Bayesian design

Thank you so much Michiel!
Eli
eliD

Posts: 6
Joined: Thu Mar 30, 2017 2:17 am

### Re: Bayesian design

Dear Michiel and Ngene team,

here I am again asking for your kind help to complete my bayesian design... After collecting pilot data using the codes reported in my previous posts, I ran a mnl and got my priors (all beta values were significant). Then, I divided all betas and std errors by 2 and ran the design.
I got this warning:
'One or more attributes will not have level balance with the number of rows specified: alt1.plast, alt2.plast. Note: Defaulting to assigning blocks with the 'minsum' method'
and also:
'Beginning Gauss draws for simulation. Completed Gauss draws for simulation. A valid initial random design could not be generated after approximately 10 seconds'.

Below, the sintax I used:

Design
;alts = alt1*, alt2*, alt3
;rows = 42
;eff = (mnl, d, mean)
;block = 6
;bdraws = gauss(3)
;Model:
U(alt1)= b1[(n,-2.6595,0.2588)]*price[0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69]
+ b2.effects[(n,-0.1764,0.0584)|(n,0.4405,0.0589)|(n,-0.1643,0.0585)]*plast[0,1,2,3]
+ b3.effects[(n,-0.2497,0.0570)]*color[0,1]/
U(alt2) = b1*price + b2*plast + b3*color/
U(alt3) = b0[(n,-1.9995,0.1390)]
\$

I do not understand what is the issue here and what I am doing wrong. Even changing the rows and blocks I get the same errors.
Let me also take the chance of this post to ask you a further question... when running the MNL to get the bayesian priors I thought it was better to enter the plast attribute in effects coding (since I have a nobuy alternative). I did this even though in the original design the plast was entered in dummy coding. Is this ok given that the underlying assumption of the dummy and effects coding is the same?

eli
eliD

Posts: 6
Joined: Thu Mar 30, 2017 2:17 am

### Re: Bayesian design

Attribute level balance cannot be satisfied with your settings. You are asking for 42 rows while your attributes have 7, 4, and 2 levels. In order to achieve attribute level balance you require the number of rows to be divisible by 7, 4, and 2; 42 is not divisible by 4. You could set ;rows = 28 and ;block = 4 in order to try to find an attribute level balanced design. Is there a need for 7 price levels? You may want to use 4 or 6 levels in order to make it easier to find an attribute level balanced design.

You have to options:

A) Keep attribute level balance by using the default swapping algorithm.
Given that your design is heavily constrained by the dominance constraints you imposed (which is appropriate), it is very difficult to find a large design without any dominant alternatives. In the syntax below I used 12 rows, 2 blocks, and use only 6 levels for price. This syntax will work and will generate an attribute level balanced design.

Design
;alts = alt1*, alt2*, alt3
;rows = 12
;eff = (mnl, d, mean)
;block = 2
;model:
U(alt1)= b1[(n,-2.6595,0.2588)]*price[0.33, 0.39, 0.45, 0.51, 0.57, 0.63]
+ b2.effects[(n,-0.1764,0.0584)|(n,0.4405,0.0589)|(n,-0.1643,0.0585)]*plast[0,1,2,3]
+ b3.effects[(n,-0.2497,0.0570)]*color[0,1]/
U(alt2) = b1*price + b2*plast + b3*color/
U(alt3) = b0[(n,-1.9995,0.1390)]
\$

B) Relax attribute level balance and use the modified Federov algorithm.
With this algorithm, you can use 42 rows without a problem, but your design will not be attribute level balanced, even if you set ;rows = 28 since this algorithm is a row-based algorithm. Note that attribute level balanced is NOT required in a design (and letting go of attribute level balance yields a more efficient design). In case you would like to see some balance in your design, you can impose either hard attribute level constraints by adding (4-8,4-8,...) behind the price attribute, or by adding +0.5*(imbalance) or something in the ;eff command.

Design
;alts = alt1*, alt2*, alt3
;rows = 42
;eff = (mnl, d, mean)
;block = 6
;alg = mfederov
;model:
U(alt1)= b1[(n,-2.6595,0.2588)]*price[0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69]
+ b2.effects[(n,-0.1764,0.0584)|(n,0.4405,0.0589)|(n,-0.1643,0.0585)]*plast[0,1,2,3]
+ b3.effects[(n,-0.2497,0.0570)]*color[0,1]/
U(alt2) = b1*price + b2*plast + b3*color/
U(alt3) = b0[(n,-1.9995,0.1390)]
\$

Michiel
Michiel Bliemer

Posts: 610
Joined: Tue Mar 31, 2009 4:13 pm

### Re: Bayesian design

Dear Michiel,

thank you very much for your clarification. Given the type of product considered, 7 levels for the price attribute is indeed the best option... so I used the modified Federov algorithm and obtained a design with S-estimate=29, which seems ok.

Thanks again for your kind help. Much appreciated.

Eli
eliD

Posts: 6
Joined: Thu Mar 30, 2017 2:17 am