Let $ S = \sum_{i=1}^n X_i$ where:
- Each $X_i$ is independently 3 or 9 (with equal probability), and
- The sample size $n$ is itself an independent random variable where $N \sim \text{NegativeBinomial}(r,p)$ e.g. $r = 5$ and $p = \frac34$
Let $W = \begin{cases}S-10 & S > 10 \\ 0 & S \leq 10 \end{cases} . \quad$
Find: (i) the pmf of $S\quad$ (ii) the pmf of $W \quad$ (iii) If not the former, can one at least find $\mathbb{E}[W]$ ?
How can I obtain the distribution of $W$ using mathematica? Although it may not be able to give me a reasonable PDF, can I at least find the expected value of $W$ with mathematica? Also, can I also draw random samples from the distribution of $W$? If so, how would I do this? Thank you.
CompoundPoissonDistribution[]
, but that assumes $N$ is Poisson-distributed, and not negative binomial-distributed as in your desired application. $\endgroup$CompoundPoissonDistribution[]
which would do what you want. $\endgroup$