// File: 18ordinalLogit.mod
// Author: Michel Bierlaire, EPFL
// Date: Sat Nov 13 16:41:08 2010
// This model is not appropriate for the data. We include it to
// illustrate the syntax for an ordered logit model.
// We assume here that the response (1,2,3) is ordered. The higher the
// utility, the higher the response.
[Choice]
CHOICE
[Beta]
// Name Value LowerBound UpperBound status (0=variable, 1=fixed)
B_TIME 0 -10 10 0
B_COST 0 -10 10 0
tau1 -1.0 -10000 0 0
tau2 1.0 -10000 10000 0
[LaTeX]
B_TIME "$\beta_\text{time}$"
B_COST "$\beta_\text{cost}$"
tau1 "$\tau_1$"
tau2 "$\tau_2$"
[Utilities]
// The Id of the utilities are ignored here. The order that matters is
// the alphabetical order of the names of alternatives. In this example,
// the numbering is inconsistent with the names in order to
// illustrate the convention. The difference of utilities that is considered
// is Alt1 - Alt2, as reported in the output file.
// Most of the time, it is convenient to write only the utility of
// alternative 1, and put $NONE for the utility of alternative 2.
// Id Name Avail linear-in-parameter expression (beta1*x1 + beta2*x2 + ... )
23 Alt1 one B_TIME * TRAIN_TT_SCALED
+ B_COST * TRAIN_COST_SCALED
24 Alt2 one $NONE
[Expressions]
// Define here arithmetic expressions for name that are not directly
// available from the data
one = 1
//If the person has a GA (season ticket) her incremental cost is actually 0
//rather than the cost value gathered from the
// network data.
TRAIN_COST = TRAIN_CO * ( GA == 0 )
// For numerical reasons, it is good practice to scale the data to
// that the values of the parameters are around 1.0.
// A previous estimation with the unscaled data has generated
// parameters around -0.01 for both cost and time. Therefore, time and
// cost are multipled my 0.01.
TRAIN_TT_SCALED = TRAIN_TT / 100.0
TRAIN_COST_SCALED = TRAIN_COST / 100
[Model]
// $OL stands for "ordinal, or ordered, logit model",
$OL
[OrdinalLogit]
// We associate here the dependent variable (CHOICE) with each category
// The response is 1 if the utility is < tau1
// 2 if the utility is tau1 <= V < tau2
// 3 if the utility is > tau 2
1 $NONE // Category 1 spans -infty --> tau1
2 tau1 // 2 spans tau1 --> tau2
3 tau2 // 3 spans tau2 --> +infty
[LinearConstraints]
tau1 - tau2 <= 0
[Exclude]
// All observations verifying the following expression will not be
// considered for estimation
// The modeler here has developed the model only for work trips.
// Observations such that the dependent variable CHOICE is 0 are also removed.
(( PURPOSE != 1 ) * ( PURPOSE != 3 ) || ( CHOICE == 0 ))