From @lrnv at JuliaStats/Distributions.jl#418 (comment):
@sethaxen A few questions:
-
Have you seen what we did in Copulas.jl on the same subject ?
-
Do you have specific bindings for multivriate distribution simplemented in Distributions.jl, or generic paths for any multivariate dist, or both ?
-
Do you think we could implement some package extension to allow our interface to use your methods and/or vice-versa ?
RE (3), yes, I think implementing either/both interfaces in an extension would be very straightforward. To me it makes more sense to implement the PartitionedDistributions interface (in particular conditional/marginal) for Copula's distributions than the other way around (since I would guess any package using your interface does so because they assume a copula structure). The overloads could live anywhere, but I also think it makes more sense to be an extension here.
I'm working on a refactor to make PartitionedDistributions a little easier to extend, so if this plan sounds good, I can open a PR here with an extension when it's ready.
A few comments/notes:
PartitionedDistributions.conditional takes as arguments a point x in the support as well as the indices keep of the elements that remain in the support after conditioning. This is because for higher-dimensional array-variate distributions (Matrix-variate, etc), I found it much easier to type-inferrably determine the type of the output distribution if we can infer it directly from the user-provided input x[keep]. These indices are the inverse of those accepted by Copulas.condition.
- I believe
PartitionedDistributions.marginal and Copulas.subsetdims describe the same operation.
PartitionedDistributions.pointwise_conditional_logpdfs!! has a fallback method that works for anything that implements conditional, but often a more efficient implementation is available. I wonder if there's anything in your API or internal functions that would support this.
From @lrnv at JuliaStats/Distributions.jl#418 (comment):
RE (3), yes, I think implementing either/both interfaces in an extension would be very straightforward. To me it makes more sense to implement the PartitionedDistributions interface (in particular
conditional/marginal) for Copula's distributions than the other way around (since I would guess any package using your interface does so because they assume a copula structure). The overloads could live anywhere, but I also think it makes more sense to be an extension here.I'm working on a refactor to make PartitionedDistributions a little easier to extend, so if this plan sounds good, I can open a PR here with an extension when it's ready.
A few comments/notes:
PartitionedDistributions.conditionaltakes as arguments a pointxin the support as well as the indiceskeepof the elements that remain in the support after conditioning. This is because for higher-dimensional array-variate distributions (Matrix-variate, etc), I found it much easier to type-inferrably determine the type of the output distribution if we can infer it directly from the user-provided inputx[keep]. These indices are the inverse of those accepted byCopulas.condition.PartitionedDistributions.marginalandCopulas.subsetdimsdescribe the same operation.PartitionedDistributions.pointwise_conditional_logpdfs!!has a fallback method that works for anything that implementsconditional, but often a more efficient implementation is available. I wonder if there's anything in your API or internal functions that would support this.