Page 1 of 1

Effects coding

PostPosted: Fri Aug 14, 2009 5:33 pm
by tlaba
Hi There,

This might be a stupid question, but are the 0 levels in the NGene design output for effects coded variables the base level (eg: -1) for subsequent data analysis (in Nlogit).

Cheers

Tracey

Re: Effects coding

PostPosted: Mon Aug 31, 2009 6:08 pm
by Andrew Collins
Hi Tracey,

Not a stupid question. The final level that is specified (or the largest level if the default dummy/effects coded levels of 0,1,... are used) is the base level.

Cheers,
Andrew

Re: Effects coding

PostPosted: Tue Jul 05, 2011 4:34 am
by julia
Hi,

I'm trying to run an efficient design with effects coded attributes. However, it doesn't work and I can't find the error myself.
Ngene Syntax check says "An attribute has the wrong number of levels for dummy or effects coding. 'a' "

I want to run an efficient design with three alternatives plus one no choice-alternative, creating 6 blocks with 5 choice cards each. I have 6 attributes with the first one (A) being a context attribute that I would like to keep constant within each choice card ("design within design"). All attributes are generic.

As I assume nonlinear relationships for the attribute levels of attributes A, B and E, I wanted to use effects coding for them. I can't see why I have the wrong number of levels for effects coding for any of these variables. A has 5 levels and I specified 4 priors, B and E have 4 levels each and I specified 3 priors, always considering the last level as the base level.

What's wrong with this? Can anyone help?

This is the code I was trying to use:

Design
;alts = alt1, alt2, alt3, alt4
;rows = 30
;eff = (mnl,d)
;block = 6
;model:

U(alt1) = b0[0.5]
+ b2.effects[0.2|0.1|-0.1|0.05]*A[0,1,2,3,4]
+ b3.effects[0.2|0.1|-0.1]*B[0,1,2,3]
+ b4[0.1]*C[0,1]
+ b5[-0.1]*D[0,1]
+ b6.effects[0.05|0.1|0.025]*E[0,1,2,3]
+ b7[-0.5]*F[5,10,20,30,40] /

U(alt2) = b1[0.3]
+ b2.effects[0.2|0.1|-0.1|0.05]*A[A]
+ b3.effects[0.2|0.1|-0.1]*B
+ b4[0.1]*C
+ b5[-0.1]*D
+ b6.effects[0.05|0.1|0.025]*E
+ b7[-0.5]*F /

U(alt3) = b2.effects[0.2|0.1|-0.1|0.05]*A[A]
+ b3.effects[0.2|0.1|-0.1]*B
+ b4[0.1]*C
+ b5[-0.1]*D
+ b6.effects[0.05|0.1|0.025]*E
+ b7[-0.5]*F

$

Regards
Julia

Re: Effects coding

PostPosted: Fri Jul 08, 2011 4:47 am
by Michiel Bliemer
Julia,

When using nesting, such as A[A], Ngene cannot tell anymore how many attribute levels A has, and therefore generates an option. Although this could be obtained from looking at the previous A attribute, Ngene is at the moment not this smart and we put it on our list of future changes to Ngene. In order to use such a nesting / scenario, it is also possible to do this manually by using conditions. So keeping A[0,1,2,3,4], you could add the following conditions:

Code: Select all
;cond:
if(alt1.A = 0, alt2.A = 0) , if(alt1.A = 0, alt3.A = 0),
if(alt1.A = 1, alt2.A = 1) , if(alt1.A = 1, alt3.A = 1),
if(alt1.A = 2, alt2.A = 2) , if(alt1.A = 2, alt3.A = 2),
if(alt1.A = 3, alt2.A = 3) , if(alt1.A = 3, alt3.A = 3),
if(alt1.A = 4, alt2.A = 4) , if(alt1.A = 4, alt3.A = 4)


This ensures that the attribute levels of A across all alternatives are equal (except of course for the base alternative alt4).

Re: Effects coding / Required sample sizes

PostPosted: Wed Aug 03, 2011 1:28 am
by julia
Dear Michiel,

first of all, thank you for your quick replies to my questions. They were very helpful. The nested design now gives results, also when using effects coding.

However, I met another problem. When playing around with different designs, I realized that when using effects coding for the qualitative attributes in my utility specification, the S-estimates I get increase by a factor of 18 to 20. (I get S-estimates in the range of 4000 to 6000 which seems unreasonable to me. When using design coding for all attributes, I get S-estimates in the range of 200 to 300 - which seem still quite high to me but somehow reasonable).

I see that one important influencing factor on the S-estimates I get are the priors I chose. As I do not have priors from a pilot study yet, I just used arbitrary priors for testing different designs. This is obviously not an appropriate way to get realistic results. How sensitive are the results I get to the choice of priors?

And I also see that effects coding requires more observations than design coding as more parameters need to be estimated. But I am a bit confused to get such big differences in S-estimates for design and effects coding. This would mean that one should use effects coding only very selectively. But I couldn't find such kind of recommendation in the literature. If it would be the case, what would be the criterion to select the attributes to be effects coded?

My utility specification includes 6 attributes with 4 x 4 levels and 2 x 2 levels, 3 of the 4-level-attributes and both the 2-level-attributes are qualitative (i.e. all except the price attribute), one of the 4-level-attributes is a context attribute that is kept constant among choices in each choice set. One example for a test code that I used is the following:

Design
;alts = alt1, alt2, alt3, alt4
;rows = 64
;eff = (mnl,d)
;block = 8
;cond:
if(alt1.A = 0, alt2.A = 0) , if(alt1.A = 0, alt3.A = 0),
if(alt1.A = 1, alt2.A = 1) , if(alt1.A = 1, alt3.A = 1),
if(alt1.A = 2, alt2.A = 2) , if(alt1.A = 2, alt3.A = 2),
if(alt1.A = 3, alt2.A = 3) , if(alt1.A = 3, alt3.A = 3)
;model:

U(alt1) = b0[0.5]
+ b2.effects[0.2|-0.1|0.1]*A[0,1,2,3]
+ b3.effects[0.2|0.1|-0.1]*B[0,1,2,3]
+ b4[0.1]*C[0,1]
+ b5[-0.1]*D[0,1]
+ b6.effects[0.05|0.1|0.025]*E[0,1,2,3]
+ b7[-0.5]*F[5,15,25,35] /

U(alt2) = b1[0.3]
+ b2.effects[0.2|-0.1|0.1]*A[0,1,2,3]
+ b3.effects[0.2|0.1|-0.1]*B
+ b4[0.1]*C
+ b5[-0.1]*D
+ b6.effects[0.05|0.1|0.025]*E
+ b7[-0.5]*F /

U(alt3) = b2.effects[0.2|-0.1|0.1]*A[0,1,2,3]
+ b3.effects[0.2|0.1|-0.1]*B
+ b4[0.1]*C
+ b5[-0.1]*D
+ b6.effects[0.05|0.1|0.025]*E
+ b7[-0.5]*F

$

I would be glad if you or someone else could comment on my approach and the results I get in terms of suggested minimum sample sizes.

Regards,
Julia

Re: Effects coding

PostPosted: Thu Sep 01, 2011 6:20 pm
by Michiel Bliemer
The results are sensitive to the priors you choose. Especially the S-estimates are sensitive to these priors, as they are derived from the t-ratios (prior value divided by standard error). If you change the coding,you are essentially estimating a completely different model and therefore you will need completely different priors as well. You cannot compare S-estimates for different codings if you do not change the priors appropriately. The priors have to make sense. If you do not have any knowledge about the priors, you can use zeros. However, S-estimates are undefined in case you choose zero. In your case, I would not trust the S-estimates, as they only make sense if you have good priors that are consistent with the coding structure.

ps: Apologies for the late reply!

Re: Effects coding

PostPosted: Fri Sep 02, 2011 2:14 am
by julia
Thank you!
I was just not aware of this sensitivity. In the meantime, I estimated the priors from my pretest data and S-estimates are now reasonable.