insightsengineering / rbmi

Reference based multiple imputation R package
https://insightsengineering.github.io/rbmi/
Other
16 stars 4 forks source link

Supplementing error message #371

Open harriscw opened 1 year ago

harriscw commented 1 year ago

https://github.com/insightsengineering/rbmi/blob/0e06da6505cf5afc07c01f0e5c5e7af0755b4d1c/R/draws.R#L362

Possible to also output the verbatim error (or option to do so)? e.g. "L-BFGS-B needs finite values of 'fn'"

gowerc commented 1 year ago

Maybe?

Issue is that there isn't a single failure but multiple, as in we try the optimiser I think 3 times with different starting points and configurations and only declare it a failure if all of them have failed, in which case which error message do we return as they may have failed differently....

Could return all of them but that means we may need to rework the functions a little bit to pass the failure state/message down each iteration

harriscw commented 1 year ago

Alternatively maybe just adding more info to the error message? e.g. something like MMRM failed to fit to the data via glmmTMB attempting with three optimizers when removing subject '%s'

Just a suggestion. Spent some time digging through the code trying to figure out the source of this error, am thinking maybe something like this would help avoid that?

gowerc commented 12 months ago

Hmm, I am now wondering, instead of passing back the failure messages if we can use invokeRestart or some equivalent to get the function to dump the environment contents upon failure. E.g. dump the current dataset version and mmrm call to Rds so that users can then play around with it to see what happened?