Evaluating external design & large designs

This forum is for posts that specifically focus on the Windows desktop version of Ngene (i.e. all version 1.x releases).

Moderators: Andrew Collins, Michiel Bliemer, johnr

Re: Evaluating external design & large designs

Postby Michiel Bliemer » Sat Apr 26, 2025 4:49 pm

I'm glad to hear that you like the new Ngene manual.

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
Michiel Bliemer
 
Posts: 1996
Joined: Tue Mar 31, 2009 4:13 pm

Re: Evaluating external design & large designs

Postby bartoszbursa » Tue Apr 29, 2025 10:30 pm

Regarding level frequency constraints - this functionality is introduced in the manual (old Ngene 1.4) in an example with the default swapping algorithm (page 151). An this is why I thought it works this way. However, I have just noticed that level frequencies in the design do not match with the constraints defined in the round brackets in the code. So I guess, it does not work the way it is described in the manual (or works only in specific cases?), and can only be used with the Modified Fedorov algorithm, right?

Regarding the trick with an additional "0" level - is there anything I should be careful about when using this trick? How should I proceed when - after running the pilot - I want to add informative priors for the coefficients referring to FM_MODE? As far as I understand, the prior for 0.00001 can take any value as it does not contribute to utility anyway, correct?

Thanks
Bartosz
bartoszbursa
 
Posts: 11
Joined: Tue Mar 18, 2025 9:29 pm

Re: Evaluating external design & large designs

Postby Michiel Bliemer » Wed Apr 30, 2025 3:13 pm

Yes it works with the swapping algorithm, although it is rarely needed there. However, since this is a column-based algorithm, satisfying both row-based conditional constraints and column-based frequency constraints is nearly impossible, and Ngene will prioritise the conditional constraints. This is the message that Ngene produces in the log screen to notify the user of that: "An attempt will be made to balance the frequency of each level in attributes affected by constraints, however complete balance might not be possible."

Level 0 is not a prior, it is an attribute level. Ngene will not allow two of the same levels, so you will need to set it very close to 0 to make it essentially 0. This value DOES matter as you want to emulate a 0-1 variable and its value will affect utilities and probabilities. The prior that you need to specify after model estimation is b_fm_mode_bus_rail etc., which is currently set to 0.

Note that I am currently on holidays and may not be able to respond on this forum for at least a week.

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

Previous

Return to Support for Ngene Desktop (v1.x)

Who is online

Users browsing this forum: No registered users and 18 guests

cron