7. Miscellaneous models

knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE, widtht = 65)
options(width = 65)

Paired combinatorial logit model

@KOPP:WEN:00 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 @KOPP:WEN:00 on the same subset of the ModeCanada than the one used by @BHAT:95. 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")
data("ModeCanada", package = "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'))
summary(pcl)

The rank-ordered logit model

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\footnote{see for example [@BEGG:CARD:HAUS:81], [@CHAP:STAE:82] and [@HAUS:RUUD:87].}

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:VAND:12]. 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)
head(Game2, 7)
nrow(Game)
nrow(Game2)

Note 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"))
head(G)
nrow(G)

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 :

summary(mlogit(ch ~ own | hours + age, G, reflevel = "PC"))

Bibliography



Try the mlogit package in your browser

Any scripts or data that you put into this service are public.

mlogit documentation built on Oct. 23, 2020, 5:29 p.m.