Page 1 of 1

Example 2 does not run

Posted: 11 Aug 2021, 20:42
by firstenor
I am running a new installation of 2.5. Example 1 ran OK, but Example 2 crashed. Output shown below.


Preparing bootstrap.
Parameters and LL in each repetition will be written to: Apollo_example_2_bootstrap_params.csv
Vectors showing sampling rate for each observation in each repetition written to:
Apollo_example_2_bootstrap_samples.csv

Estimation cycle 1 (7000 obs)

Error in apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, :
Log-likelihood calculation fails at values close to the starting values!

Re: Example 2 does not run

Posted: 12 Aug 2021, 11:07
by dpalma
Hi,

Example 2, as presented in the webpage, does not include bootstrap, so I am guessing you modified the example to include it. Could you share your code? Then I can reproduce the problem and help you fix it.

Cheers
David

Re: Example 2 does not run

Posted: 12 Aug 2021, 13:22
by firstenor
I just started using Apollo. I wouldn't know how to modify the code. I downloaded the example files from http://www.apollochoicemodelling.com/fi ... v0.2.4.zip, opened Apollo_example_2.r in RStudio, and ran it. Example 1 ran without a hitch. Example 2 lines 113 to 118 include a bootstrap setting.

113 # ################################################################# #
114 #### MODEL ESTIMATION ####
115 # ################################################################# #
116
117 model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs,
118 estimate_settings = list(bootstrapSE=30))

Re: Example 2 does not run

Posted: 12 Aug 2021, 15:33
by dpalma
Hi,

You are right that there's a problem when running bootstrap from inside apollo_estimate. It is apparently a bug introduced in v0.2.5. Thank you for pointing it out to us.

You can do any of two thing to avoid the problem. The first alternative is simply to not do bootstrapping. To do this, you just have to change the call to apollo_estimate to the following:

Code: Select all

model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
If you still want to do bootstrap, then you can first estimate the model, and then do the bootstrapping, as follows:

Code: Select all

model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
boot = apollo_bootstrap(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
sqrt(diag(boot$varcov)) # bootstrap s.e. of parameters
We'll fix this in the next version.

Cheers
David

Re: Example 2 does not run

Posted: 12 Aug 2021, 19:00
by firstenor
This is great software support. I'm looking forward to using Apollo for advanced choice modeling.