I have two i.i.d. binomial variables $X$ and $Y$ with given $n$ and $p.$
What is probability mass function of $Z = X \times Y$? I need pmf as function
$f(Z, n, p).$
Binomial Distribution – How to Calculate Probability Mass Function of Product of Two Binomial Variables
binomial distributiondensity function
Best Answer
There are various ways you could write the mass function of this distribution. All of them will be messy, since they involve checking the possible products that give a stipulated value for the product variable. Here is the most obvious way to write the distribution.
Let $X, Y \sim \text{IID Bin}(n, p)$ and let $Z=XY$ be their product. For any integer $0 \leqslant z \leqslant n^2$ we define the set of pairs of values:
$$\mathcal{S}(z) \equiv \{ (x,y) \in \mathbb{N}_{0+}^2 \mid \max(x,y) \leqslant n, xy=z \}.$$
This is the set of all pairs of values within the support of the binomial that multiply to the value $z$. (Note that it will be an empty set for some values of $z$.) We then have:
$$\begin{equation} \begin{aligned} p_Z(z) \equiv \mathbb{P}(Z=z) &= \mathbb{P}(XY=z) \\[6pt] &= \sum_{(x,y) \in \mathcal{S}(z)} \text{Bin}(x\mid n,p) \cdot \text{Bin}(y\mid n, p) \\[6pt] &= \sum_{(x,y) \in \mathcal{S}(z)} {n \choose x} {n \choose y} \cdot p^{x+y} (1-p)^{2n-x-y}. \end{aligned} \end{equation}$$
Computing this probability mass function requires you to find the set $\mathcal{S}(z)$ for each $z$ in your support. The distribution has mean and variance:
$$\mathbb{E}(Z) = (np)^2 \quad \quad \quad \quad \quad \mathbb{V}(Z) = (np)^2 [(1-p+np)^2 - (np)^2].$$
The distribution will be quite jagged, owing to the fact that it is the distribution of a product of discrete random variables. Notwithstanding its jagged distribution, as $n \rightarrow \infty$ you will have convergence in probability to $Z/n^2 \rightarrow p^2$.
Implementation in
R
: The easiest way to code this mass function is to first create a matrix of joint probabilities for the underlying random variables $X$ and $Y$, and then allocate each of these probabilities to the appropriate resulting product value. In the code below I will create a functiondprodbinom
which is a vectorised function for the probability mass function of this "product-binomial" distribution.We can now easily generate and plot the probability mass function of this distribution. For example, with $n=10$ and $p = 0.6$ we obtain the following probability mass function. As you can see, it is quite jagged, owing to the fact that the product values are distributed in a lagged pattern over the joint values of the underlying random variables.