       Re: Need help NIntegrating stepwise 3D probability density functions

• To: mathgroup at smc.vnet.net
• Subject: [mg114095] Re: Need help NIntegrating stepwise 3D probability density functions
• From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
• Date: Tue, 23 Nov 2010 06:00:47 -0500 (EST)

```Hi Jason

I admit I tried a few things before I tried the following:

thresholdDensity = 5/100;
NIntegrate[
PDF[ testDistribution, {x, y, z} ]*
UnitStep[ PDF[ testDistribution, {x, y, z} ] - thresholdDensity ]
, {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity,
]

thresholdDensity = 4/100;
NIntegrate[
PDF[ testDistribution, {x, y, z} ]*
UnitStep[ PDF[ testDistribution, {x, y, z} ] - thresholdDensity ]
, {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity,
]

thresholdDensity = 6/100;
NIntegrate[
PDF[ testDistribution, {x, y, z} ]*
UnitStep[ PDF[ testDistribution, {x, y, z} ] - thresholdDensity ]
, {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity,
]

thresholdDensity = 0/100;
NIntegrate[
PDF[ testDistribution, {x, y, z} ]*
UnitStep[ PDF[ testDistribution, {x, y, z} ] - thresholdDensity ]
, {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity,
]

The answers look like they are behaving correctly. I too read the documentation in UnitStep about "SymbolicProcessing" -> 0, and I only tried removing it on a whim. Go figure. Maybe Daniel Lichtblau can explain it for us?

Cheers

Barrie

>>> On 22/11/2010 at 11:40 pm, in message <201011221240.HAA06705 at smc.vnet.net>,
Jason Neuswanger <jrneuswanger at alaska.edu> wrote:
> I need to integrate 3D probability density functions over the region
> in which the probability density exceeds some threshold (the end goal
> being to calculate isopleths in 3D animal territories fit by kernel
> distributions).
>
> The simplest test case I could come up with is this:
>
> testDistribution =
>   MultinormalDistribution[{1, 2,
>     4}, {{2, -1/4, 1/3}, {-1/4, 2/3, 1/5}, {1/3, 1/5, 1/2}}];
>
> thresholdDensity = 0.05;
>
> NIntegrate[
>  PDF[testDistribution, {x, y, z}]*
>   UnitStep[PDF[testDistribution, {x, y, z}] - thresholdDensity]
>  , {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity,
>   Infinity}
>  , Method -> {"LocalAdaptive", "SymbolicProcessing" -> 0}
>  ]
>
> I've tried quite a few things and just can't get remotely sensible
> results.  The analogous case in 1 dimension works just fine, shown
> below:
>
> testDistribution2 = NormalDistribution[];
>
> thresholdDensity2 = 0.35;
>
> NIntegrate[
>  PDF[testDistribution2, {x}]*
>   UnitStep[PDF[testDistribution2, {x}] - thresholdDensity2]
>  , {x, -Infinity, Infinity}
>  , Method -> {"LocalAdaptive", "SymbolicProcessing" -> 0}
>  ]
>
> (* check answer using symbolic methods *)
>
> thresholdRoot =
>   x /. FindRoot[
>     PDF[testDistribution2, {x}] - thresholdDensity2, {x, 1}];
> Integrate[
>  PDF[testDistribution2, {x}], {x, -thresholdRoot, thresholdRoot}]
>
> Any help here would be VERY much appreciated!

```

• Prev by Date: [Question] NonlinearRegress with two independent variables.
• Next by Date: Re: Mathematica 8
• Previous by thread: Need help NIntegrating stepwise 3D probability density functions
• Next by thread: Re: Need help NIntegrating stepwise 3D probability density functions