# Marginal distribution with weight

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

$$P_m(\mathbf{x})=\sum\int_{\mathbf{y}}P(\mathbf{x},\mathbf{y})W(\mathbf{y})$$

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

MarginalDistribution[dist,{k1,k2,…}]


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?

• 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. – JimB Jun 8 '15 at 0:34
• 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. – highsciguy Apr 20 '16 at 14:45
• 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. – JimB Apr 20 '16 at 15:44
• I mean that both are valid uni- or mult-ivariate ProbabilityDistribution's. – highsciguy Apr 20 '16 at 15:46