= Solution
The printed identity needs an expectation on its right-hand side. For fixed $r\geq1$, condition on $X_2,\ldots,X_r$ and use <independence> of $X_1$:
$$
\boxed{P(S_r\leq x)=E\left[F\left(x-\sum_{i=2}^rX_i\right)\right].}
$$
The expression inside this expectation is generally random and cannot equal the unconditional probability by itself.
For each independent <Monte Carlo method> replicate, draw $R_j$ from its given distribution. If $R_j=r\geq1$, draw $r-1$ independent $F$-variables, form $W_j=\sum_{i=2}^rX_{j,i}$ and set $H_j=F(x-W_j)$. For $r=1$ the empty sum is $0$. If $R$ may equal zero, use $H_j=\mathbf1_{\{x\geq0\}}$ when $R_j=0$, since $S_0=0$. The <law of total expectation> gives
$$
\boxed{\widehat l_N=N^{-1}\sum_{j=1}^NH_j,\qquad E\widehat l_N=P(S_R\leq x).}
$$
Since $0\leq H_j\leq1$, the estimator has <statistical consistency> by the <strong law of large numbers>. It is the <conditional Monte Carlo> estimator obtained by <Rao-Blackwellization> of the direct indicator $\mathbf1_{\{S_R\leq x\}}$, and the <law of total variance> gives $\operatorname{Var}(H_j)\leq l(1-l)$.
This version assumes that the <cumulative distribution function> $F$ can be evaluated. An easy sampler alone does not automatically supply an easy <cumulative distribution function> evaluation. If only sampling is available, use the direct indicator estimator, or replace each conditional <cumulative distribution function> by the average of several independent indicators $\mathbf1_{\{X_{j,1,k}\leq x-W_j\}}$; the nested version remains an <unbiased estimator>. With $L$ such inner draws its <variance> per outer replicate is $\operatorname{Var}(H_j)+L^{-1}E[H_j(1-H_j)]$.
Back to article page