Dummy variables and interactions + sample size

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

Dummy variables and interactions + sample size

Postby Alix Le Goff » Fri Feb 15, 2019 7:27 pm

Dear Ngene team,

First of all, I would like to apologize if these questions have already been asked. I am fairly new to Ngene and did not find answers in topics I read on the forum.

1. Interaction-with-dummies question

I would like to know how can I model my utility function in Ngene if I have dummy interactions in it.
Let's take an example : if I want to model the utility of a car driver. Let's pretend I think his utility varies with travel time and if he has passengers with him. If he has, I want to see if passenger's gender has an influence or not.

My utility function would look like :
U(car_driver) = b0 + b_tt * TT + b_pass * passenger[0,1] +(if passenger=1) b_pass_gender * pass_gender[0,1]

A solution would be : "if passenger = 0, b_pass_gender = 0". And so we would not consider pass_gender at all when there is no passenger on board. But it seems you cannot run this in Ngene as "b_pass_gender" is a coefficient and not an attribute.
I just cannot run : "if passenger = 0, pass_gender = 0" because Ngene would give me a value of 0 for pass_gender. This means even if there is no passenger on board he would still have the gender "0" in my scenarios, which I do not want.

The problem seems even bigger to me if I want to introduce a dummy variable with more than 2 classes.
For example : let's pretend I want to see the influence of passenger's age only in the case he is a man (pass_gender = 1).
If my "age" variable is splited into 3 classes, I would have :

U(car_driver) = b0 + b_tt * TT + b_pass * passenger[0,1] +(if passenger = 1) b_pass_gender * pass_gender[0,1] +(if passenger=1 AND pass_gender = 1) b_age.dummy * age_pass[0,1,2]

I really do not get how to put this kind of conditions and interactions in my utility functions in Ngene.


2. s-estimate question

I just wanted to be sure to understand how Ngene "s-estimate" works.
For example : If I have 100 rows and 10 blocks in my design and the s-estimate Ngene give me is about 50.

The number of respondants I need is approximately 100/10*50 = 500, is that correct ?

A huge thank you in advance for your support.

Alix
Alix Le Goff
 
Posts: 2
Joined: Fri Feb 15, 2019 10:28 am

Re: Dummy variables and interactions + sample size

Postby Michiel Bliemer » Sat Feb 16, 2019 10:08 am

Hi Alix,

1. Yes Ngene can handle interactions between dummy coded variables. The correct utility specification in this case would be for example:

U(car_driver) = b0 + ... + b_pass.dummy[0.3] * passenger[0,1] + b_gender[0.1] * passenger.dummy[1] * pass_gender[0,1]

Assume pass_gender[1] = female.

If the car driver takes no passengers, then U = b0 + ...
If the car driver takes a male passenger, then U = b0 + ... + 0.3
If the car driver takes a female passenger, then U = b0 + ... + 0.3 + 0.1

You can extend this beyond 2 levels and including multiple dummy coded attributes. Please refer to page 116 of the Ngene manual.

2. The S-estimate is defined in terms of design replications, so in case blocking is used you need to multiply the sample size by the number of blocks as you indicate correctly.

Michiel
Michiel Bliemer
 
Posts: 1705
Joined: Tue Mar 31, 2009 4:13 pm

Re: Dummy variables and interactions + sample size

Postby Alix Le Goff » Mon Feb 18, 2019 8:37 pm

Michiel Bliemer wrote:Hi Alix,

1. Yes Ngene can handle interactions between dummy coded variables. The correct utility specification in this case would be for example:

U(car_driver) = b0 + ... + b_pass.dummy[0.3] * passenger[0,1] + b_gender[0.1] * passenger.dummy[1] * pass_gender[0,1]

Assume pass_gender[1] = female.

If the car driver takes no passengers, then U = b0 + ...
If the car driver takes a male passenger, then U = b0 + ... + 0.3
If the car driver takes a female passenger, then U = b0 + ... + 0.3 + 0.1

You can extend this beyond 2 levels and including multiple dummy coded attributes. Please refer to page 116 of the Ngene manual.

2. The S-estimate is defined in terms of design replications, so in case blocking is used you need to multiply the sample size by the number of blocks as you indicate correctly.

Michiel


Hi Michiel,

1)I'm very confuse the answer was in the manual, it seems I read this part and was still doing a mistake in my code. :oops: It is very clear now, thank you.

I still have trouble coding an interaction with an other dummy variable with more than 2 alternatives. With the example you used, it seems this interaction is not possible :

Considering my age variable is coded :
-0 for 29 years old or less
-1 for 30 to 59 years old
-2 for 60+ years old

U(car_driver) = b0 + ... + b_pass.dummy[0.3] * passenger[0,1] + b_age.dummy[0.1|0.2] * passenger.dummy[1] * pass_age[0,1,2]

If the car driver takes no passengers, then U = b0 + ...
If the car driver takes a 60+ years old passenger, then U = b0 + ... + 0.3
If the car driver takes a 30-59 years old passenger, then U = b0 + ... + 0.3 + 0.2
If the car driver takes a 29- years old passenger, then U = b0 + ... + 0.3 + 0.1

I assume I have to code it this way (considering age1 = 1 when passenger's age is below 29 and age2=1 when between 30 and 59) :

U(car_driver) = b0 + ... + b_pass.dummy[0.3] * passenger[0,1] + b_age1[0.1] * passenger.dummy[1] * pass_age1[0,1] + b_age2[0.2] * passenger.dummy[1] * pass_age2[0,1]

With a condition to avoid the case pass_age1=pass_age2 = 1.

But maybe it is possible to code it in a more efficient way.

2) I have a little more question about the s-estimate. When you are not sure about a coefficient in your model but pretty much sure about the sign, it seems common to give a very small prior (e.g. 0.01 or -0.01). However, my s-estimate exploses when I do this compared to the default situation (priors set to 0). I suppose it is because Ngene consider I want to be super precise when I set priors with very small values.
So should I let priors to 0 or still give a small prior, knowing I will never be able to reach the sample size the s-estimate indicates ?

Alix
Alix Le Goff
 
Posts: 2
Joined: Fri Feb 15, 2019 10:28 am

Re: Dummy variables and interactions + sample size

Postby Michiel Bliemer » Tue Feb 19, 2019 10:23 am

Suppose that there are two dummy coded variables:
passenger[1,0], where 0 = no passengers is the reference level, 1 = passenger
age[1,2,0], where 0 = young is the reference level, 1 = medium, 2 = old

You would code the additional utility for having an old passenger as follows:

b_young_passenger * passenger.dummy[1] * age.dummy[2]

Regarding sample size estimates, they should only be used if you have a good idea about the priors, typically they come from a pilot study. If you have not done a pilot study, then you should be ignoring sample size estimates since they would be too unreliable.

If you want to check for dominant alternatives you will need to use small positive or negative priors. If you do not want to check for dominant alternatives, you can simply use zero. In both cases, you should ignore the sample size estimates since they are meaningless.

Michiel
Michiel Bliemer
 
Posts: 1705
Joined: Tue Mar 31, 2009 4:13 pm


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 15 guests

cron