Page 2 of 2

Re: Joint model Log-likelihood fails at starting values

Posted: 08 Aug 2023, 14:13
by ChrisDjie
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
Loglikelihoods_2class_model.png
Loglikelihoods_2class_model.png (75.22 KiB) Viewed 4922 times

Re: Joint model Log-likelihood fails at starting values

Posted: 09 Aug 2023, 17:32
by stephanehess
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

Posted: 10 Aug 2023, 10:27
by ChrisDjie
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

Re: Joint model Log-likelihood fails at starting values

Posted: 10 Aug 2023, 10:41
by stephanehess
Hi

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

Posted: 10 Aug 2023, 10:55
by ChrisDjie
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

Re: Joint model Log-likelihood fails at starting values

Posted: 15 Aug 2023, 10:41
by ChrisDjie
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

Re: Joint model Log-likelihood fails at starting values

Posted: 15 Aug 2023, 10:51
by stephanehess
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

Re: Joint model Log-likelihood fails at starting values

Posted: 15 Aug 2023, 11:09
by ChrisDjie
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

Re: Joint model Log-likelihood fails at starting values

Posted: 17 Aug 2023, 15:13
by stephanehess
Chris

sounds like a starting values issue again, maybe with your sigmas?

Stephane