Feature request: permit location of 0/negative_infinity() in neg_binomial_2(_log)_lpmf
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Good day,
It is currently possible to have location parameter of 0 in poisson_lpmf and negative_infinity() in poisson_log_lpmf; I've also verified this works with the _glm functions:
model {
real works = poisson_lpmf(1 | 0),
works2 = poisson_log_lpmf(1 | negative_infinity());
}
However, this is not possible with neg_binomial_2 functions:
model {
real fails = neg_binomial_2_lpmf(1 | 0, 1),
fails2 = neg_binomial_2_log_lpmf(1 | negative_infinity(), 1);
}
which errors out with:
Exception: neg_binomial_2_lpmf: Location parameter is 0, but must be positive finite!
I think it would be reasonable to permit similar behaviour as for the Poisson functions?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the neg_binomial_2_lpmf and neg_binomial_2_log_lpmf entry points, and compare their location validation with poisson_lpmf and poisson_log_lpmf. Done means the negative-binomial functions accept the requested zero and negative_infinity() cases consistently with the Poisson functions, with the relevant behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100