-
Notifications
You must be signed in to change notification settings - Fork 428
Add generalized inverse Gaussian and generalized hyperbolic #1982
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
base: master
Are you sure you want to change the base?
Conversation
One design issue I'm not sure how to solve is implementing multiple parameterizations of the same distribution. In particular, I want the usual Distributions.jl/test/univariate_bounds.jl Lines 59 to 60 in 46bb0c3
|
|
||
Wolfram Language parameterization, equivalent to `InverseGamma(μ, λ)` | ||
""" | ||
GeneralizedInverseGaussian(; μ::Real, λ::Real, θ::Real=-1/2) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I wanted to have a different parameterization, but tests assume that one can call GeneralizedInverseGaussian()
with no arguments. The test fails because GeneralizedInverseGaussian
has mandatory keyword arguments here.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1982 +/- ##
==========================================
+ Coverage 86.28% 86.38% +0.09%
==========================================
Files 146 148 +2
Lines 8787 9018 +231
==========================================
+ Hits 7582 7790 +208
- Misses 1205 1228 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…very large `x` in `logpdf`.
This is at least the third attempt at implementing the generalized inverse Gaussian (GIG) distribution to close #554. Previous attempts by other people: #587 (closed, last activity in 2019), #1300 (open, last activity in 2021).
Features of this implementation:
rand
closely follows Devroye, Luc. 2014. “Random Variate Generation for the Generalized Inverse Gaussian Distribution.” Statistics and Computing 24 (2): 239–46. https://doi.org/10.1007/s11222-012-9367-z. Single algorithm for all values of parameters, as opposed to multiple algos in Add Generalized inverse Gaussian Distribution #1300. In my evaluation, the Kolmogorov-Smirnov test fails to reject the null, thus verifying that samples agree with the true GIG for multiple parameter values.quadgk
), mean, variance, MGF, CF etc from Wikipedia and Wolfram Mathematica.I also implemented, documented and tested the generalized hyperbolic distribution with sampling based on GIG. This probably should be a separate pull request, but they're very related, so the generalized hyperbolic is here for now.