0

Suppose $$ X_i \sim \text{Bernoulli }(p) $$ What can be said about the distribution of $Y$, given by $$ Y = \sum_{i=1}^N w_i X_i $$ for non-negative weights $w_i$? Note that $N$ here is small, so that no form of the CLT may be applied. I know, from this question, that this is a Poisson Binomial distribution if $w_i=1$, $\forall i$, but my question differs in the fact that I'm taking the same probability $p$ for all $i$.

sam wolfe
  • 101
  • You mention "Poisson Binomial". Is $N$ given, or is it a random variable? – Henry Mar 29 '22 at 14:50
  • @Henry $N$ is given. – sam wolfe Mar 29 '22 at 14:51
  • For small $N$, say up to $20$, and knowing $p$ and the $w_i$, and that the $X_i$ are independent, it would be easy enough to calculate the exact distribution – Henry Mar 29 '22 at 14:55
  • almost a duplicate? https://stats.stackexchange.com/questions/270227/what-is-the-cdf-of-the-sum-of-weighted-bernoulli-random-variables/465846#465846 – kjetil b halvorsen Mar 29 '22 at 14:58
  • 1
    "What can be said" is awfully vague and broad. What do you want to know about this distribution specifically? – whuber Mar 30 '22 at 15:38
  • 1
    If you post the same question simultaneously on multiple forums, it's good form to mention that in the question. Otherwise, if the answer or instructive comments on one forum aren't known on the other forum, you'll be wasting the time of the experts from which you're asking for help: https://math.stackexchange.com/questions/4415458/weighted-sum-of-bernoulli-distributions. – JimB Mar 30 '22 at 16:54

1 Answers1

1

Because you have access to Mathematica, here are two possible approaches:

n = 4;

t = Tuples[{0, 1}, {n}] (* {{0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 1, 0}, {0, 0, 1, 1}, {0, 1, 0, 0}, {0, 1, 0, 1}, {0, 1, 1, 0}, {0, 1, 1, 1}, {1, 0, 0, 0}, {1, 0, 0, 1}, {1, 0, 1, 0}, {1, 0, 1, 1}, {1, 1, 0, 0}, {1, 1, 0, 1}, {1, 1, 1, 0}, {1, 1, 1, 1}} *)

ss = Table[w[i], {i, n}] . # & /@ t (* {0, w[4], w[3], w[3] + w[4], w[2], w[2] + w[4], w[2] + w[3], w[2] + w[3] + w[4], w[1], w[1] + w[4], w[1] + w[3], w[1] + w[3] + w[4], w[1] + w[2], w[1] + w[2] + w[4], w[1] + w[2] + w[3], w[1] + w[2] + w[3] + w[4]} *)

prob = p^Total[#] (1 - p)^(n - Total[#]) & /@ t (* {(1 - p)^4, (1 - p)^3 p, (1 - p)^3 p, (1 - p)^2 p^2, (1 - p)^3 p, (1 - p)^2 p^2, (1 - p)^2 p^2, (1 - p) p^3, (1 - p)^3 p, (1 - p)^2 p^2, (1 - p)^2 p^2, (1 - p) p^3, (1 - p)^2 p^2, (1 - p) p^3, (1 - p) p^3, p^4} *)

pmf = Transpose[{ss, prob}]; TableForm[pmf, TableHeadings -> {None, {"Y", "Probability"}}]

Table of values and associated probabilities

If the values of $Y$ are not all unique (i.e., w[3]+w[4] == w[1]+w[2] for example), then you'd want to "condense" the above table. Suppose w[i] = i:

TableForm[
 Sort[{#[[1, 1]], Total[#[[All, 2]]]} & /@ GatherBy[pmf /. w[i_] -> i, First] // 
   Simplify, #1[[1]] < #2[[1]] &],
 TableHeadings -> {None, {"Y", "Probability"}}]

Probability table for a specific set of weights:  w[i]=i

An alternative approach with known weights:

n = 4;

dist = TransformedDistribution[Sum[w[i] x[i], {i, n}], Table[x[i] [Distributed] BernoulliDistribution[p], {i, n}], Assumptions -> 0 < p < 1];

Table[{k, PDF[dist /. w[i_] -> i, k] // Simplify}, {k, 0, n (n + 1)/2}] (* {{0, (-1 + p)^4}, {1, -(-1 + p)^3 p}, {2, -(-1 + p)^3 p}, {3, (-1 + p)^2 p}, {4, (-1 + p)^2 p}, {5, 2 (-1 + p)^2 p^2}, {6, -((-1 + p) p^2)}, {7, -((-1 + p) p^2)}, {8, -((-1 + p) p^3)}, {9, -((-1 + p) p^3)}, {10, p^4}} *)

This last approach is much, much slower.

JimB
  • 3,734
  • 11
  • 20