I wish to plot the following probability on Mathematica: $$ \pi=n\cdot\int_{-\infty}^{+\infty}\int_{-\infty}^{+\infty}\left[\int_{-\infty}^{z_{1}}G\left(z-z_{2}\right)\cdot f\left(z_{2}\right)dz_{2}\right]^{n-1}g\left(z-z_{1}\right)f\left(z_{1}\right)dz_{1}dz $$ where $n\geq2$, $F$ and $G$ are the CDFs of independent random variables supported on $\mathbb{R}$ (with respective densities $f$ and $g$). You may notice that the integral is related to the convolution distribution but it's not exactly that. For example, I wish to compute the above integral where $F$ and $G$ are the NormalDistribution[0, σ1] and NormalDistribution[0, σ2] respectively. The issue is that due to the infinities the integrals do not converge in Mathematica, unless I express them in the form of some probabilities or expectations so that Mathematica calculate them symbolically. I would appreciate any help!

*** UPDATE *** Here is my code:

probabilityFunction[n_, F_, G_] :=
  Module[{vLow = DistributionDomain[F][[1]][[1]], 
    vHigh = DistributionDomain[F][[1]][[2]], 
    zLow = DistributionDomain[G][[1]][[1]], 
    zHigh = DistributionDomain[G][[1]][[2]]},
    n*(Integrate[CDF[G, z - z2]*PDF[F, z2], {z2, vLow + zLow, z1}, 
       Assumptions -> z1 \[Element] Reals])^(n - 1)*PDF[G, z - z1]*
     PDF[F, z1], {z1, vLow, vHigh}, {z, vLow + zLow, vHigh + zHigh}]

Tested with:

Module[{n = 4, F = UniformDistribution[{0, 2}], G = UniformDistribution[{1, 4}]},
  probabilityFunction[n, F, G]



But I can't test it with the Normal distribution as it is supported over $(-\infty, +\infty)$. Numerical simulation is indeed one way to go, but I believe it should be possible to evaluate this fairly standard integral somehow...

  • 1
    $\begingroup$ Neither Mathematica nor Rubi can calculate a closed form for the innermost integral. In this form I don't think there's anything you can do - other than numerical evaluation. $\endgroup$ – flinty Aug 30 '20 at 16:10
  • $\begingroup$ Please post Mathematica code corresponding to the integral. $\endgroup$ – Anton Antonov Aug 31 '20 at 14:06
  • $\begingroup$ Thank you both! I added my Mathematica code in case it is of any help to make it work. $\endgroup$ – Avocaddo Aug 31 '20 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.