-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Error in if (varx == 0) { : missing value where TRUE/FALSE needed" with fit$loo() but not loo::loo(fit$draws("log_lik")) #272
Comments
Thanks for reporting this, that's strange. I'm glad at least |
Hey, thanks for the help. traceback() gives me the following:
Also, I think the same error is causing the following problem with the priorsense packages:
Is it likely to be an error I've made with the |
Ah, I think this might be an issue with calling |
@avehtari In cmdstanr's loo method we have: r_eff <- loo::relative_eff(exp(LLarray), cores = r_eff_cores) If the issue is that the log ratios are too small, should we change it to something like this? r_eff <- loo::relative_eff(exp(LLarray + max(-LLarray)), cores = r_eff_cores) |
Hey @jgabry, I don't get the error with |
FWIW, when I try to do stacking I also get the following error:
|
It seems to have something to do with the initial values used for the optimization step in the stacking algorithm (I guess you could try changing the optimization method that's used, there's an argument for that, but not sure it will make a difference). This might be hard for me to debug without an example I can play with. Or maybe @avehtari or @yao-yl have an idea. |
Yes It seems all the reported problems come from at least for one of the LOO folds, the importance ratios under- or overflow (fixed by subtracting the max) and the one importance ratio dominating (subtracting the max is not enough). It should be possible to add additional checks to avoid errors, but the resulting comparisons and model weights are still unreliable with that bad importance ratio distributions. @mhollanders can you share the log_lik draws? |
Hi @avehtari, sorry for taking so long with this. I've attached the draws, hopefully a .csv is fine (I wasn't able to send the |
@mhollanders a fix was already merged, can you try by installing loo from github? |
Hey @avehtari, I installed loo from Github and also updated cmdstanr to the development version. I'm still getting the following:
and:
|
@mhollanders is there any way you could share the fit1 object (Dropbox or something?) so that I could test With the |
Hey @avehtari, sorry for taking so long to respond. I have a link here that you should be able to download it with. Re: the high Pareto-k's, I'm finding these to be super high even where the model recovers the DGP input when there's site-level random effects. I didn't realise you couldn't still use the stacking to get the best predictive performance, irrespective of the Pareto-k. |
Hey @avehtari, sorry to re-hash this, but it's still an issue where loo::loo() works fine but fit$loo() does not. I've re-attached a csv of posterior draws, as well as a figure of the site-level log_liks separated by region to visualise. |
Hi,
Unfortunately I don't have a reproducible example because this is just popping up with a few versions of a big model. When I fit the model with cmdstanr, the following works:
But this doesn't:
I checked and there's no NAs anywhere:
Does anyone have any idea? Sorry I can't be more helpful with reproducible code. I'd be happy to share the Stan program with simulation file.
Thanks,
Matt
The text was updated successfully, but these errors were encountered: