2
$\begingroup$

I'm trying to NIntegrate[] the following integration: Let's define a function

$F_\delta(x) = 1 - \Phi[\Phi^{-1}[1 - x] - \delta], \ \ x \in (0, 1)$

where $\delta > 0, \Phi(x)$ is the cdf of the standard normal distribution.

The integration I would like to get is:

$\int_0^1 F_{\delta_1}(0.05 + 0.95x) d F_{\delta_2}(x)$

NIntegrate[] works well when $\delta_1, \delta_2$ is not large. However, when $\delta_1, \delta_2$ is large, for example, $\delta_1 = 5, \delta_2 = 10$, the integration would overflow near $x = 0$ as $f_{\delta}(0) \rightarrow \infty$ as $\delta$ increases.

I know the limit of the integration should be 1 as $\delta_1, \delta_2$ increases, but my task is to give a plot of the integration value as $\delta$ increases, so I need to seek a way to evaluate the value or at least some kind of approximation even when $\delta_1, \delta_2$ is rather large.

Here are the code I used for Mathematica:

f[x_, d_] := Exp[-(d^2/2) + d*InverseCDF[NormalDistribution[0, 1], 1 - x]]
F[x_, c_] := 1 - CDF[NormalDistribution[0, 1], InverseCDF[NormalDistribution[0, 1], 1 - x] - c] 
NIntegrate[F[0.05 + 0.95 x, 5] * f[x, 10], {x, 0, 1}]

Thanks!!

$\endgroup$
4
  • 2
    $\begingroup$ please post Mathematica code you used. $\endgroup$
    – Nasser
    Aug 30, 2022 at 8:33
  • $\begingroup$ Sure! Let me post the Mathematica code. $\endgroup$
    – 0o0o0o0
    Aug 30, 2022 at 8:50
  • 2
    $\begingroup$ Rationalize function and play with MaxRecursion, WorkingPrecision, AccuracyGoal ... NIntegrate[F[5/100 + 95/100 x, 5]*f[x, 10], {x, 0, 1}, MaxRecursion -> 50, WorkingPrecision -> 30] yields 0.999603384995483853038609328216 $\endgroup$
    – Akku14
    Aug 30, 2022 at 11:57
  • $\begingroup$ MaxRecursion works well for a single point, but when I tried List contour plot for (\delta_1, \delta_2) taking value in unit square, even MaxRecursion -> 15 is very slow. Is there any faster way for List contour plot? $\endgroup$
    – 0o0o0o0
    Sep 4, 2022 at 1:09

1 Answer 1

4
$\begingroup$
Clear["Global`*"]

f[x_, d_] := 
 Exp[-(d^2/2) + d*InverseCDF[NormalDistribution[0, 1], 1 - x]]
F[x_, c_] := 
 1 - CDF[NormalDistribution[0, 1], 
   InverseCDF[NormalDistribution[0, 1], 1 - x] - c]

NIntegrate[F[1/20 + 19/20 x, 5]*f[x, 10], {x, 0, 1},
 WorkingPrecision -> 15]

(* 0.999603384995484 *)

int[δ_?NumericQ] := NIntegrate[
  F[1/20 + 19/20 x, δ]*f[x, 10], {x, 0, 1},
  WorkingPrecision -> 15]

AbsoluteTiming@ListLinePlot[
  Table[{δ, int[δ]}, {δ, 2, 10, 1/4}],
  PlotRange -> All]

enter image description here

Using Plot is much slower

AbsoluteTiming@Plot[int[δ], {δ, 2, 10},
  PlotRange -> All,
  WorkingPrecision -> 15]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.