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.

Why can I get s.e. from BHHH matrix (when I run BFGS), but the numerical derivation produces NAN?

Ask questions about the results reported after estimation. If the output includes errors, please include your model code if possible.
Post Reply
yaoyao7031
Posts: 9
Joined: 28 Aug 2021, 01:54

Why can I get s.e. from BHHH matrix (when I run BFGS), but the numerical derivation produces NAN?

Post by yaoyao7031 »

Hi,

Thank you for providing so much help on this forum!

I have a general question when running an EMDC model embedded in a latent class framework. When the estimation is done (showing converged), it shows estimated parameters with approximate standard errors from BHHH matrix, which is all fine.

However, after "computing covariance matrixi using numeric methods (numDeriv)", some of the s.e. shows NAN. And this step takes a lot longer than the actual estimation.

May I know why I could get all the s.e. without a problem in the BHHH matrix, but not after numerical derivation? Also, why does the post-estimation process take so long compared to the estimation?

Thank you.
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Why can I get s.e. from BHHH matrix (when I run BFGS), but the numerical derivation produces NAN?

Post by stephanehess »

Hi

to help us answer this question, please provide some outputs and details about your model.

Thanks
--------------------------------
Stephane Hess
www.stephanehess.me.uk
yaoyao7031
Posts: 9
Joined: 28 Aug 2021, 01:54

Re: Why can I get s.e. from BHHH matrix (when I run BFGS), but the numerical derivation produces NAN?

Post by yaoyao7031 »

Hi Stephane,

I run an EMDC model with latent class (say there are two latent segments, the membership of which is associated with demographics, and each segment has a different set of parameters for the baseline utility and the satiation parameters). I tried to use the default BGW algorithm for optimization, but I I often cannot get the results. I have been trying to do some debugging. I realized that I often get the warning message saying: In log(Gi): NaNs produced (I found that Gi is the last term in the log form in Equation (10) of the paper Palma and Hess (2022). It seems that we cannot always ensure that this term Gi is positive in optimization procedure.)

I also found that the code some time produces the warning message: In log(Jdet) : NaNs produced. Even in the example code on the website "eMDC_with_budget", I can run the code and get the result, but still produces this warning message. So I guess Jdet is not guaranteed to be positive and may lead to the estimation fail sometimes?

I also have another question general question: is it ok to include the same covariates in both the baseline utility and satiation in the MDCEV or EMDC model?

Thank you in advance.
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Why can I get s.e. from BHHH matrix (when I run BFGS), but the numerical derivation produces NAN?

Post by stephanehess »

Hi

this sounds like an identification issue with your model - could you show us the results?

Regarding covariates, in theory yes, but in practice, identifying the effects in the satiation terms is much harder

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