| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Jenkins Console Log Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal CPU: G++: Clang: |
Sorry, something went wrong.
|
@lingium not a review itself, but wanted to chime in to say super nice work so far! It's no small feat to have a PR pass CI on the first try; I hardly do myself even now. Nice meeting you at StanCon, and glad you're contributing to Stan! |
Sorry, something went wrong.
Hey @WardBrian, thanks for your support! It was a pleasure meeting you at StanCon as well. I'm glad to be contributing to Stan :) |
Sorry, something went wrong.
|
Seems like I forgot to pull pre-commit hook's commit to local |
Sorry, something went wrong.
|
May have to require your approval to one of the workflows to continue |
Sorry, something went wrong.
Jenkins Console Log Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal CPU: G++: Clang: |
Sorry, something went wrong.
Jenkins Console Log Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal CPU: G++: Clang: |
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good to me! Will github let you press the merge button? If not I can, though we use to be able to let contributors click the button themselves which imo feels nice
Sorry, something went wrong.
|
Thanks for the review @SteveBronder! From my side it says merging is blocked, so please go ahead from your end |
Sorry, something went wrong.
|
@lingium check your email. You should have received an invite to the stan org and with that I believe you will be able to click the merge button :) |
Sorry, something went wrong.
|
Hi @SteveBronder, got the invite. I was tagged as a collaborator now but don't seem to have merge pr permission |
Sorry, something went wrong.
|
Yes, it's working now! |
Sorry, something went wrong.
|
@lingium are you also interested in adding this to the compiler yourself, or would you prefer another developer do that part? It's easy enough for me to do if you want to provide a list of signatures you'd expect support for |
Sorry, something went wrong.
|
@WardBrian could you help me to add this time? Cuz it's super easy for you. Here's list of signatures real beta_neg_binomial_lpmf(int n, real r, real alpha, real beta); real beta_neg_binomial_lpmf(int n, vector r, real alpha, real beta); real beta_neg_binomial_lpmf(int n, real r, vector alpha, real beta); real beta_neg_binomial_lpmf(int n, real r, real alpha, vector beta); real beta_neg_binomial_lpmf(int n, vector r, vector alpha, real beta); real beta_neg_binomial_lpmf(int n, vector r, real alpha, vector beta); real beta_neg_binomial_lpmf(int n, real r, vector alpha, vector beta); real beta_neg_binomial_lpmf(int n, vector r, vector alpha, vector beta); real beta_neg_binomial_lpmf(array[] int n, real r, real alpha, real beta); real beta_neg_binomial_lpmf(array[] int n, vector r, real alpha, real beta); real beta_neg_binomial_lpmf(array[] int n, real r, vector alpha, real beta); real beta_neg_binomial_lpmf(array[] int n, real r, real alpha, vector beta); real beta_neg_binomial_lpmf(array[] int n, vector r, vector alpha, real beta); real beta_neg_binomial_lpmf(array[] int n, vector r, real alpha, vector beta); real beta_neg_binomial_lpmf(array[] int n, real r, vector alpha, vector beta); real beta_neg_binomial_lpmf(array[] int n, vector r, vector alpha, vector beta); Another thing is, we would prefer small PRs, right? If so for the cdf, lcdf, lccdf, and rng, I will submit in different PRs. |
Sorry, something went wrong.
|
I’ll take a look at that today! And yes, it is easiest if they are each in their own PR. If I remember correctly from Stan Con, isn’t there also an alternative parameterization you are interested in? |
Sorry, something went wrong.
|
Thanks Brian! Yes, there is an alternative parameterization. It becomes neg_binomial_2 when one of the parameters is equal to 0. Except for that, I'm planning Waring and Yule distribution, both are special cases of beta negative binomial. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
With this PR the lpmf of beta negative binomial distribution are added.
See issue #3107
Expressions involved:
PMF
$$f(n|r, \alpha ,\beta)={\frac {\Gamma (r+n)}{n!\Gamma (r)}}{\frac {\Gamma (\alpha +r)\Gamma (\beta +n)\Gamma (\alpha +\beta )}{\Gamma (\alpha +r+\beta +n)\Gamma (\alpha )\Gamma (\beta )}}$$
Partial derivatives w.r.t the three parameters
$$ \begin{aligned} \frac{\partial \log f}{\partial r} &= \psi(n+r) - \psi(n+r+\alpha+\beta) - \psi(r) + \psi(r+\alpha) \\ \frac{\partial \log f}{\partial \alpha} &= \psi(\alpha+\beta) - \psi(n+r+\alpha+\beta) - \psi(\alpha) + \psi(r+\alpha) \\ \frac{\partial \log f}{\partial \beta} &= \psi(\alpha+\beta) - \psi(n+r+\alpha+\beta) + \psi(n+\beta) - \psi(\beta) \end{aligned} $$
Tests
Test is written follow the guide.
Side Effects
No.
Release notes
beta_neg_binomial_lpmf is available if merged. Allows modeling heavy-tail count data.
Checklist
Copyright holder: Zhi Ling
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested