Description
Description
We are looking for help to implement inverse cumulative distribution (ICDF) functions for our distributions!
How to help?
This PR should give a template on how to implement and test new icdf functions for distributions: #6528
ICDF functions allow users to get the value associated with a specific cumulative probability.
So far we've added 2 examples for continuous distribution
- Uniform:
pymc/pymc/distributions/continuous.py
Lines 348 to 351 in 2fcce43
- Normal:
pymc/pymc/distributions/continuous.py
Lines 541 to 548 in 2fcce43
And an example for a discrete distribution:
- Geometric:
pymc/pymc/distributions/discrete.py
Lines 824 to 832 in 2fcce43
Multiple sources describing the icdf function for any specific distribution can be found, you're free to choose which one is working for you. To start with I recommend checking:
- https://help.imsl.com/c/2016/html/cnlstat/index.html#page/CNL%2520Stat%2Fcsch11.14.01.html%23
- Wikipedia,
E.g.: https://en.wikipedia.org/wiki/Normal_distribution
It should be called "Quantile" as on the screenshot above.
New tests have to be added in test_continuous.py for continuous distributions, and test_discrete.py for discrete ones. You can use existing tests as a template:
pymc/tests/distributions/test_continuous.py
Lines 282 to 286 in 2fcce43
Don't hesitate to ask any questions. You can grab as many distributions to implement moments as you want. Just make sure to write in this issue so that we can keep track of it.
Profit with your new open source KARMA!
The following distributions don't have an icdf method implemented:
- Beta Add icdf functions for Beta, Gamma, Chisquared and StudentT distributions #6845
- Kumaraswamy Add ICDF for the Kumaraswamy distribution #6642
- Exponential Added ICDF for the exponential distribution #6641
- Laplace Implement ICDF for Laplace and Pareto distributions #6707
- StudentT Add icdf functions for Beta, Gamma, Chisquared and StudentT distributions #6845
- Cauchy Add icdf function for Cauchy and Logistic distributions #6747
- HalfCauchy
- Gamma Add icdf functions for Beta, Gamma, Chisquared and StudentT distributions #6845
- HalfNormal
- Weibull Add icdf functions for Moyal, Gumbel, Triangular and Weibull distributions #6802
- LogNormal Add icdf functions for Lognormal, Half Cauchy and Half Normal distributions #6766
- HalfStudentT
- ChiSquared
- Wald
- Pareto Implement ICDF for Laplace and Pareto distributions #6707
- InverseGamma
- ExGaussian
- Binomial
- BetaBinomial
- Poisson
- NegativeBinomial
- DiracDelta
- DiscreteUniform Added ICDF for the discrete uniform distribution. #6617
- HyperGeometric
- Categorical
- DensityDist (allow user to pass one, or try to infer like we do for logp/logcdf already)
- AsymmetricLaplace
- SkewNormal
- Triangular Add icdf functions for Moyal, Gumbel, Triangular and Weibull distributions #6802
- DiscreteWeibull
- Gumbel Add icdf functions for Moyal, Gumbel, Triangular and Weibull distributions #6802
- Logistic Add icdf function for Cauchy and Logistic distributions #6747
- LogitNormal
- Interpolated
- Rice
- Moyal Add icdf functions for Moyal, Gumbel, Triangular and Weibull distributions #6802
- PolyaGamma
- Mixture (requires an interative algorithm based on the logcdf, see here)
Note that not all of the icdf equations will have closed solution, so it's recommended to first start with the ones that can be found in closed form, as they will be easier to implement and will contribute to the task further with providing other contributors with templates to understand the topic better. The list above is not final, and I'll try to update it to contain all distributions available for taking.