Page 1 of 1

Bug in apollo_prediction

Posted: 10 Feb 2021, 00:01
by tomas.rossetti
Hi,

I'm encountering an error in apollo_prediction. Here's the message:

Code: Select all

forecast = apollo_prediction(model, apollo_probabilities, inputs)
Your model contains continuous random parameters. apollo_prediction will perform averaging across draws
  for these. For predictions at the level of individual draws, please call the apollo_probabilities
  function using model$estimate as the parameters, and with functionality="raw".
Running predictions from model using parameter estimates...
Predicted aggregated demand at model estimates
Error in colSums(M, na.rm = TRUE) : 'x' must be numeric
I'm running this on a Mac using version 0.2.2 and R 4.0.3.

Thanks!

Re: Bug in apollo_prediction

Posted: 11 Feb 2021, 17:15
by stephanehess
Tomas

thanks, but we need some more details, e.g. on the model you're using

Thanks

Stephane

Re: Bug in apollo_prediction

Posted: 11 Feb 2021, 17:29
by tomas.rossetti
It is a mixed logit model in WTP space, 2500 Sobol draws, and three alternatives.

Please let me know if you'd like more information, I'd be happy to help.

Re: Bug in apollo_prediction

Posted: 11 Feb 2021, 18:37
by stephanehess
Tomas

thanks for sending me the data to test. This is indeed a bug, and is caused by the fact that the respondent IDs in your data are characters rather than numbers. R then turns the whole matrix of predictions into characters, and then can't take the average.

Until we fix this bug in v.0.2.4, the easy workaround for you is to turn your IDs into numeric ones

Best wishes

Stephane

Re: Bug in apollo_prediction

Posted: 11 Feb 2021, 19:37
by tomas.rossetti
Thank you Stephane.

Just so you know, I've also noticed that posterior parameter means and standard deviations obtained using apollo_conditionals are returned as characters instead of numbers. It's not much of a problem, but the same numbers to characters issue could be behind that.

All the best,

Tomás

Re: Bug in apollo_prediction

Posted: 12 Feb 2021, 13:07
by dpalma
Thank you for pointing this out, Tomás. We will fix it in v0.2.4.

Cheers
David