Important: Read this before posting to this forum

  1. This forum is for questions related to the use of Apollo. We will answer some general choice modelling questions too, where appropriate, and time permitting. We cannot answer questions about how to estimate choice models with other software packages.
  2. There is a very detailed manual for Apollo available at http://www.ApolloChoiceModelling.com/manual.html. This contains detailed descriptions of the various Apollo functions, and numerous examples are available at http://www.ApolloChoiceModelling.com/examples.html. In addition, help files are available for all functions, using e.g. ?apollo_mnl
  3. Before asking a question on the forum, users are kindly requested to follow these steps:
    1. Check that the same issue has not already been addressed in the forum - there is a search tool.
    2. Ensure that the correct syntax has been used. For any function, detailed instructions are available directly in Apollo, e.g. by using ?apollo_mnl for apollo_mnl
    3. Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
    4. Make sure that R is using the latest official release of Apollo.
  4. If the above steps do not resolve the issue, then users should follow these steps when posting a question:
    1. provide full details on the issue, including the entire code and output, including any error messages
    2. posts will not immediately appear on the forum, but will be checked by a moderator first. This may take a day or two at busy times. There is no need to submit the post multiple times.

Latent Class Analysis with Nested Logit Model

Ask questions about model specifications. Ideally include a mathematical explanation of your proposed model.
Post Reply
esadergin
Posts: 7
Joined: 10 Jan 2021, 13:17

Latent Class Analysis with Nested Logit Model

Post by esadergin »

Dear Prof. Hess,

First of all, I hope you are good, safe and sound.

I want to create a model by using latent class analysis with nested logit model as the structure of the model is presented below. The research question of the study is whether individuals decide the transportation mode at first then the location and arrival time or vice-versa. I tried using Apollo and I found some restrictions in it and trying to find solution. You are only the one who can help, Sir.
Picture-1.jpg
Picture-1.jpg (32.72 KiB) Viewed 7294 times
The problem of Apollo is that in the nested structure they only include “”inclusive value” for any upper level, which is the expected utility of lower level (section 5.1.1 of manual and the equations 6 and 7). It means Apollo does not allow any upper level has its own utility value. Also the example in Apollo Manual says we have car and PT and then PT itself has bus and fast PT and so on. So at the end each upper level is ONLY defined by its lower level. In my example upper level has its own identity. I attach a formula in a paper which has similar purpose as me and if you look at equation 16
Picture-2.JPG
Picture-2.JPG (17.59 KiB) Viewed 7294 times
in the paper you see that it has two components, Yj which is the utility of nest itself (which is missing in Apollo) and then inclusive value defined by the (1/ muj(ln…) as the second component. This second component is the only part Apollo considers. Therefore I cannot define two choice set in Apollo.

Lastly, the attributes for the class membership could include social demographic characteristic of people.

Moreover, when I try to use one model to define two latent class and cross nested logit at the same time but different choice set (because if the lower level is Arrival time-location choice, the choice column should be “al_choice”, and if the lower level is mode choice, then the choice column should be define as “m_choice”. In this case how should I define the choice column? How can I define the reverse hierarchy of the nest in the same model?
Picture-3.jpg
Picture-3.jpg (24.58 KiB) Viewed 7294 times
What I am kindly asking you that I want to create latent class analysis with nested logit model by using Apollo. However, I cannot cope with the restriction of the Apollo, that I cannot define the model structure above. I would be very glad if you help me to find a trick or something for enlightenment, and even I would very appreciate if you contact me with someone who is very into R programming in order to create such model for a fee because it is urgent for me.


Best regards,
esad
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Latent Class Analysis with Nested Logit Model

Post by stephanehess »

Esad

there are a few different questions in your post, and I'll reply to these in turn.

1. It remains a common misunderstanding to see nested logit as being a model for sequential choices. This is not the case. The model explains the choice between mutually exclusive alternatives. In a model where you nest first by mode and then by destination, the model does not say that individuals first choose a mode and then a destination. It simply says that the choice at the lower level is more deterministic (given the division of the utilities by the nest parameter).

2. You are right than in Apollo, utilities are only defined at the level of alternatives, rather than nests. But this is not a limitation per se. Let's assume you have a number of different alternatives grouped together in a nest m, and that you wanted to include a composite utility Vm for that nest. You can similarly just include this part of the utility in the utility for each of the alternatives in the nest m. The only implication is computational.

3.Now turning to your actual model structure, this seems quite untraditional to me. In your data, you say people choose a mode and a location and arrival time. Then the actual dependent variable is a mode-location-arrival_time triplet, and the number of elementary alternatives (i.e. at the bottom level of the tree) should be the same independent of the structure you use. This does not seem to be the case in your picture.

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
esadergin
Posts: 7
Joined: 10 Jan 2021, 13:17

Re: Latent Class Analysis with Nested Logit Model

Post by esadergin »

Dear Prof. Hess,
Yes you are right it is not sequential but we try to get a sequential model which is presented the linked papers (https://doi.org/10.1016/j.tre.2008.07.001 , https://doi.org/10.1016/j.tourman.2011.01.017). Papers show what I want to do in my modelling structure.
I merged the location and arrival time variables and called it "location+arrival time" as one of the choice sets. The other choice set is "mode". In that case, in order to avoid triplet choice alternatives which are 60 alternatives if we use in only nested logit model, we try to use latent class analysis. In one of the latent class, the choice set will be the "location+arrival time" which is lower level, in the other class the choice set will be "mode". Each class represent a different but dependent nested structure model.
Is it possible to establish such modeling structure in Apollo, Sir?
I hope I made myself clear.

Best regards,

Esad
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Latent Class Analysis with Nested Logit Model

Post by stephanehess »

Esad

I had a look at the two papers and I believe your understanding of them is not quite correct. For example, the Wu et al paper does indeed use a latent class model with two classes, and with a different nesting structure in the two classes. But the dependent variable is the same in the two models - the alternatives are all the possible combinations of zone (14) and party size (3). Independent of which nesting structure you use, you have 42 alternatives.

Apollo can easily handle such a model, you just need to define the nesting structure separately in each class, i.e. redefining nlStructure, etc.

What you had suggested, which is that the choice set is different in different classes, is also easily possible in Apollo by redefining the alternatives. But this is not something that makes sense in this case. If you used a latent class model where in one class, the choice set is substantially smaller than in the other class, as in your picture for latent class 2, then the choice probabilities in that class would be much higher, and the model would simply assign the class allocation completely to class 2 as it is maximising the overall log-likelihood.

Using different choice sets in different classes might make sense in some applications, e.g. if you want to look at choice set composition (consideration of alternatives) but not in this context, I believe.

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
esadergin
Posts: 7
Joined: 10 Jan 2021, 13:17

Re: Latent Class Analysis with Nested Logit Model

Post by esadergin »

Sincerely thank you very much Sir.
It is obviously seen that I need to reconsider the structure.
I will deeply examine your words. They mean a lot to me.

Best regards.

Esad
tue_qiang
Posts: 4
Joined: 02 May 2023, 17:13

Re: Latent Class Analysis with Nested Logit Model

Post by tue_qiang »

stephanehess wrote: 10 Jan 2021, 17:03 Esad

there are a few different questions in your post, and I'll reply to these in turn.

1. It remains a common misunderstanding to see nested logit as being a model for sequential choices. This is not the case. The model explains the choice between mutually exclusive alternatives. In a model where you nest first by mode and then by destination, the model does not say that individuals first choose a mode and then a destination. It simply says that the choice at the lower level is more deterministic (given the division of the utilities by the nest parameter).

2. You are right than in Apollo, utilities are only defined at the level of alternatives, rather than nests. But this is not a limitation per se. Let's assume you have a number of different alternatives grouped together in a nest m, and that you wanted to include a composite utility Vm for that nest. You can similarly just include this part of the utility in the utility for each of the alternatives in the nest m. The only implication is computational.

3.Now turning to your actual model structure, this seems quite untraditional to me. In your data, you say people choose a mode and a location and arrival time. Then the actual dependent variable is a mode-location-arrival_time triplet, and the number of elementary alternatives (i.e. at the bottom level of the tree) should be the same independent of the structure you use. This does not seem to be the case in your picture.

Stephane
Hi Prof. Hess,

in the reply, you indicates the sequential choice is different with nested logit. However, I do not get an explanation and examples about sequential choice, such as the definition of utility function, in user manual. therefore, could you provide an example about how to use a model for sequential choice? for example, in the case of Esad, if we define it is a sequential choice, choosing transport mode firstly and then choosing a destination and time, how can we define it? as far as I now, the utility should consider the attributes only related with transport mode, ignoring destination and time, so I want to ask where I can add the attributes related with destination in the model.

Kind regards,
Qiang Qi
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Latent Class Analysis with Nested Logit Model

Post by stephanehess »

Hi

we don't have ready built examples or models for sequential choice. There are many factors to consider, such as inter-dependencies, including of availabilities

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Post Reply