Important: Read this before posting to this forum
- 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.
- 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
- Before asking a question on the forum, users are kindly requested to follow these steps:
- Check that the same issue has not already been addressed in the forum - there is a search tool.
- 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
- Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
- Make sure that R is using the latest official release of Apollo.
- Users can check which version they are running by entering packageVersion("apollo").
- Then check what is the latest full release (not development version) at http://www.ApolloChoiceModelling.com/code.html.
- To update to the latest official version, just enter install.packages("apollo"). To update to a development version, download the appropriate binary file from http://www.ApolloChoiceModelling.com/code.html, and install the package from file
- If the above steps do not resolve the issue, then users should follow these steps when posting a question:
- provide full details on the issue, including the entire code and output, including any error messages
- 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.
Joint model Log-likelihood fails at starting values
Re: Joint model Log-likelihood fails at starting values
Dear Stephane,
It seems that the loglikelihood is basically zero for some households (while reasonable for others).
For instance, the first 25 loglikelihoods of kilometers traveled are as attached.
What would you suggest?
Thank you,
Chris
It seems that the loglikelihood is basically zero for some households (while reasonable for others).
For instance, the first 25 loglikelihoods of kilometers traveled are as attached.
What would you suggest?
Thank you,
Chris
-
- Site Admin
- Posts: 1042
- Joined: 24 Apr 2020, 16:29
Re: Joint model Log-likelihood fails at starting values
does the code also give you the LL for the combined model, not just the individual components? maybe show me the code again too, please?
Re: Joint model Log-likelihood fails at starting values
Dear Stephane,
My apologies, see attached the LL for the combined model.
This LL should be equal to the following equation: LL_total = log(P_c0*(L_car_c0*L_pt_c0*L_other_c0) + P_c1*(L_Car_c1*L_pt_c1*L_Other_c1) whereby L is the likelihood.
The model successfully run in Biogeme, but I ran into problems when trying to add a c2 class (for households owning 2+ cars).
I then tried to replicate the model in Apollo (see code below).
Again, I am not entirely sure this code is correct as I am used to programming in Biogeme.
Thank you so much,
Chris
My apologies, see attached the LL for the combined model.
This LL should be equal to the following equation: LL_total = log(P_c0*(L_car_c0*L_pt_c0*L_other_c0) + P_c1*(L_Car_c1*L_pt_c1*L_Other_c1) whereby L is the likelihood.
The model successfully run in Biogeme, but I ran into problems when trying to add a c2 class (for households owning 2+ cars).
I then tried to replicate the model in Apollo (see code below).
Again, I am not entirely sure this code is correct as I am used to programming in Biogeme.
Thank you so much,
Chris
- Attachments
-
- Loglikelihoods_2class_model_inctotal.png (103.48 KiB) Viewed 4904 times
Last edited by ChrisDjie on 17 Aug 2023, 08:59, edited 1 time in total.
-
- Site Admin
- Posts: 1042
- Joined: 24 Apr 2020, 16:29
Re: Joint model Log-likelihood fails at starting values
Hi
so none of these are actually zero. Close to zero is fine. But have you played around with starting values?
Stephane
so none of these are actually zero. Close to zero is fine. But have you played around with starting values?
Stephane
Re: Joint model Log-likelihood fails at starting values
Oh, I am afraid some are.
I will have a look at the original data behind the entries that resulted in zero LL_total.
Thank you,
Chris
I will have a look at the original data behind the entries that resulted in zero LL_total.
Thank you,
Chris
- Attachments
-
- Loglikelihoods_2class_model_zeros.png (97.77 KiB) Viewed 4906 times
Re: Joint model Log-likelihood fails at starting values
Dear Stephane,
The entries with zero total likelihoods were all households that traveled many kilometers by motors/mopeds.
I thus excluded all kms by private motorized modes that are not cars.
The total likelihoods were never zero after this intervention.
The likelihoods of kilometers traveled by modes within a specific class, like carlike kms for households that do not own a car (c0), were sometimes zero though.
There is nothing weird or typical about the underlying entries.
The model now runs, which is an improvement, but the results say that the likelihood within one component is zero (which makes sense).
Depending on the starting values, this component is either in the no-car (c0) or car-owning (c1) class.
Please note that I already sucessfully ran this version of the model in Biogeme.
However, the model was too sensitive to the starting values, making it impossible to add another class (multiple cars, c2).
I was hoping that Apollo could help me fix the issue.
Do you have any remaining ideas?
Best regards and many thanks,
Chris
The entries with zero total likelihoods were all households that traveled many kilometers by motors/mopeds.
I thus excluded all kms by private motorized modes that are not cars.
The total likelihoods were never zero after this intervention.
The likelihoods of kilometers traveled by modes within a specific class, like carlike kms for households that do not own a car (c0), were sometimes zero though.
There is nothing weird or typical about the underlying entries.
The model now runs, which is an improvement, but the results say that the likelihood within one component is zero (which makes sense).
Depending on the starting values, this component is either in the no-car (c0) or car-owning (c1) class.
Please note that I already sucessfully ran this version of the model in Biogeme.
However, the model was too sensitive to the starting values, making it impossible to add another class (multiple cars, c2).
I was hoping that Apollo could help me fix the issue.
Do you have any remaining ideas?
Best regards and many thanks,
Chris
-
- Site Admin
- Posts: 1042
- Joined: 24 Apr 2020, 16:29
Re: Joint model Log-likelihood fails at starting values
Hi Chris
zero LL in one class is not a problem as the average across classes will then still be non-zero
LC is notoriously sensitive to starting values. You could try a starting value search using apollo_searchStart
Stephane
zero LL in one class is not a problem as the average across classes will then still be non-zero
LC is notoriously sensitive to starting values. You could try a starting value search using apollo_searchStart
Stephane
Re: Joint model Log-likelihood fails at starting values
Dear Stephane,
Good to know that the zero LLs within one class are okay.
When running the searchStart function, I get: "100 candidates removed due to non-finite starting LL. 0 remain."
Best regards,
Chris
Good to know that the zero LLs within one class are okay.
When running the searchStart function, I get: "100 candidates removed due to non-finite starting LL. 0 remain."
Best regards,
Chris
-
- Site Admin
- Posts: 1042
- Joined: 24 Apr 2020, 16:29
Re: Joint model Log-likelihood fails at starting values
Chris
sounds like a starting values issue again, maybe with your sigmas?
Stephane
sounds like a starting values issue again, maybe with your sigmas?
Stephane