Michiel,
(Re3) thanks, now it is clear.
(Re2) OK, I think I get your point. But, when randomly selecting 10 rows from the design of 100 rows, I need to make sure that each row is selected (without replacement) an equal number of times, right? Which leads essentially to the same result as blocking. I can't show some rows many times and some not all, if I want to retain the calculated efficiency which is valid only to the whole design (all rows used). Or am I wrong here?
(Re3) Please see the code below.
The external design is here on my Google Drive:
https://drive.google.com/file/d/13AsEq- ... sp=sharing
Have a look at Sawtooth's report on the design too:
https://docs.google.com/spreadsheets/d/ ... ue&sd=true
Now some explanations before you look at the code:
1. We want to study the preferences for transportation options in long-distance travel.
2. There are 3 alternatives to choose from. And the none option. The are described by mode attributes (time, cost, transfers, delay), access/egress modes, and mobility services offered at the destination (bus frequency, distance to the bus stop, facilities at the hotel).
3. The major attribute is mode, which can be: car, rail, and bus (coach). On rail and bus, you have the first mile (access) and last mile (egress) segments. These are described by a single attribute (FM, LM) with 11 levels, which are a combination of the feeder mode, time, and cost. Why not split it into 3 separate attributes? Because we wanted to have it in a single line in the survey, and this is the only way to implement it in our survey tool.
4. The design is unlabeled. I am aware that is not the optimal solution for a mode choice study, but it is the legacy traditional approach of my colleagues from marketing/economics, and the standard approach implemented in Sawtooth, and they want to preserve comparability between the tools in this project.
5. Everything is dummy coded in Ngene - under the premise that there may be non-linearities in preferences to some attributes, and we do not want to make any assumptions about that (e.g., that there is a linear reaction to cost or number of transfers). In Sawtooth, everything was effects-coded. Does it make a difference for the evaluation?
6. We want to have FM, LM, and transfers alternative(mode)-specific. Since the design is unlabeled, we interact these attributes with mode. Paired with dummy coding, this leads to a long code. Sorry for that.
7. There is no First and Last Mile when driving, and no transfers, so we added an additional level = 0 to these attributes, which applies when mode == car. This is controlled by the if() conditions at the beginning of the code. Although I am not really sure about whether this is correct. I can't find this topic in the forum now, but I remember your response saying that setting an attribute level to 0 is not the same as not having the attribute. What is the statistical explanation behind that? Is it very wrong, or is it just making the design less efficient?
I can't generate a new design in Ngene (no valid design in first 10 min, Ngene sometimes crashes after 30 min), given the assumptions above, nor can I evaluate the external design from Sawtooth (D-error is undefined).
The Fisher Information matrix looks fine. No extraordinarily large values there. But there are NaNs and huge numbers in AVC.
Code: Select all
Design
;alts = alt1*, alt2*, alt3*, none
;rows = 3600 ? 3600 rows in external design
? ;block = 300 ? 300 blocks in external design (ignore for now)
;eff = (mnl,d)
;eval = balanced_overlap_design_for_ngene.csv
;cond: ? conditions (AKA: prohibitions) for the swapping algorithm
if(alt1.mode = 2, alt1.fm = 0),
if(alt2.mode = 2, alt2.fm = 0),
if(alt3.mode = 2, alt3.fm = 0),
if(alt1.mode = 2, alt1.transfers = 0),
if(alt2.mode = 2, alt2.transfers = 0),
if(alt3.mode = 2, alt3.transfers = 0),
if(alt1.mode = 2, alt1.lm = 0),
if(alt2.mode = 2, alt2.lm = 0),
if(alt3.mode = 2, alt3.lm = 0)
;model:
U(alt1) = b_mode.dummy[0|0] * mode[1,3,2] ? main mode dummy: 1 = rail, 2 = car (base), 3 = bus
+ b_fm.dummy[0|0|0|0|0|0|0|0|0|0|0] * fm[0,2,3,4,5,6,7,8,9,10,11,1] ? First Mile dummy: 0 = needed if main mode == car since there is no FM when driving, 1 = walk 5m (base), 2 = walk 15m, 3 = Taxi 5m 12€, 4 = Taxi 15m 30€, 5 = Taxi 30m 50€, 6 = PT 10m 0€, 7 = PT 30m 0€, 8 = PT 50m 0€, 9 = PT 10m 3€, 10 = PT 30m 6€, 11 = PT 50m 9€
+ i_fm_mode_1[0] * fm.dummy[2] * mode.dummy[1] ? FM dummies interacted with main mode (we want to have coefficients for each level of FM separately for rail and bus as main mode). No interaction for base levels and for FM = 0.
+ i_fm_mode_2[0] * fm.dummy[2] * mode.dummy[3]
+ i_fm_mode_3[0] * fm.dummy[3] * mode.dummy[1]
+ i_fm_mode_4[0] * fm.dummy[3] * mode.dummy[3]
+ i_fm_mode_5[0] * fm.dummy[4] * mode.dummy[1]
+ i_fm_mode_6[0] * fm.dummy[4] * mode.dummy[3]
+ i_fm_mode_7[0] * fm.dummy[5] * mode.dummy[1]
+ i_fm_mode_8[0] * fm.dummy[5] * mode.dummy[3]
+ i_fm_mode_9[0] * fm.dummy[6] * mode.dummy[1]
+ i_fm_mode_10[0] * fm.dummy[6] * mode.dummy[3]
+ i_fm_mode_11[0] * fm.dummy[7] * mode.dummy[1]
+ i_fm_mode_12[0] * fm.dummy[7] * mode.dummy[3]
+ i_fm_mode_13[0] * fm.dummy[8] * mode.dummy[1]
+ i_fm_mode_14[0] * fm.dummy[8] * mode.dummy[3]
+ i_fm_mode_15[0] * fm.dummy[9] * mode.dummy[1]
+ i_fm_mode_16[0] * fm.dummy[9] * mode.dummy[3]
+ i_fm_mode_17[0] * fm.dummy[10] * mode.dummy[1]
+ i_fm_mode_18[0] * fm.dummy[10] * mode.dummy[3]
+ i_fm_mode_19[0] * fm.dummy[11] * mode.dummy[1]
+ i_fm_mode_20[0] * fm.dummy[11] * mode.dummy[3]
+ b_tt.dummy[0|0] * tt[2,3,1] ? time dummy: 1 = 7h (base), 2 = 8h, 3 = 9h
+ b_transfers.dummy[0|0|0] * transfers[0,2,3,1] ? transfers dummy: 0 = needed if main mode == car, since there are no transfers when driving, 1 = 0 transfers, 2 = 1 transfer, 3 = 2 transfers
+ i_tra_mode_1[0] * transfers.dummy[2] * mode.dummy[1] ? transfers dummies interacted with main mode (to get cofficients for each number of transfers separately for rail and bus). No interaction for base levels and for transfers = 0.
+ i_tra_mode_2[0] * transfers.dummy[2] * mode.dummy[3]
+ i_tra_mode_3[0] * transfers.dummy[3] * mode.dummy[1]
+ i_tra_mode_4[0] * transfers.dummy[3] * mode.dummy[3]
+ b_delay.dummy[0|0|0] * delay[2,3,4,1] ? delay dummy: 1 = on time (base), 2 = 20% 1h, 3 = 20% 2h, 4 = 20% 3h
+ i_tra_del_mode_1[0] * transfers.dummy[2] * delay.dummy[2] * mode.dummy[1] ? transfer dummies interacted with delay dummies (to see whether delay has a larger effect if there are more transfers or maybe not) for each mode separately (that is interacted with mode). No interaction for base levels and for transfers = 0.
+ i_tra_del_mode_2[0] * transfers.dummy[2] * delay.dummy[2] * mode.dummy[3]
+ i_tra_del_mode_3[0] * transfers.dummy[2] * delay.dummy[3] * mode.dummy[1]
+ i_tra_del_mode_4[0] * transfers.dummy[2] * delay.dummy[3] * mode.dummy[3]
+ i_tra_del_mode_5[0] * transfers.dummy[2] * delay.dummy[4] * mode.dummy[1]
+ i_tra_del_mode_6[0] * transfers.dummy[2] * delay.dummy[4] * mode.dummy[3]
+ i_tra_del_mode_7[0] * transfers.dummy[3] * delay.dummy[2] * mode.dummy[1]
+ i_tra_del_mode_8[0] * transfers.dummy[3] * delay.dummy[2] * mode.dummy[3]
+ i_tra_del_mode_9[0] * transfers.dummy[3] * delay.dummy[3] * mode.dummy[1]
+ i_tra_del_mode_10[0] * transfers.dummy[3] * delay.dummy[3] * mode.dummy[3]
+ i_tra_del_mode_11[0] * transfers.dummy[3] * delay.dummy[4] * mode.dummy[1]
+ i_tra_del_mode_12[0] * transfers.dummy[3] * delay.dummy[4] * mode.dummy[3]
+ b_cost.dummy[0|0|0|0] * cost[2,3,4,5,1] ? cost dummy: 1 = 25€ (base), 2 = 50€, 3 = 100€, 4 = 150€, 5 = 200€
+ b_lm.dummy[0|0|0|0|0|0|0|0|0|0|0] * lm[0,2,3,4,5,6,7,8,9,10,11,1] ? LM dummy: 0 = needed if main mode == car since there is no LM when driving, 1 = walk 5m (base), 2 = walk 15m, 3 = Taxi 5m 12€, 4 = Taxi 15m 30€, 5 = Taxi 30m 50€, 6 = PT 10m 0€, 7 = PT 30m 0€, 8 = PT 50m 0€, 9 = PT 10m 3€, 10 = PT 30m 6€, 11 = PT 50m 9€
+ i_lm_mode_1[0] * lm.dummy[2] * mode.dummy[1] ? LM dummies interacted with main mode (we want to have coefficients for each level of LM separately for rail and bus as main mode). No interaction for base levels and for transfers = 0.
+ i_lm_mode_2[0] * lm.dummy[2] * mode.dummy[3]
+ i_lm_mode_3[0] * lm.dummy[3] * mode.dummy[1]
+ i_lm_mode_4[0] * lm.dummy[3] * mode.dummy[3]
+ i_lm_mode_5[0] * lm.dummy[4] * mode.dummy[1]
+ i_lm_mode_6[0] * lm.dummy[4] * mode.dummy[3]
+ i_lm_mode_7[0] * lm.dummy[5] * mode.dummy[1]
+ i_lm_mode_8[0] * lm.dummy[5] * mode.dummy[3]
+ i_lm_mode_9[0] * lm.dummy[6] * mode.dummy[1]
+ i_lm_mode_10[0] * lm.dummy[6] * mode.dummy[3]
+ i_lm_mode_11[0] * lm.dummy[7] * mode.dummy[1]
+ i_lm_mode_12[0] * lm.dummy[7] * mode.dummy[3]
+ i_lm_mode_13[0] * lm.dummy[8] * mode.dummy[1]
+ i_lm_mode_14[0] * lm.dummy[8] * mode.dummy[3]
+ i_lm_mode_15[0] * lm.dummy[9] * mode.dummy[1]
+ i_lm_mode_16[0] * lm.dummy[9] * mode.dummy[3]
+ i_lm_mode_17[0] * lm.dummy[10] * mode.dummy[1]
+ i_lm_mode_18[0] * lm.dummy[10] * mode.dummy[3]
+ i_lm_mode_19[0] * lm.dummy[11] * mode.dummy[1]
+ i_lm_mode_20[0] * lm.dummy[11] * mode.dummy[3]
+ b_busfreq.dummy[0|0] * busfreq[2,3,1] ? bus frequency: 1 = every 30m (base), 2 = every 60m, 3 = 3 times a day
+ b_busstop.dummy[0|0|0|0] * busstop[2,3,4,5,1] ? distance to bus stop: 1 = right at the hotel (base), 2 = 5min, 3 = 10min, 4 = 15min, 5 = 30min
+ b_hotel.dummy[0|0|0|0] * hotel[2,3,4,5,1] ? facilities at the hotel: 1 = nothing, 2 = E-Bikes, 3 = of (own) electric car for free, 4 = charging of (own) electric car for a market price, 5 = electric car for guests
/
U(alt2) = b_mode.dummy * mode
+ b_fm.dummy * fm
+ i_fm_mode_1 * fm.dummy[2] * mode.dummy[1]
+ i_fm_mode_2 * fm.dummy[2] * mode.dummy[3]
+ i_fm_mode_3 * fm.dummy[3] * mode.dummy[1]
+ i_fm_mode_4 * fm.dummy[3] * mode.dummy[3]
+ i_fm_mode_5 * fm.dummy[4] * mode.dummy[1]
+ i_fm_mode_6 * fm.dummy[4] * mode.dummy[3]
+ i_fm_mode_7 * fm.dummy[5] * mode.dummy[1]
+ i_fm_mode_8 * fm.dummy[5] * mode.dummy[3]
+ i_fm_mode_9 * fm.dummy[6] * mode.dummy[1]
+ i_fm_mode_10 * fm.dummy[6] * mode.dummy[3]
+ i_fm_mode_11 * fm.dummy[7] * mode.dummy[1]
+ i_fm_mode_12 * fm.dummy[7] * mode.dummy[3]
+ i_fm_mode_13 * fm.dummy[8] * mode.dummy[1]
+ i_fm_mode_14 * fm.dummy[8] * mode.dummy[3]
+ i_fm_mode_15 * fm.dummy[9] * mode.dummy[1]
+ i_fm_mode_16 * fm.dummy[9] * mode.dummy[3]
+ i_fm_mode_17 * fm.dummy[10] * mode.dummy[1]
+ i_fm_mode_18 * fm.dummy[10] * mode.dummy[3]
+ i_fm_mode_19 * fm.dummy[11] * mode.dummy[1]
+ i_fm_mode_20 * fm.dummy[11] * mode.dummy[3]
+ b_tt.dummy * tt
+ b_transfers.dummy * transfers
+ i_tra_mode_1 * transfers.dummy[2] * mode.dummy[1]
+ i_tra_mode_2 * transfers.dummy[2] * mode.dummy[3]
+ i_tra_mode_3 * transfers.dummy[3] * mode.dummy[1]
+ i_tra_mode_4 * transfers.dummy[3] * mode.dummy[3]
+ b_delay.dummy * delay
+ i_tra_del_mode_1 * transfers.dummy[2] * delay.dummy[2] * mode.dummy[1]
+ i_tra_del_mode_2 * transfers.dummy[2] * delay.dummy[2] * mode.dummy[3]
+ i_tra_del_mode_3 * transfers.dummy[2] * delay.dummy[3] * mode.dummy[1]
+ i_tra_del_mode_4 * transfers.dummy[2] * delay.dummy[3] * mode.dummy[3]
+ i_tra_del_mode_5 * transfers.dummy[2] * delay.dummy[4] * mode.dummy[1]
+ i_tra_del_mode_6 * transfers.dummy[2] * delay.dummy[4] * mode.dummy[3]
+ i_tra_del_mode_7 * transfers.dummy[3] * delay.dummy[2] * mode.dummy[1]
+ i_tra_del_mode_8 * transfers.dummy[3] * delay.dummy[2] * mode.dummy[3]
+ i_tra_del_mode_9 * transfers.dummy[3] * delay.dummy[3] * mode.dummy[1]
+ i_tra_del_mode_10 * transfers.dummy[3] * delay.dummy[3] * mode.dummy[3]
+ i_tra_del_mode_11 * transfers.dummy[3] * delay.dummy[4] * mode.dummy[1]
+ i_tra_del_mode_12 * transfers.dummy[3] * delay.dummy[4] * mode.dummy[3]
+ b_cost.dummy * cost
+ b_lm.dummy * lm
+ i_lm_mode_1 * lm.dummy[2] * mode.dummy[1]
+ i_lm_mode_2 * lm.dummy[2] * mode.dummy[3]
+ i_lm_mode_3 * lm.dummy[3] * mode.dummy[1]
+ i_lm_mode_4 * lm.dummy[3] * mode.dummy[3]
+ i_lm_mode_5 * lm.dummy[4] * mode.dummy[1]
+ i_lm_mode_6 * lm.dummy[4] * mode.dummy[3]
+ i_lm_mode_7 * lm.dummy[5] * mode.dummy[1]
+ i_lm_mode_8 * lm.dummy[5] * mode.dummy[3]
+ i_lm_mode_9 * lm.dummy[6] * mode.dummy[1]
+ i_lm_mode_10 * lm.dummy[6] * mode.dummy[3]
+ i_lm_mode_11 * lm.dummy[7] * mode.dummy[1]
+ i_lm_mode_12 * lm.dummy[7] * mode.dummy[3]
+ i_lm_mode_13 * lm.dummy[8] * mode.dummy[1]
+ i_lm_mode_14 * lm.dummy[8] * mode.dummy[3]
+ i_lm_mode_15 * lm.dummy[9] * mode.dummy[1]
+ i_lm_mode_16 * lm.dummy[9] * mode.dummy[3]
+ i_lm_mode_17 * lm.dummy[10] * mode.dummy[1]
+ i_lm_mode_18 * lm.dummy[10] * mode.dummy[3]
+ i_lm_mode_19 * lm.dummy[11] * mode.dummy[1]
+ i_lm_mode_20 * lm.dummy[11] * mode.dummy[3]
+ b_busfreq.dummy * busfreq
+ b_busstop.dummy * busstop
+ b_hotel.dummy * hotel
/
U(alt3) = b_mode.dummy * mode
+ b_fm.dummy * fm
+ i_fm_mode_1 * fm.dummy[2] * mode.dummy[1]
+ i_fm_mode_2 * fm.dummy[2] * mode.dummy[3]
+ i_fm_mode_3 * fm.dummy[3] * mode.dummy[1]
+ i_fm_mode_4 * fm.dummy[3] * mode.dummy[3]
+ i_fm_mode_5 * fm.dummy[4] * mode.dummy[1]
+ i_fm_mode_6 * fm.dummy[4] * mode.dummy[3]
+ i_fm_mode_7 * fm.dummy[5] * mode.dummy[1]
+ i_fm_mode_8 * fm.dummy[5] * mode.dummy[3]
+ i_fm_mode_9 * fm.dummy[6] * mode.dummy[1]
+ i_fm_mode_10 * fm.dummy[6] * mode.dummy[3]
+ i_fm_mode_11 * fm.dummy[7] * mode.dummy[1]
+ i_fm_mode_12 * fm.dummy[7] * mode.dummy[3]
+ i_fm_mode_13 * fm.dummy[8] * mode.dummy[1]
+ i_fm_mode_14 * fm.dummy[8] * mode.dummy[3]
+ i_fm_mode_15 * fm.dummy[9] * mode.dummy[1]
+ i_fm_mode_16 * fm.dummy[9] * mode.dummy[3]
+ i_fm_mode_17 * fm.dummy[10] * mode.dummy[1]
+ i_fm_mode_18 * fm.dummy[10] * mode.dummy[3]
+ i_fm_mode_19 * fm.dummy[11] * mode.dummy[1]
+ i_fm_mode_20 * fm.dummy[11] * mode.dummy[3]
+ b_tt.dummy * tt
+ b_transfers.dummy * transfers
+ i_tra_mode_1 * transfers.dummy[2] * mode.dummy[1]
+ i_tra_mode_2 * transfers.dummy[2] * mode.dummy[3]
+ i_tra_mode_3 * transfers.dummy[3] * mode.dummy[1]
+ i_tra_mode_4 * transfers.dummy[3] * mode.dummy[3]
+ b_delay.dummy * delay
+ i_tra_del_mode_1 * transfers.dummy[2] * delay.dummy[2] * mode.dummy[1]
+ i_tra_del_mode_2 * transfers.dummy[2] * delay.dummy[2] * mode.dummy[3]
+ i_tra_del_mode_3 * transfers.dummy[2] * delay.dummy[3] * mode.dummy[1]
+ i_tra_del_mode_4 * transfers.dummy[2] * delay.dummy[3] * mode.dummy[3]
+ i_tra_del_mode_5 * transfers.dummy[2] * delay.dummy[4] * mode.dummy[1]
+ i_tra_del_mode_6 * transfers.dummy[2] * delay.dummy[4] * mode.dummy[3]
+ i_tra_del_mode_7 * transfers.dummy[3] * delay.dummy[2] * mode.dummy[1]
+ i_tra_del_mode_8 * transfers.dummy[3] * delay.dummy[2] * mode.dummy[3]
+ i_tra_del_mode_9 * transfers.dummy[3] * delay.dummy[3] * mode.dummy[1]
+ i_tra_del_mode_10 * transfers.dummy[3] * delay.dummy[3] * mode.dummy[3]
+ i_tra_del_mode_11 * transfers.dummy[3] * delay.dummy[4] * mode.dummy[1]
+ i_tra_del_mode_12 * transfers.dummy[3] * delay.dummy[4] * mode.dummy[3]
+ b_cost.dummy * cost
+ b_lm.dummy * lm
+ i_lm_mode_1 * lm.dummy[2] * mode.dummy[1]
+ i_lm_mode_2 * lm.dummy[2] * mode.dummy[3]
+ i_lm_mode_3 * lm.dummy[3] * mode.dummy[1]
+ i_lm_mode_4 * lm.dummy[3] * mode.dummy[3]
+ i_lm_mode_5 * lm.dummy[4] * mode.dummy[1]
+ i_lm_mode_6 * lm.dummy[4] * mode.dummy[3]
+ i_lm_mode_7 * lm.dummy[5] * mode.dummy[1]
+ i_lm_mode_8 * lm.dummy[5] * mode.dummy[3]
+ i_lm_mode_9 * lm.dummy[6] * mode.dummy[1]
+ i_lm_mode_10 * lm.dummy[6] * mode.dummy[3]
+ i_lm_mode_11 * lm.dummy[7] * mode.dummy[1]
+ i_lm_mode_12 * lm.dummy[7] * mode.dummy[3]
+ i_lm_mode_13 * lm.dummy[8] * mode.dummy[1]
+ i_lm_mode_14 * lm.dummy[8] * mode.dummy[3]
+ i_lm_mode_15 * lm.dummy[9] * mode.dummy[1]
+ i_lm_mode_16 * lm.dummy[9] * mode.dummy[3]
+ i_lm_mode_17 * lm.dummy[10] * mode.dummy[1]
+ i_lm_mode_18 * lm.dummy[10] * mode.dummy[3]
+ i_lm_mode_19 * lm.dummy[11] * mode.dummy[1]
+ i_lm_mode_20 * lm.dummy[11] * mode.dummy[3]
+ b_busfreq.dummy * busfreq
+ b_busstop.dummy * busstop
+ b_hotel.dummy * hotel
$
[/size]
Thanks again for your time
Bartosz