# Aggregation with an overlap: Dirichlet distribution

Suppose that we have $$(p_1,p_2,p_3,p_4)\sim Dirichlet(a_1,a_2,a_3,a_4),$$ where $$p_4=1-p_1-p_2-p_3.$$

When we add random variables for example, $$p_1+p_2$$ and $$p_3+p_4$$, the resulting distributions can simply derived by the aggregation property of the Dirichlet distribution:$$(p_1+p_2,p_3+p_4)\sim Dirichlet(a_1+a_2,a_3+a_4).$$

I understand this result directly stems from the aggregation property of gamma distribution and the gamma distribution representation of the Dirichlet distribution.

However, how do we derive the distribution when there is an overlap in the sum? More specifically, when we add up $$p_1$$ and $$p_2$$ and then $$p_1$$ abd $$p_3$$, What would the joint distribution look like in this case? So, I want to know the joint distribution of the following:$$(p_1+p_2,p_1+p_3)$$

Although it does not resemble any distribution I know, it is possible to obtain a compact expression for the probability density. Denote $$W=p_1+p_2$$ and $$Z=p_1+p_3$$ then their joint density takes form:

$$f(w,z) = \int_{w+z-1}^{1} h(\xi,w-\xi,z-\xi) d\xi,$$

where $$h(p_1,p_2,p_3) = \frac{p_1^{a_1-1} p_2^{a_2-1} p_3^{a_3-1}(1-p_1-p_2-p_3)^{a_4-1}}{B(a_1,a_2,a_3,a_4)}$$ is the pdf of $$Dir(a_1,a_2,a_3,a_4)$$.

Solution:

(apologies for volume, comments are very welcome)

Denote $$F(w,z)$$ the cumulative density function of the distribution of $$(p_1+p_2,p_1+p_3)$$, where $$p_1,p_2,p_3$$ jointly with some $$p_4$$ are distributed as $$Dir(a_1,a_2,a_3,a_4)$$. By definition of CDF

$$F(w,z) = P(\{p_1 + p_2 < w \}\cap\{p1+p3

where each expression in curly braces denotes a random event.

Now, we just have to unravel that complex event into a union of disjoint ones:

\begin{align} &\begin{cases} p_1 + p_2 < w \\ p1+p3 w+z - 1 \\ p_2 \in [0, w - p_1) \\ p_3 \in [0, z - p_1) \end{cases} \end{align}

The cumulative density function is thus a sum of three components:

$$F(w,z) = F_1(w,z) + F_2(w,z) + F_3(w,z),$$ where

\begin{align} F_1(w,z) = &\int_0^{w+z-1}\int_0^{1-z} \int_0^{z-p_1} h(p_1,p_2,p_3) dp_3 dp_2 dp_1 \\ F_2(w,z) = & \int_0^{w+z-1}\int_{1-z}^{w-p_1} \int_0^{1-p_1-p_2} h(p_1,p_2,p_3) dp_3 dp_2 dp_1 \\ F_3(w,z) = & \int_{w+z-1}^{1}\int_{0}^{w-p_1} \int_0^{z-p_1} h(p_1,p_2,p_3) dp_3 dp_2 dp_1. \\ \end{align}

The simplest way ahead would be to obtain the probability density function $$f(w,z) = \frac{\partial^2}{\partial z\partial w} F(w,z)$$. Derivatives of components $$F_1,F_2,F_3$$ with respect to $$w$$ look like

\begin{align} \frac{\partial}{\partial w}F_1(w,z) = &\int_0^{1-z} \int_0^{1-w} h(w+z-1,p_2,p_3) dp_3 dp_2 \\ \frac{\partial}{\partial w}F_2(w,z) = & \int_0^{w+z-1}\int_{1-z}^{1-z} \int_0^{1-p_1-p_2} h(p_1,p_2,p_3) dp_3 dp_2 dp_1 + \int_0^{w+z-1} \int_0^{1-w} h(p_1,w-p_1,p_3) dp_3 dp_1 \\ =& \int_0^{w+z-1} \int_0^{1-w} h(p_1,w-p_1,p_3) dp_3 dp_1 \\ \frac{\partial}{\partial w} F_3(w,z) = & - \int_{0}^{1-z} \int_0^{1-w} h(w+z-1,p_2,p_3) dp_3 dp_2 + \int_{w+z-1}^{1} \int_0^{z-p_1} h(p_1,w-p_1,p_3) dp_3 dp_1. \\ \end{align}

Note that $$\frac{\partial}{\partial w}F_1(w,z)$$ cancels out with the first term of the last expression. The final PDF takes form:

\begin{align} f(w,z) =& \frac{\partial}{\partial z} \left(\int_0^{w+z-1} \int_0^{1-w} h(p_1,w-p_1,p_3) dp_3 dp_1 + \int_{w+z-1}^{1} \int_0^{z-p_1} h(p_1,w-p_1,p_3) dp_3 dp_1\right) =\\ =&\int_0^{1-w} h(w+z-1,1-z,p_3) dp_3 - \int_0^{1-w} h(w+z-1,1-z,p_3) dp_3 +\\ &+ \int_{w+z-1}^{1} h(p_1,w-p_1,z-p_1) dp_1 =\\ =& \int_{w+z-1}^{1} h(p_1,w-p_1,z-p_1) dp_1 \end{align}

and we stop here.