What is the distribution function for the sum of N discrete variables [0,1,2]

81 Views Asked by At

say I have N discrete variables. The first variable has to be 2. The second variable can either be 1 or 2, but not 0. The remaining can either be 0,1 or 2.

What is the distribution of the sum of these variables? Can it be explicitly expressed?

i.e Given some number Y, How many ways are there for the N variables to sum to Y?

  • As stated in the comments, lets assume the variables are independent and uniform
2

There are 2 best solutions below

0
On BEST ANSWER

Let's disregard the first two variables, which can be easily managed out of the sum, and let's answer to the question which is the number of compositions of $S-3$ (or $S-4$) into $N-2$ parts, restricted to be in $\{0,1,2 \}$ ?

Well, in the general case in which we are looking for $$N_{\,b} (s,r,m) = \text{No}\text{. of solutions to}\;\left\{ \begin{gathered} 0 \leqslant \text{integer }x_{\,j} \leqslant r \hfill \\ x_{\,1} + x_{\,2} + \cdots + x_{\,m} = s \hfill \\ \end{gathered} \right.$$ the exact answer is given by the finite sum

$$ N_b (s,r,m)\quad \left| {\;0 \leqslant \text{integers }s,m,r} \right.\quad = \sum\limits_{\left( {0\, \leqslant } \right)\,\,k\,\,\left( { \leqslant \,\frac{s}{r+1}\, \leqslant \,m} \right)} {\left( { - 1} \right)^k \binom{m}{k} \binom { s + m - 1 - k\left( {r + 1} \right) } { s - k\left( {r + 1} \right)}\ } $$ as explained in this related post.

If you are looking for asymptotic approximations for large $s$ and $m$, then you can approximate the discrete variable with a uniform continuos variable ranging on $[-1/2, r+1/2]$, thus with mean $r/2$ and variance $(r+1)^2/12$.
The sum of $m$ uniform independent variables as above quickly approach the normal distribution $$ \eqalign{ & p_{\,b} (s;r,m) = {{N_{\,b} (s,r,m)} \over {\left( {r + 1} \right)^{\,m} }} \approx {1 \over {\sqrt {2\pi m\sigma ^{\,2} } }}e^{\, - \,{{\left( {s - m\mu } \right)^{\,2} } \over {2m\sigma ^{\,2} }}} \cr & = {{\sqrt {6/\pi } } \over {\sqrt {m\left( {\left( {r + 1} \right)^{\,2} } \right)} }}e^{\, - \,6{{\left( {s - mr/2} \right)^{\,2} } \over {m\left( {\left( {r + 1} \right)^{\,2} } \right)}}} \cr} $$

10
On

As noted in a comment, there’s not enough information to answer the question about the distribution. To find the number of ways that the $N$ variables can sum to $Y$, denote the second variable by $x_2$ and the numbers of remaining variables that are $j$ by $a_j$ and write

\begin{eqnarray} 2+x_2+0a_0+1a_1+2a_2&=&Y\;,\\ 1+1+a_0+a_1+a_2&=&N\;. \end{eqnarray}

Now you can express $a_0$ and $a_1$ in terms of $a_2$ and $x_2$:

\begin{eqnarray} a_0&=&N-Y+a_2+x_2\;,\\ a_1&=&Y-2-2a_2-x_2\;. \end{eqnarray}

Thus the count is

$$ \sum_{x_2=1}^2\sum_{a_2=\max(0,Y-N-x_2)}^{\left\lfloor\frac{Y-2-x_2}2\right\rfloor}\binom{N-2}{N-Y+a_2+x_2,Y-2-2a_2-x_2,a_2}\\=\sum_{x_2=1}^2\sum_{a_2=\max(0,Y-N-x_2)}^{\left\lfloor\frac{Y-2-x_2}2\right\rfloor}\frac{(N-2)!}{(N-Y+a_2+x_2)!(Y-2-2a_2-x_2)!a_2!}\;. $$