Attribute level frequency constraints like FM_MODE_BUS[0,1](44-50,10-16) only work in row-based algorithms like the modified Fedorov algorithm, the row-based swapping algorithm cannot deal with such constraints. If you switch to the modified Fedorov algorithm, you will be able to impose such constraints.
Ngene does not "understand" utility functions that the user specifies, and therefore does not know what components of the utility function are active, so the default swapping algorithm simply aims for attribute level balance across all rows.
Perhaps you can trick it by specifying another "0" level, e.g. FM_MODE_BUS[0,0.00001,1], so that in this case level 1 would appear approximately 20 times across the 60 rows (attribute level balance is usually not perfect when constraints are imposed). I guess your additional constraints would then become something like:
if(alt1.MODE = 2, alt1.FM_MODE_BUS = [0,0.000001]),
if(alt1.MODE = 2, alt1.FM_MODE_TAXI = [0,0.000001])
- Code: Select all
Design
;alts = alt1*, alt2*, none
;rows = 60 ? 54 parms; number of alternatives = 2 (without none); minimum S = 54 / (2-1) = 54/1 = 54
;block = 5
;eff = (mnl,d)
;alg = swap
?;store = 1
;cond:
? Step 1&2: Introduce MODE (LABEL) attribute and INDICATOR
if(alt1.MODE = 1, alt1.RAIL = 1), if(alt1.MODE <> 1, alt1.RAIL = 0),
if(alt1.MODE = 3, alt1.COACH = 1), if(alt1.MODE <> 3, alt1.COACH = 0),
if(alt2.MODE = 1, alt2.RAIL = 1), if(alt2.MODE <> 1, alt2.RAIL = 0),
if(alt2.MODE = 3, alt2.COACH = 1), if(alt2.MODE <> 3, alt2.COACH = 0),
? Step 3: Introduce conditions for categorical variables with more than two levels
if(alt1.FM_MODE_BUS = 1, alt1.FM_MODE_TAXI = 0), if(alt1.FM_MODE_TAXI = 1, alt1.FM_MODE_BUS = 0),
if(alt2.FM_MODE_BUS = 1, alt2.FM_MODE_TAXI = 0), if(alt2.FM_MODE_TAXI = 1, alt2.FM_MODE_BUS = 0),
if(alt1.MODE = 2, alt1.FM_MODE_BUS = [0,0.000001]),
if(alt1.MODE = 2, alt1.FM_MODE_TAXI = [0,0.000001])
;model:
U(alt1) = b_mode.dummy[0|0] * MODE[1,3,2]
+ b_fm_mode_bus_rail[0] * FM_MODE_BUS[0,0.000001,1] * RAIL[0,1]
+ b_fm_mode_taxi_rail[0] * FM_MODE_TAXI[0,0.000001,1] * RAIL[0,1]
+ b_fm_mode_bus_coach[0] * FM_MODE_BUS[0,0.000001,1] * COACH[0,1]
+ b_fm_mode_taxi_coach[0] * FM_MODE_TAXI[0,0.000001,1] * COACH[0,1]
+ b_tt.dummy[0|0] * TT[2,3,1]
+ b_cost.dummy[0|0|0|0] * COST[2,3,4,5,1]
/
U(alt2) = b_mode.dummy * MODE
+ b_fm_mode_bus_rail * FM_MODE_BUS * RAIL
+ b_fm_mode_taxi_rail * FM_MODE_TAXI * RAIL
+ b_fm_mode_bus_coach * FM_MODE_BUS * COACH
+ b_fm_mode_taxi_coach * FM_MODE_TAXI * COACH
+ b_tt.dummy * TT
+ b_cost.dummy * COST
$
Michiel