Skip to content
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

Hotfix/issue 80 sdm likelihood evaluation explodes for extremely high kappa #91

Conversation

venpopov
Copy link
Owner

Summary

Set init=1 as an additional argument to the output list of configure_args from sdmSimple(). By default stan samples initial values for parameters uniformly on [-2,2], which causes sampling to fail if random effect sds on log(kappa) are initialized close to 2, because some subjects get native kappa value of > exp(15), causing the numerical integration to fail. Setting init to 1 means that Stan will sample in the range [-1,1].

I tested it with a bunch of seeds and so far it seems to have solved the problem. I am working on a custom function to easily set inits for bmmmodels for any model formula, but for now this hotfix should help with the sampling failure (which is rare though).

Added a function combine_args() to ensure that if a user provides their own inits, or any other argument they want to overwrite (except for family), the fit_model function will replace the default bmm arguments with the user ones.

Tests

[x] Confirm that all tests passed
[x] Confirm that devtools::check() produces no errors

Release notes

  • Fixed a bug with sampling failure in rare cases for strange initial values for the sdmSimple() model

@venpopov venpopov linked an issue Feb 10, 2024 that may be closed by this pull request
Copy link

codecov bot commented Feb 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c48148e) 66.09% compared to head (8f49ae0) 66.48%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #91      +/-   ##
===========================================
+ Coverage    66.09%   66.48%   +0.39%     
===========================================
  Files           14       14              
  Lines          926      937      +11     
===========================================
+ Hits           612      623      +11     
  Misses         314      314              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GidonFrischkorn GidonFrischkorn merged commit 80993ed into develop Feb 12, 2024
6 checks passed
@GidonFrischkorn GidonFrischkorn deleted the hotfix/issue-80-sdm-likelihood-evaluation-explodes-for-extremely-high-kappa branch February 12, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDM likelihood evaluation explodes for extremely high kappa
2 participants