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.

Error in length(apollo_inputs$apollo_scaling) > 0 && !is.na(apollo_inputs$apollo_scaling)

Ask questions about the results reported after estimation. If the output includes errors, please include your model code if possible.
Post Reply
CDG
Posts: 2
Joined: 21 Sep 2021, 15:35

Error in length(apollo_inputs$apollo_scaling) > 0 && !is.na(apollo_inputs$apollo_scaling)

Post by CDG »

Hi,

I have been trying to use the EM algorithm to estimate a latent class-choice model with Apollo.

Since I kept getting errors in the procedure, I decided to follow the last two examples on the website (EM_LC_no_covariates and EM_LC_with_covariates) to see what was wrong with my code. However, I got exactly the same error when running these files using the Swissmetro dataset:

Code: Select all

Error in length(apollo_inputs$apollo_scaling) > 0 && !is.na(apollo_inputs$apollo_scaling) : 
  'length = 13' in coercion to 'logical(1)'
I have already tried several options for the "postEM" setting under lcEM_settings (i.e., 0, 1 or 2), and I have also upgraded to version 0.2.9.

I would be very thankful to get any orientation about what to do next?

Thanks for your work and for any help you can provide!

CDG
dpalma
Posts: 190
Joined: 24 Apr 2020, 17:54

Re: Error in length(apollo_inputs$apollo_scaling) > 0 && !is.na(apollo_inputs$apollo_scaling)

Post by dpalma »

Hi,

Thank you for letting us know about this issue. This is indeed a bug in v0.2.8. We will fix it in the next official release, but in the meantime, I created a new version where the bug is fixed. You can download this new version from the links below. Choose the version for your computer's operating system:

Apollo v0.3.0 (beta) for Windows
Apollo v0.3.0 (beta) for Linux (source)

If you are using mac, please let me know and I will try generating a version for you, but it might take a couple of day.

You can install the package in RStudio by going to the menu bar (the menu at the top of the screen) and select Tools > Install Packages... . Then, in the window that will open, you select "Package archive" on the top drop-down menu. That will open another window to pick a file. Select the file you downloaded, and then click "Install".

Best wishes
David
CDG
Posts: 2
Joined: 21 Sep 2021, 15:35

Re: Error in length(apollo_inputs$apollo_scaling) > 0 && !is.na(apollo_inputs$apollo_scaling)

Post by CDG »

Hi David,

Thanks for your prompt response!

I will try with this updated version. I use Windows so I don't think there should be any problems.

Best wishes,
Post Reply