Given a multi-variate distribution $P(\mathbf{x},\mathbf{y})$, I would like to obtain the marginal distribution


In my specific application $P$ depends on three variables (and is discrete) and $W$ only on one (and is a continuous Gauss-distribution with given mean and variance).

Mathematica comes with the built-in


which seems to do this for $W(y)=1$. Is there any other function which does what I need or a compact way to implement this as a module?

  • $\begingroup$ In Mathematica 10.1 the documentation states: "For a multivariate ProbabilityDistribution definition, all variables need to be either discrete or continuous; no mixed cases can occur." And a ProbabilityDistribution is what MarginalDistribution requires. If W represents a random effect for the parameters of a discrete distribution and you're trying integrate out the random effect, then I think it unlikely that you'll find a closed-solution for very many discrete distributions. Maybe giving more details about the discrete distribution would get you more specific help. $\endgroup$ – JimB Jun 8 '15 at 0:34
  • $\begingroup$ I think that this misses the point, but maybe that's because I was not clear enough. Both, P and W are, consistent distributions. P is a continuous distribution in x and y while W is a HistogramDistribution. That is, it can be evaluated for arbitrary continuous y but changes only discretely. The basic problem with MarginalDistribution is that it does not allow me to specify a weight function, independently of whether it changes continuously or discretely. $\endgroup$ – highsciguy Apr 20 '16 at 14:45
  • $\begingroup$ I don't know the term "consistent distributions". Do you mean "continuous distributions" ? To get more folks to weigh in here, giving a specific example would help. $\endgroup$ – JimB Apr 20 '16 at 15:44
  • $\begingroup$ I mean that both are valid uni- or mult-ivariate ProbabilityDistribution's. $\endgroup$ – highsciguy Apr 20 '16 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.