zero or non zero priors?

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

zero or non zero priors?

Postby bobby1994 » Thu Jan 16, 2025 11:04 pm

Best professor. I am new to Ngene. So I have the syntax written below. I have some questions:

1) I could not find priors for a2, a4, c2 and c4, is it better to use zero priors?
2) Should access_BTM_TT and access_BTM_TC correlate, so travel time and travel cost. What I mean is that if travel time increases, the travel cost increases. If yes how to define that correlation?
3) How to include ASC's?
4) I want to include context variables, such as weather categorized as rainy, wet and windy. How to include these context variables in the code? so I want to show one value for the whole choice task,
5) How to make a nice file output to show the choice experiment?
6) Any more comments on the code?



design
;alts = PEPE, BTMBTM, BTMBIKE, BIKEBTM, BIKEBIKE, BIKEWALKING
;rows = 9
;eff = (mnl, d)
;alg = mfederov

;model:

? PE = Private e-scooter, BTM = Bus, Tram, metro, BIKE = Bicycle, WALKING = walking
? TT = Travel time, WKT = Walking time, WTT = Waiting time train, TC = travel cost,
? WTB = Waiting time for BTM, WKTD = walking time to destination
? PST = Parking search time

? com = comfort in train
? a#, b#, c#, e# = coefficients

U (PEPE) = a1 * access_PE_TT[7, 11, 15] + a2 * com_PE[0,1,2] + a3 * egress_PE_TT[7,11,15] + a4 * egress_PE_PST[1,4,7]
/
U(BTMBTM)= b1 * access_BTM_WKT[2,8,14] + b2 * access_BTM_TT[3,8,13] + b3 * access_BTM_WTT[6,11,16] + b4 * access_BTM_TC[1.4, 1.6, 1.8]
+ b5 * egress_BTM_WTB[8,11,14] + b6 * egress_BTM_TT[3,8,13] + b7 * egress_BTM_WKTD[2,8,14] + b8 * egress_BTM_TC[1.4, 1.6, 1.8]
/
U(BIKEBIKE)= c1 * access_BIKE_TT[8,12,16] + c2 * access_BIKE_PST[1,4,7] + c3 * egress_BIKE_TT[8,12,16] + c4 * egress_BIKE_PST[1,4,7]
/
U(BTMBIKE) = b1 * access_BTM_WKT + b2 * access_BTM_TT + b3 * access_BTM_WTT + b4 * access_BTM_TC +
c3 * egress_BIKE_TT + c4 * egress_BIKE_PST
/
U(BIKEBTM)= c1 * access_BIKE_TT + c2 * access_BIKE_PST +
b5 * egress_BTM_WTB + b6 * egress_BTM_TT + b7 * egress_BTM_WKTD + b8 * egress_BTM_TC
/
U(BIKEWALKING) = c1 * access_BIKE_TT + c2 * access_BIKE_PST + e1 * egress_WALKING_TT[25,30,35]

$
bobby1994
 
Posts: 9
Joined: Tue Nov 26, 2024 1:44 am

Re: zero or non zero priors?

Postby Michiel Bliemer » Fri Jan 17, 2025 8:26 am

1. Yes you can use zero priors in that case.
2. You could do this by imposing constraints, see code below. You need to give the design sufficient flexibility and avoid multicollinearity (perfect correlations), so do not over-constrain the design.
3. See code below.
4. See code below.
5. Not sure what this means. You can use the "formatted scenarios" tab to visualise your choice tasks (after some formatting), or you can copy and paste the design to Excel and do some formatting there for a quick check. But the final choice tasks should of course be implemented in an online instrument such as SurveyEngine or Qualtrics to present to respondents, unless you do a pen & paper survey whereby you can simply create tables in Word.
6. I made some further comments in the code below.

Code: Select all
design
;alts = PEPE, BTMBTM, BTMBIKE, BIKEBTM, BIKEBIKE, BIKEWALKING
;rows = 18  ? Since your model has many parameters, I would increase the number of rows
;block = 2  ? Use blocks if you only want to give 9 choice  tasks to each respondent
;eff = (mnl, d)

? alg = mfederov  I would prefer the default swapping algorithm to avoid losing attribute level balance

;cond:
if(BTMBTM.access_BTM_TT=3, BTMBTM.access_BTM_TC>1.4), ? Example constraint, be careful not to overconstrain the design
if(BTMBTM.access_BTM_TT=13, BTMBTM.access_BTM_TC<1.8)

;model:

? PE = Private e-scooter, BTM = Bus, Tram, metro, BIKE = Bicycle, WALKING = walking
? TT = Travel time, WKT = Walking time, WTT = Waiting time train, TC = travel cost,
? WTB = Waiting time for BTM, WKTD = walking time to destination
? PST = Parking search time

? com = comfort in train
? a#, b#, c#, e# = coefficients

U(PEPE) = asc1
        + a1 * access_PE_TT[7, 11, 15]
        + a2 * com_PE[0,1,2]
        + a3 * egress_PE_TT[7,11,15]
        + a4 * egress_PE_PST[1,4,7]
        + w1.dummy[0|0] * weather[1,2,0] ? 0=sun, 1=rain, 2=wind
        /
U(BTMBTM)= asc2
         + b1 * access_BTM_WKT[2,8,14]
         + b2 * access_BTM_TT[3,8,13]
         + b3 * access_BTM_WTT[6,11,16]
         + b4 * access_BTM_TC[1.4, 1.6, 1.8]  ? this is a quite narrow range
         + b5 * egress_BTM_WTB[8,11,14]
         + b6 * egress_BTM_TT[3,8,13]
         + b7 * egress_BTM_WKTD[2,8,14]
         + b8 * egress_BTM_TC[1.4, 1.6, 1.8] ? this is a quite narrow range
         + w2 * weather[weather]  ? scenario variable
         /
U(BIKEBIKE)= asc3
           + c1 * access_BIKE_TT[8,12,16]
           + c2 * access_BIKE_PST[1,4,7]
           + c3 * egress_BIKE_TT[8,12,16]
           + c4 * egress_BIKE_PST[1,4,7]
           + w3 * weather[weather] ? scenario variable
           /
U(BTMBIKE) = asc4
           + b1 * access_BTM_WKT
           + b2 * access_BTM_TT
           + b3 * access_BTM_WTT
           + b4 * access_BTM_TC
           + c3 * egress_BIKE_TT
           + c4 * egress_BIKE_PST
           + w4 * weather[weather] ? scenario variable
           /
U(BIKEBTM) = asc5
           + c1 * access_BIKE_TT
           + c2 * access_BIKE_PST
           + b5 * egress_BTM_WTB
           + b6 * egress_BTM_TT
           + b7 * egress_BTM_WKTD
           + b8 * egress_BTM_TC
           + w5 * weather[weather] ? scenario variable
               /
U(BIKEWALKING) = c1 * access_BIKE_TT
               + c2 * access_BIKE_PST
               + e1 * egress_WALKING_TT[25,30,35]
               ? You need to omit the scenario variable in at least one alternative, which will be the reference

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

Re: zero or non zero priors?

Postby bobby1994 » Sat Jan 18, 2025 12:13 am

Best Professor Bliemer,

Thanks for your help on the ngene code. Really helpfull. I still have some questions.

1) So what does the constraint you specified mean. Is it that when TT = 3 then TC = 1.4, but why the > sign? the variables in the constraint mentioned namely access_BTM_TT and access_BTM_TC are in the BTMBTM alternative. Will this constraint also be applicable to other alternatives in which these variables are also included? or should I just remove the constraint and let ngene build an design in which it is possible that the highest travel time have lowest travel cost?

2) I see you have omitted the asc for the BIKEWALKING alternative. I assume that this is the reference alternative. But I also see you have omitted the context variable weather from the BIKEWALKING alternative. Should the context variable not be in every alternative since the context variable should hold for every alternative.

3) So I see for the context variable it is coded as w1.dummy[0|0] * weather[1,2,0]. What does the [0|0] mean? and I also have two more dummy variables, trip purpose (business, leisure, education) and time of day (peak, off-peak and weekend). Should I add in the code + w2.dummy[0|0] * purpose[1,2,0] + w3.dummy[0|0] * time[1,2,0] ?

4) Also I see you defined two blocks. How to only see one block?
bobby1994
 
Posts: 9
Joined: Tue Nov 26, 2024 1:44 am

Re: zero or non zero priors?

Postby Michiel Bliemer » Sun Jan 19, 2025 8:46 am

I probably got the larger/smaller than signs wrong, see below. So if travel time is low (3), then travel cost cannot be high (1.8). You should include these constraints for each alternative separately. This is explained in the manual.

;cond:
if(BTMBTM.access_BTM_TT=3, BTMBTM.access_BTM_TC<1.8),
if(BTMBTM.access_BTM_TT=13, BTMBTM.access_BTM_TC>1.4)

You cannot add constants to all alternatives as this would lead to an unidentifiable model. Only differences in utility matter, so you need to normalise one of the constants to zero (it does not matter which one) and interpret the constants RELATIVE to the alternative with normalised constant. Please refer to any textbook on choice modelling.

The same holds for scenario variables or socio-demographic variables, you cannot add them to all alternatives because this would again lead to an unidentifiable model that cannot be estimated. You need to normalise it in one of the alternatives, and then the estimated coefficients in the other alternatives are interpreted RELATIVE to the alternative where it was normalised. For example, suppose that you put weather in the bike alternative but not in the car alternative. If the rain level has a negative coefficient in the bike alternative, then it means that bike is less RELATIVE to car when it rains. You can again find more information in textbooks about this and in the Ngene manual this is discussed in Section 8.5.

The [0|0] refers to priors for levels 1 and 2, whereby level 0 is the base level for dummy coding. Please refer to the Ngene manual. And yes, you would add scenario variables for trip purpose and time of day in the same way.

Blocks simply split the design. With 18 rows and 2 blocks, you simply get two sets of 9 choice tasks. You can see this in the design via the column Block that is added to the design, whereby all choice tasks with Block=1 go to one respondent and all choice tasks with Block=2 go to another respondent. So you will need to implement two versions in your survey.

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

Re: zero or non zero priors?

Postby bobby1994 » Mon Jan 20, 2025 11:26 pm

Best professor,

Thank you for your reply. Really helpfull. I still have some questions.

1) Since the design is in 2 blocks and I have zero priors, how will I know how many respondents I should have approximately since the S-estimate is not given? would 1 block not be fine? there are also one dummy variable involved in the alternative PEPE apart from the context variables.

2) There is only costs in the alternatives that have BTM in them. Is that fine? I have relevant attributes for the alternatives. So it makes sense that walking and bike do not have costs involved.
bobby1994
 
Posts: 9
Joined: Tue Nov 26, 2024 1:44 am

Re: zero or non zero priors?

Postby bobby1994 » Thu Jan 23, 2025 2:50 am

Best professor,

Thank you for your reply. Really helpfull. I still have some questions.

1) Since the design is in 2 blocks and I have zero priors, how will I know how many respondents I should have approximately since the S-estimate is not given? would 1 block not be fine? there are also one dummy variable involved in the alternative PEPE apart from the context variables.

2) There is only costs in the alternatives that have BTM in them. Is that fine? I have relevant attributes for the alternatives. So it makes sense that walking and bike do not have costs involved.
bobby1994
 
Posts: 9
Joined: Tue Nov 26, 2024 1:44 am

Re: zero or non zero priors?

Postby Michiel Bliemer » Thu Jan 23, 2025 8:21 am

1. There is no direct influence of the number of blocks on the required sample size since you will still be giving the same number of choice tasks to a single respondent. It is not possible to determine the required sample size in advance without having reliable priors from a pilot study, but a small study usually has hundreds of respondents and a larger study has thousands. The sample size is often based on your available budget for the data collection.

2. Yes that is fine.

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

Re: zero or non zero priors?

Postby bobby1994 » Fri Jan 24, 2025 11:34 pm

Best professor,

Thanks for you reply.

1) So I have used no priors. If I want to determine the priors through a pilot study, should the nr of respondents be approximately the same as the final study or a smaller number of respondents is fine?

2) SO below is a small part of the code.
a) in the PEPE alternative, there is the a2 coefficient with the dummy variable com_PE. This variable is only present in this alternative. Is it defined properly like this?
b) in the BTMBTM alternative, there is the w1 coefficient with the weather dummy variable. It takes only two values 0 and 1. Is the dummy coefficient w1 defined properly like this w1.dummy[0]*weather[1,0]?




design
;alts = PEPE, BTMBTM, BTMBIKE, BIKEBTM, BIKEBIKE, BIKEWALKING
;rows = 18
;block = 2
;eff = (mnl, d)
?alg = mfederov

;model:

? PE = Private e-scooter, BTM = Bus, Tram, metro, BIKE = Bicycle, WALKING = walking

? for PEPE, the asc and the dummies are removed, because this is the reference alternative

U (PEPE) = a1 * access_PE_TT[7, 11, 15] ? TT = travel time
+ a2.dummy[0|0] * com_PE[1,2,0] ? com = comfort in train, 1 = sitting stored, 2 sitting holding, 0 = standing holding
+ a3 * egress_PE_TT[7,11,15]
+ a4 * egress_PE_PST[1,4,7] ? PST = parking search time
/
U(BTMBTM)= asc1
+ b1 * access_BTM_WKT[4,8,12] ? WKT = walking time
+ b2 * access_BTM_TT[4,8,12]
+ b3 * access_BTM_WTT[5,10,15] ? waiting time train
+ b4 * access_BTM_TC[1, 2, 3] ? TC = travel cost
+ b5 * egress_BTM_WTB[5,10,15] ? WTB = waiting time BTM
+ b6 * egress_BTM_TT[4,8,12]
+ b7 * egress_BTM_WKTD[1,5,9] ? WKTD = walking time to destination
+ b8 * egress_BTM_TC[1, 2, 3]
+ w1.dummy[0] * weather[1,0] ? 1 = sun, 0 = rain
+ y1.dummy[0] * tod[1,0] ? tod = time of day, 1 = daylight, 0 = dark
+ z1.dummy[0|0] * purpose[1,2,0] ? 1 = education, 2 = leisure, 0 = work
/
bobby1994
 
Posts: 9
Joined: Tue Nov 26, 2024 1:44 am

Re: zero or non zero priors?

Postby Michiel Bliemer » Tue Jan 28, 2025 3:05 pm

1) You typically use 10% of your total sample for the pilot
2) Yes both look good.

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


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 5 guests

cron