Koppelman and Wen (2000) proposed the paired combinatorial logit model, which is a nested logit model with nests composed by every combination of two alternatives. This model is obtained by using the following \(G\) function:
\[ G(y_1, y_2, ..., y_n)=\sum_{k=1}^{J-1}\sum_{l=k+1}^J\left(y_k^{1/\lambda_{kl}}+y_l^{1/\lambda_{kl}} \right)^{\lambda_{kl}} \]
The pcl model is consistent with random utility maximisation if \(0<\lambda_{kl}\leq 1\) and the multinomial logit results if \(\lambda_{kl}=1 \;\forall (k,l)\). The resulting probabilities are:
\[ P_l = \frac{\sum_{k\neq l}e^{V_l/\lambda_{lk}}\left(e^{V_k/\lambda_{lk}} + e^{V_l/\lambda_{lk}}\right)^{\lambda_{lk}-1}} {\sum_{k=1}^{J-1}\sum_{l=k+1}^{J}\left(e^{V_k/\lambda_{lk}} + e^{V_l/\lambda_{lk}}\right)^{\lambda_{lk}}} \]
which can be expressed as a sum of \(J-1\) product of a conditional probability of choosing the alternative and the marginal probability of choosing the nest:
\[ P_l=\sum_{k\neq l}P_{l\mid lk} P_{lk} \]
with:
\[ P_{l \mid lk} = \frac{e^{V_l/\lambda_{lk}}}{e^{V_k/\lambda_{lk}} + e^{V_l/\lambda_{lk}}} \]
\[ P_{lk}= \frac{\left(e^{V_k/\lambda_{lk}} + e^{V_l/\lambda_{lk}}\right)^{\lambda_{lk}}}{\sum_{k=1}^{J-1}\sum_{l=k+1}^{J}\left(e^{V_k/\lambda_{lk}} + e^{V_l/\lambda_{lk}}\right)^{\lambda_{lk}}} \]
We reproduce the example used by Koppelman and Wen (2000) on the same subset of the ModeCanada than the one used by Bhat (1995). Three modes are considered and there are therefore three nests. The elasticity of the train-air nest is set to one. To estimate this model, one has to set the nests argument to "pcl". All the nests of two alternatives are then automatically created. The restriction on the nest elasticity for the train-air nest is performed by using the constPar argument.
library(mlogit)
busUsers <- with(ModeCanada, case[choice == 1 & alt == 'bus'])
Bhat <- subset(ModeCanada, ! case %in% busUsers &
alt != 'bus' & noalt == 4)
Bhat$alt <- Bhat$alt[drop = TRUE]
Bhat <- dfidx(Bhat, idx = c("case", "alt"), choice = "choice",
idnames = c("chid", "alt"))
pcl <- mlogit(choice ~ freq + cost + ivt + ovt, Bhat, reflevel = 'car',
nests = 'pcl', constPar=c('iv:train.air'))
gaze(pcl) Estimate Std. Error z-value Pr(>|z|)
(Intercept):train 1.3043932 0.1654423 7.884 3.11e-15
(Intercept):air 1.9901292 0.3557061 5.595 2.21e-08
freq 0.0653783 0.0043569 15.006 < 2e-16
cost -0.0244856 0.0031657 -7.735 1.04e-14
ivt -0.0076154 0.0006737 -11.303 < 2e-16
ovt -0.0322399 0.0023710 -13.598 < 2e-16
iv:car.train 0.4212904 0.0861343 4.891 1.00e-06
iv:car.air 0.2712332 0.0906132 2.993 0.00276
Sometimes, in stated-preference surveys, the respondents are asked to give the full rank of their preference for all the alternative, and not only the prefered alternative. The relevant model for this kind of data is the rank-ordered logit model, which can be estimated as a standard multinomial logit model if the data is reshaped correctly.1
The ranking can be decomposed in a series of choices of the best alternative within a decreasing set of available alternatives. For example, with 4 alternatives, the probability that the ranking would be 3-1-4-2 can be writen as follow:
This model can therefore simply be fitted as a multinomial logit model ; the ranking for one individual amoung J alternatives is writen as \(J-1\) choices among \(J, J-1, ..., 2\) alternatives.
The estimation of the rank-ordered logit model is illustrated using the Game data set (Fok, Paap, and Van Dijk 2012). Respondents are asked to rank 6 gaming platforms. The covariates are a dummy own which indicates whether a specific platform is curently owned, the age of the respondent (age) and the number of hours spent on gaming per week (hours). The data set is available in wide (game) and long (game2) format. In wide format, the consists on \(J\) columns which indicate the ranking of each alternative.
data("Game", package = "mlogit")
data("Game2", package = "mlogit")
head(Game,2)
## ch.Xbox ch.PlayStation ch.PSPortable ch.GameCube ch.GameBoy ch.PC
## 1 2 1 3 5 6 4
## 2 4 2 3 5 6 1
## own.Xbox own.PlayStation own.PSPortable own.GameCube own.GameBoy
## 1 0 1 0 0 0
## 2 0 1 0 0 0
## own.PC age hours
## 1 1 33 2.00
## 2 1 19 3.25
head(Game2, 7)
## age hours platform ch own chid
## 1 33 2.00 GameBoy 6 0 1
## 2 33 2.00 GameCube 5 0 1
## 3 33 2.00 PC 4 1 1
## 4 33 2.00 PlayStation 1 1 1
## 5 33 2.00 PSPortable 3 0 1
## 6 33 2.00 Xbox 2 0 1
## 7 19 3.25 GameBoy 6 0 2
nrow(Game)
## [1] 91
nrow(Game2)
## [1] 546Note that Game contains 91 rows (there are 91 individuals) and that Game2 contains 546 rows (\(91\) individuals \(times\) 6 alternatives)
To use dfidx, the ranked argument should TRUE:
G <- dfidx(Game, varying = 1:12, choice = "ch", ranked = TRUE,
idnames = c("chid", "alt"))
G <- dfidx(Game2, choice = "ch", ranked = TRUE, idx = c("chid", "platform"),
idnames = c("chid", "alt"))
print(G, n = 3)~~~~~~~
first 3 observations out of 1820
~~~~~~~
age hours ch own idx
1 33 2 FALSE 0 1:eBoy
2 33 2 FALSE 0 1:Cube
3 33 2 FALSE 1 1:PC
~~~ indexes ~~~~
idx1 chid alt
1 1 1 GameBoy
2 1 1 GameCube
3 1 1 PC
indexes: 1, 1, 2
Note that the choice variable is now a logical variable and that the number of row is now 1820 (91 individuals \(\times (6+5+4+3+2)\) alternatives).
Using PC as the reference level, we can then reproduce the results of the original reference:
mlogit(ch ~ own | hours + age, G, reflevel = "PC") |> gaze() Estimate Std. Error z-value Pr(>|z|)
(Intercept):GameBoy 1.57038 1.60025 0.981 0.326429
(Intercept):GameCube 1.40410 1.60348 0.876 0.381218
(Intercept):PSPortable 2.58356 1.62078 1.594 0.110930
(Intercept):PlayStation 2.27851 1.60699 1.418 0.156227
(Intercept):Xbox 2.73377 1.53610 1.780 0.075127
own 0.96337 0.19040 5.060 4.20e-07
hours:GameBoy -0.23561 0.05213 -4.520 6.19e-06
hours:GameCube -0.18707 0.05102 -3.667 0.000246
hours:PSPortable -0.23369 0.04941 -4.729 2.25e-06
hours:PlayStation -0.12920 0.04468 -2.891 0.003834
hours:Xbox -0.17301 0.04570 -3.786 0.000153
age:GameBoy -0.07359 0.07863 -0.936 0.349344
age:GameCube -0.06757 0.07763 -0.870 0.384055
age:PSPortable -0.08867 0.07942 -1.116 0.264230
age:PlayStation -0.06701 0.07936 -0.844 0.398515
age:Xbox -0.06666 0.07520 -0.886 0.375423
See for example Beggs, Cardell, and Hausman (1981), Chapman and Staelin (1982) and Hausman and Ruud (1987).↩︎