I’m happy to announce DistributionsFactories.jl, a package that solves a problem most of us have hit: you know the summary statistics you want — a mean and variance, a couple of quantiles, a mode — but you need an actual Distributions.jl object with those properties, and the named families aren’t parameterised that way.
DistributionsFactories.jl inverts that. You give it the family and the moments or quantiles, and it solves for the parameters.
In some cases, all it is doing is using an explicit solution of “moment matching” equations, and in other cases the computation under the hood is more complicated.
e.g.
using DistributionsFactories, Distributions
make_dist(Gamma, mean=5.0, var=3.0) # Gamma with exactly this mean and variance
make_dist(Normal, q1=10.0, q3=30.0) # Normal pinned to two quartiles
It also treats feasibility as first-class: dist_exists and available_distributions tell you which families can hit a given target
There are companion Python and R ports, but the Julia package is the master.
Feedback, bug reports, and requests for additional families are very welcome!
Yoni.