## Pivot design around gross revenue

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

### Pivot design around gross revenue

Dear Prof. Bliemer,

Context:
Continuing from my email, you suggested
''Homogeneous design: You create a single design for all respondents based on the medium GR farmers, i.e. using levels 100, 250, and 500. Then for the other farmers you simply replace these levels with the lower or higher levels. If you are using an orthogonal design or a D-efficient design with zero priors, this is an appropriate way of doing it. But if you are using a D-efficient design with non-zero priors, a heterogeneous design is more efficient.''

I attempted to write a syntax for a homogenous design D-efficient design with zero priors for the pilot study. I want to then generate a heterogenous design for the actual study.

As per your above suggestion, I attempted to write a syntax. But from the syntax examples I have seen on the manual, they all talk about 1 reference alternative. But that is not what I want.

I categorise my farmers based on their reported gross revenues.

Low GR farmers: if gross revenue is reported to be < 100,000

Medium GR farmers: if gross revenue is reported to be between £100,000- £500,00

High GR farmers: if gross revenue is reported to be >£500,000

I want the low GR farmers to be given a choice set that has one attribute GR that is specific to them with certain levels, i.e. 30, 50, 90. All other attributes and levels remain the same for all farmers.
Similarly, medium GR farmers will have GR attribute with levels 100,250,500.
And high GR farmers will have GR attribute with levels 600,750,1000

Attempt 1:

Code: Select all
`?Farm management design pilotv.2Design;alts = alt1, alt2, alt3; rows = 18; block = 3; eff = (mnl, d)?gross margins #, income fluctuations#, infection level#;con; model:U(alt1) =  b2*grossmargins[100000,250000,500000] + b3*fluctuations[10,30,50] + b4*infectionlevel[0,10,20,30]/U(alt2) =  b2*grossmargins + b3*fluctuations + b4*infectionlevel/U(alt3) =  b2*grossmargins + b3*fluctuations + b4*infectionlevel\$`

So here I generate this design, and then when I transfer the matrix of values to the choice cards,I merely swap 100,250,500 with the low and high levels (no re-generating of design) *Running this gives me an extremely low D-error.

OR

Attempt 2: which doesn't seem right AT ALL.

Code: Select all
`?Farm management design pilotv.1Design;alts(low)    = alt1, alt2, alt3;alts(medium) = alt1, alt2, alt3;alts(high)   = alt1, alt2, alt3; rows = 18; block = 3; eff = fish(mnl, d);fisher(fish) = design1(low[0.33], medium[0.34], high[0.33]);cond:?gross margins #, income fluctuations#, infection level#;con; model(low):U(alt1) =  b2*grossmarginsref[30000,50000,90000] + b3*fluctuations[10%,30%,50%] + b4*infectionlevel[0%,10%,20%,30%]/U(alt2) =  b2*grossmargins + b3*fluctuations + b4*infectionlevel/U(alt3) =  b2*grossmargins + b3*fluctuations + b4*infectionlevel/; model(medium):U(alt1) =  b2*grossmarginsref[100000,250000,50000] + b3*fluctuations[10%,30%,50%] + b4*infectionlevel[0%,10%,20%,30%]/U(alt2) =  b2*grossmargins + b3*fluctuations + b4*infectionlevel/U(alt3) =  b2*grossmargins + b3*fluctuations + b4*infectionlevel/; model(high):U(alt1) =  b2*grossmargins[600000,750000,1000000] + b3*fluctuations[10%,30%,50%] + b4*infectionlevel[0%,10%,20%,30%]/U(alt2) =  b2*grossmargins + b3*fluctuations + b4*infectionlevel/U(alt3) =  b2*grossmargins + b3*fluctuations + b4*infectionlevel/\$`

Not sure, if I am suppose to enhance attempt1 or attempt2.

Any feedback would be much appreciated.

Thank you
Maria
suella_rodrigues

Posts: 16
Joined: Mon Aug 19, 2019 12:01 am

### Re: Pivot design around gross revenue

Hi Maria,

I had a look at your syntax and for the first syntax I would use this:

Code: Select all
`Design;alts = alt1*, alt2*, alt3*;rows = 18;block = 3;eff = (mnl,d);alg = mfederov;model:U(alt1) = b2[0.000000001]*grossmargins[100,250,500](5-7,5-7,5-7)         + b3[-0.00000001]*fluctuations[10,30,50](5-7,5-7,5-7)        + b4[-0.00000001]*infectionlevel[0,10,20,30](4-8,4-8,4-8,4-8)/U(alt2) = b2*grossmargins        + b3*fluctuations        + b4*infectionlevel/U(alt3) = b2*grossmargins        + b3*fluctuations        + b4*infectionlevel\$`

The very small D-errors you get are due to the fact that you are using very large attribute levels and that is not a problem.

(a) I defined the grossmargin values as (x1000), so using smaller values (but you do not have to).
(b) I added very small positive and negative prior values such that Ngene can check for dominance, using alt*, alt2*, and alt3*.
(c) Since dominance checks are a strong constraint on the design, I had to use the modified Federov algorithm to generate the design. In order to get some attribute level balance, I added attribute level constraints to ensure that each level appears in the design, e.g. I request that level 100 appears between 5 and 7 times in the design.
(d) I removed ;con because you do not have constants since it is an unlabelled experiment.

Replacing the grossmargin values for the different segments is the easiest way to generate the three designs.

Alternatively, you could go with a heterogeneous design by simply generating three separate designs (perhaps using 12 rows each instead of 18 since you will have enough variation in your data anyway) using the syntax above. Your attempt 2 syntax does not work because your attribute levels are not the same across the three models, and you are actually not generating a pivot design but rather fixed designs.

Michiel
Michiel Bliemer

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

### Re: Pivot design around gross revenue

Dear Prof,

I cant seem to identify what the problem is, : I get ''invalid designs''

Code: Select all
`?Farm management design main surveyDesign;alts(mnl) = alt1*, alt2*, alt3*;alts(rpl) = alt1*, alt2*, alt3*;rows = 18;block = 3;eff = mnl(mnl,d, mean);alg = mfederov;rdraws = gauss(3),rep = 500;model (mnl):U(alt1) = b2[(n,0.59,0.16)]*grossmargins[100,250,500](5-7,5-7,5-7)         + b3[(n,-0.13,0.09)]*fluctuations[10,30,50](5-7,5-7,5-7)        + b4[(n,-0.67,0.13)]*infectionlevel[0,10,20,30](4-8,4-8,4-8,4-8)/U(alt2) = b2*grossmargins        + b3*fluctuations        + b4*infectionlevel/U(alt3) = b2*grossmargins        + b3*fluctuations        + b4*infectionlevel;model(rpl):U(alt1) = b2[n,(n,0.82,0.28),(u,0.12,1.84)]*grossmargins[100,250,500](5-7,5-7,5-7)         + b3[n,(n,-0.16,0.17),(u,0.03,1.49)]*fluctuations[10,30,50](5-7,5-7,5-7)        + b4[n,(n,-0.93,0.24),(u,1.41,2.07)]*infectionlevel[0,10,20,30](4-8,4-8,4-8,4-8)/U(alt2) = b2*grossmargins        + b3*fluctuations        + b4*infectionlevel/U(alt3) = b2*grossmargins        + b3*fluctuations        + b4*infectionlevel\$`

Thank you for time.

Maria
suella_rodrigues

Posts: 16
Joined: Mon Aug 19, 2019 12:01 am

### Re: Pivot design around gross revenue

I made a few minor corrections in your syntax, see below, but your issue with invalid designs is that your priors are not appropriate. They are far too large. Where did you get these priors from? If they come from a pilot study, please make sure that you use exactly the same attribute levels and coding for estimation and for your design. A prior of -0.59 with an attribute level of 500 is a very large number and will generate fully dominant alternatives (you can see this by inspecting the design that is generated with an Undefined D-error and looking at the choice probabilities, which go to 0 and 1).

Code: Select all
`    ?Farm management design main survey    Design    ;alts(mnl) = alt1*, alt2*, alt3*    ;alts(rpl) = alt1*, alt2*, alt3*    ;rows = 18    ;block = 3    ;eff = mnl(mnl,d,mean)    ;alg = mfederov    ;bdraws = gauss(3)    ;rdraws = gauss(3)    ;rep = 500    ;model(mnl):    U(alt1) = b2[(n,0.59,0.16)]*grossmargins[100,250,500](5-7,5-7,5-7)            + b3[(n,-0.13,0.09)]*fluctuations[10,30,50](5-7,5-7,5-7)            + b4[(n,-0.67,0.13)]*infectionlevel[0,10,20,30](4-8,4-8,4-8,4-8)            /    U(alt2) = b2*grossmargins            + b3*fluctuations            + b4*infectionlevel            /    U(alt3) = b2*grossmargins            + b3*fluctuations            + b4*infectionlevel    ;model(rpl):    U(alt1) = b2[n,(n,0.82,0.28),(u,0.12,1.84)]*grossmargins[100,250,500](5-7,5-7,5-7)            + b3[n,(n,-0.16,0.17),(u,0.03,1.49)]*fluctuations[10,30,50](5-7,5-7,5-7)            + b4[n,(n,-0.93,0.24),(u,1.41,2.07)]*infectionlevel[0,10,20,30](4-8,4-8,4-8,4-8)            /    U(alt2) = b2*grossmargins            + b3*fluctuations            + b4*infectionlevel            /    U(alt3) = b2*grossmargins            + b3*fluctuations            + b4*infectionlevel    \$`

Michiel
Michiel Bliemer

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

### Re: Pivot design around gross revenue

Thank you prof.

You were right I messed up my coding.

Code: Select all
` ?Farm management design main survey    Design    ;alts(mnl) = alt1*, alt2*, alt3*    ;alts(rpl) = alt1*, alt2*, alt3*    ;rows = 18    ;block = 3    ;eff = mnl(mnl,d,mean)    ;alg = mfederov    ;bdraws = gauss(3)    ;rdraws = gauss(3)    ;rep = 500    ;model(mnl):    U(alt1) = b2[(n,0.005,0.001)]*grossmargins[100,250,500](5-7,5-7,5-7)            + b3[(n,-0.01,0.009)]*fluctuations[10,30,50](5-7,5-7,5-7)            + b4[(n,-0.12,0.025)]*infectionlevel[0,10,20,30](4-8,4-8,4-8,4-8)            /    U(alt2) = b2*grossmargins            + b3*fluctuations            + b4*infectionlevel            /    U(alt3) = b2*grossmargins            + b3*fluctuations            + b4*infectionlevel    ;model(rpl):    U(alt1) = b2[n,(n,0.006,0.002),(u,-0.0014,0.007)]*grossmargins[100,250,500](5-7,5-7,5-7)            + b3[n,(n,-0.012,0.016),(u,-0.003,0.069)]*fluctuations[10,30,50](5-7,5-7,5-7)            + b4[n,(n,-0.162,0.043),(u,-0.042,0.138)]*infectionlevel[0,10,20,30](4-8,4-8,4-8,4-8)            /    U(alt2) = b2*grossmargins            + b3*fluctuations            + b4*infectionlevel            /    U(alt3) = b2*grossmargins            + b3*fluctuations            + b4*infectionlevel    \$`

Question 1 Does my syntax look fine now?
With the corrected code, I now get a D-error of 0.00012.
I calculated my priors as below:
b2 mean =0.006 b2se=0.002 ---->(n,0.006,0.002)
b2SD=0.003 b2SE=0.0022
---> lower bound 0.003-(2x0.0022)= - 0.0014
---> Upper bound 0.003+(2x0.002)=0.007

Question 2
When you have a categorical variable how can we assume it is normally distributed?

Question3
Okay, so in this case I use my attributes as ''continuous'' variables but why, they are still categories aren't they? Fine, I haven't coded them as 0,1,2 but 10,30,50 are categories. Are we assuming they are taken on intervals and thats why they are continuous?

Att1 (Expected gross margins) (30,000, 50,000, 90,000) (100,000, 250,000, 500,000 ) (600,000, 750,000, 1,000,000)

Att2 (Future income fluctuation) +-10%, +-30%, +-50% +-10%, +-30%, +-50% +-10%, +-30%, +-50%

Att3 (Infection level) 0, 10%, 20%, 30% 0, 10%, 20%, 30% 0, 10%, 20%, 30%

Apologies professor for silly questions (just want to be absolutely clear!)

Thank you
Maria
suella_rodrigues

Posts: 16
Joined: Mon Aug 19, 2019 12:01 am

### Re: Pivot design around gross revenue

1. Computations of priors seem fine, but note that standard deviations cannot be negative, therefore you should use (u,0,...) for priors for stdevs in the rpl model.

2. Utilities are calculated based on parameters and attribute levels. An attribute can be continuous (price) of categorical (colour). Parameters for attributes can be fixed or random (e.g. normally distributed). For example, b.dummy[n,0.5,0.2|n,0.3,0.5] * colour[0,1,2], where I assume 3 colours and estimate two normally distributed random parameters using dummy coding.

3. For continuous attributes you only need to estimate a single parameter, e.g. b2 is multiplying all grossmargin levels. In your design you are only showing 3 levels, 100, 250 and 500, but once you have estimated the model you could apply the model to all other levels in between, e.g. a grossmargin of 170. Alternatively, you can estimate a model assuming that grossmargin is a categorical attribute: b2.dummy[a|b] * grossmargins[100,250,500], where 500 is the base level, a is the parameter for level 100, and b is the parameter for level 250. Using dummy (or effects) coding allows you to investigate nonlinear effects, but it no longer allows you to evaluate your model for any other level than 100, 250 and 500, e.g. you cannot apply the model for a grossmargin of 170. Alternatively, you could define ranges of grossmargin, namely "0-150", "150-300", "300-500" and use dummy coding for these categories, but this is probably not a good idea since presenting "0-150" to the respondent is quite vague. Therefore, if your attribute is continuous, you preferably do not code it as a categorical variable. If you are interested in nonlinear effects, you can for example estimate b*log(x) instead of b*x.

Michiel
Michiel Bliemer

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

### Re: Pivot design around gross revenue

Thank you prof.

In regards to point 1)
My standard deviations for RPL are all positive.
However, when I calculate the upper and lower bound for uniform distribution, my lower bounds are negative.
For example,
For uniform dist.
B2 Std Dev=0.0030 B2 std error=0.0022
Lower bound = 0.003-(2x0.0022)= - 0.0014

Therefore, I get (u,-0.0014,0.007)
Is this what you are referring to?
And as long as the lower bound is smaller than the upper bound, it is acceptable, is it not?

Question 2
Choice probabilities
I get a d-error of 0.000106 which seems abnormally low making me think perhaps something is wrong?
My choice probabilities are so:

Alt 1 Alt 2 Alt3
0.29 0.03 0.66
0.39 0.58 0.02
0.31 0.18 0.49
0.40 0.40 0.18
0.10 0.79 0.10
0.09 0.62 0.27
0.34 0.22 0.42
0.77 0.12 0.09
0.15 0.19 0.65
0.03 0.25 0.70
and so on
I know these probabilities should be approx. (50,30,20), but the highlighted probabilities worry me a little. Is it telling me that something is wrong with the priors I have used? or something else?

Maria
suella_rodrigues

Posts: 16
Joined: Mon Aug 19, 2019 12:01 am

### Re: Pivot design around gross revenue

No, you cannot use a uniform distribution where you can draw a negative value for a standard deviation, since standard deviations MUST be postitive. Therefore, you should use (u,0,0.007), (u,0,0.069), and (u,0,138).

The probabilities look fine to me.

Michiel
Michiel Bliemer

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