# Nested Logit in R

I am trying to estimate a nested multinomial logit model for transportation mode in R. I am using the following model.

data("TravelMode",package="AER")
TravelMode <- mlogit.data(TravelMode,choice="choice",shape="long",alt.var="mode",chid.var="individual")
TravelMode\$avinc <- with(TravelMode,(mode=='air')*income)
nl.TM <- mlogit(choice ~ wait + gcost + avinc, TravelMode, reflevel = "car",
nests = list(fly = "air", ground = c("train", "bus", "car")),
unscaled=TRUE)
summary(nl.TM)


My Question: How do you indicate a variable is to be considered in the branches (Fly vs Ground) as opposed to the within the twigs (Air, Train, Bus, Car) in the mlogit function in R? As you can see from the specified model above, all the variables are dumped into the model without consideration as to when the variables matter in the decision tree.

Just looked in the document that was shared and realize they say pretty much this. Now I understand you're asking for how to implement using mlogit.

Maybe this is not what you are asking for but is there a reason you are not specifying a Nested Logit model in this case? AFAIK MNL model would have the IIA problem, impacting predicted substitution patterns.

Borrowing from "Discrete Choice Methods with Simulation" by Kenneth Train. You would then specify a logit model for the nest "ground" and a nesting parameter $$\theta$$. The probability of choosing a nest is then a function of the expected utility of that nest.

P(Bus) = P(Bus|Ground)P(Ground) P(Air) = P(Air|Fly)P(Fly) = P(Fly)

$$P(i| ground) = \frac{\exp(V_{i,ground}/\theta_{ground})} { \sum\limits_i \exp(V_{i, ground}/\theta_{ground})}$$

And P(ground) $$P(ground) = \frac{\exp(\theta_{ground}L_{ground})}{\exp(\theta_{air}L_{air}) + \exp(\theta_{ground}L_{ground})}$$

Where $$L_{ground}$$ is the expected utility of choosing nest Ground

$$L_{ground} = \ln\sum\limits_j \exp(V_{j, ground}/\theta_{ground})$$

Maybe this is not at all related to your question, and you are supposed to use MNL for this.