Loo_moment_match fails even after saving all pars

I try to run loo_moment_match() because loo() tells me: Found 7 observations with a pareto_k > 0.7 in model My target IRT testlet models often exceed 1 GB size. So with a clean R Studio workspace I start my calculation at around 1,5 GB. Then during the calculation the RAM usage goes up to 22 GB (from 32 GB build in). After some time I get the following error:

Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) : 
  Not compatible with requested type: [type=closure; target=double].
Zusätzlich: Warnmeldung:
Error in .local(object, ...) : 
  the model object is not created or not valid
Fehler: Moment matching failed. Perhaps you did not set 'save_all_pars' to TRUE when fitting your model?

I definitly saves all pars when I fitted the model (which makes a good amount of the models sizes). I have the assumption that this might be an error generaed deeper in the system. Maybe because of runnig out of RAM? I already set the objectsize in R on 7 GB because I ran in some problems fitting my models earlier. And I set the future.globals.maxSize up as well, because I needed this for kfold().

Edit: This happens also with a model around 300 MB. (I used thinning to get good ESS and maintain small model size). Although the RAM usage doesn’t exceed 5 GB in this case the error above occurs.

Has anyone a clue what the problem is and how I can overcome this obstacle?

Sincerely, Simon Schäfer

Operating System: Win10x64, 18363
Interface Version: 2.3.1
Compiler/Toolkit: ?

Sorry it took so long for someone to reply! I’m not sure about this but I wonder if it’s similar to the error in this other thread:

The error the model object is not created or not valid indicates that this may be related to the stanfit objects and environments of brms fits. The same error was encountered here when using multiple cores, and it should now be fixed in the master branch of brms.

Did you encounter this error when using 1 core, or only with multiple cores?

1 Like

Thank’s for your reply. The error disappeared somehow in the meantime.

I ran into further problems trying to update some R packages. I had no longer the right so delete the .ddl datas and so updates failed. Reinstalling rstan manually might be a key in this solving process (even if it didn’t helped the first time trying this). But then something in my tidyverse package broke.

So I reinstalled everything after deleting all files from R, RStudio, Rtools. Now it works as expected (I guess).