In Distributions.jl is it possible to create a cartesian product distribution, given two univariate random variables? I want to do this to make a multivariate uniform distribution supported over [0,1]\times[0,1]
There’s no tooling for this at the moment, but there are several issues describing it. It’s pretty easy to use the existing distributions code as a template to create a new distribution.
Ok. Understood. Thanks.
I have a small package implementing this that I use for MC where the product distribution is the prior. BayesianTools.jl. There is no documentation at the moment, but the test directory has the basic use cases.
yes! this seems like exactly what I need. Thanks. I just wanted to make a
multi-dimensional uniform distribution for MC.
@nbren12 Since you were interested in this, I put some effort to update the package, include more thorough testing, and add a brief documentation. Let me know if this is useful to you and how can be improved.
Isn’t sampling from a multi-dimensional uniform distribution just given by
n = 3 # dimension x = rand(n)
I guess you might want different ranges in different dimensions though.
Distributions.jl does more than just sampling. It stores the pdf and other info which are necessary for doing things like Bayesian statistics.
Thanks! I will definitely take a closer look
Right, but everything is very trivial in the particular case of uniform distributions.
Certainly for non-uniform distributions, something more would be useful – maybe it could be refactored out of
BayesianTools.jl into a separate package or part of
Distributions.jl? cc @gragusa
We’ve got some issues about this product idea for Distributions. The main difficulty is whether you want to support arrays or tuples. I prefer tuples because you can handle heterogeneous types, but that creates other issues.
Yes I struggle with this myself. I just went for tuples because it seemed more natural and handle heterogeneity (alternatively you could go with generated functions, but it seems overkill to me). I just put this together because I needed it and I am not claiming that this is the best implementation — I just find this useful for the MCMC stuff I do.
@dpsanders happy to factor out whathever it is relevant
I am interested in learning if there has been any progress on product distributions in Distributions.jl or
BayesianTools.ProductDistributionsl is still the way to go?