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

allow edge case of negative binomial with 0 mean #366

Merged
merged 3 commits into from
Apr 28, 2023
Merged

Conversation

sbfnk
Copy link
Contributor

@sbfnk sbfnk commented Feb 8, 2023

This is how R handles it and I see no reason not to support this here instead of throwing an error

> rnbinom(n = 1, mu = 0, size = 1)
[1] 0

@seabbs seabbs changed the base branch from main to develop February 8, 2023 17:45
@seabbs
Copy link
Contributor

seabbs commented Feb 8, 2023

I think stan sees a reason (for whatever reason): "Error : Exception: Exception: neg_binomial_2_rng: Location parameter is 0, but must be > 0! (in 'functions/observation_model.stan' at line 117; included from 'model_estimate_infections' at line 7)"

@sbfnk
Copy link
Contributor Author

sbfnk commented Feb 8, 2023

I think stan sees a reason (for whatever reason): "Error : Exception: Exception: neg_binomial_2_rng: Location parameter is 0, but must be > 0! (in 'functions/observation_model.stan' at line 117; included from 'model_estimate_infections' at line 7)"

Exactly - which will no longer occur once this is merged.

@seabbs
Copy link
Contributor

seabbs commented Feb 8, 2023

Sorry, my point was why does it do this and not follow the behaviour of R.

@github-actions
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 7cc0d62 is merged into develop:

  •   :ballot_box_with_check:default: 54.5s -> 53.9s [NANaN%, NANaN%]
  •   :ballot_box_with_check:no_delays: 42.7s -> 44.9s [NANaN%, NANaN%]
  •   :ballot_box_with_check:random_walk: 11.8s -> 14.3s [NANaN%, NANaN%]
  •   :ballot_box_with_check:stationary: 27.9s -> 27.9s [NANaN%, NANaN%]
  •   :ballot_box_with_check:uncertain: 58.6s -> 57.8s [NANaN%, NANaN%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@sbfnk sbfnk mentioned this pull request Feb 10, 2023
@github-actions
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 01246d8 is merged into develop:

  •   :ballot_box_with_check:default: 51.6s -> 55.7s [NANaN%, NANaN%]
  •   :ballot_box_with_check:no_delays: 45.7s -> 48.1s [NANaN%, NANaN%]
  •   :ballot_box_with_check:random_walk: 18.8s -> 19.2s [NANaN%, NANaN%]
  •   :ballot_box_with_check:stationary: 36.5s -> 31.6s [NANaN%, NANaN%]
  •   :ballot_box_with_check:uncertain: 1m -> 56.6s [NANaN%, NANaN%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@github-actions
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if f6a0334 is merged into develop:

  •   :ballot_box_with_check:default: 49.8s -> 47.5s [-19.78%, +10.33%]
  •   :ballot_box_with_check:no_delays: 37.3s -> 38.6s [-11.46%, +18.26%]
  •   :ballot_box_with_check:random_walk: 11.8s -> 12.5s [-1.02%, +11.74%]
  •   :ballot_box_with_check:stationary: 29.8s -> 31.5s [-4.68%, +15.99%]
  •   :ballot_box_with_check:uncertain: 47.9s -> 44.5s [-17.57%, +3.53%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

Copy link
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good I think. Just needs a news file entry before it can be merged..

Base automatically changed from develop to main April 27, 2023 08:36
@seabbs seabbs changed the base branch from main to update-model-description April 27, 2023 10:34
Base automatically changed from update-model-description to main April 27, 2023 14:24
@sbfnk sbfnk force-pushed the negbin-edge-case branch from 600227f to 5cf3c59 Compare April 28, 2023 11:26
@github-actions
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 11c6fbc is merged into main:

  •   :ballot_box_with_check:default: 46.3s -> 44.1s [-13.52%, +4.36%]
  •   :ballot_box_with_check:no_delays: 38.7s -> 39.7s [-9.75%, +14.71%]
  •   :ballot_box_with_check:random_walk: 13s -> 13.3s [-7.16%, +12.52%]
  •   :ballot_box_with_check:stationary: 32.1s -> 30.4s [-17.8%, +6.68%]
  •   :ballot_box_with_check:uncertain: 46.6s -> 50.3s [-1.3%, +17.36%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@sbfnk sbfnk added this pull request to the merge queue Apr 28, 2023
Merged via the queue into main with commit 6244b20 Apr 28, 2023
@sbfnk sbfnk deleted the negbin-edge-case branch April 28, 2023 13:40
sbfnk added a commit that referenced this pull request May 3, 2024
allow edge case of negative binomial with 0 mean
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.

3 participants