Skip to content
Joel Pitt edited this page Feb 6, 2014 · 1 revision

Table of Contents

Mean Value Theorem

(from Pitt 2008:)

Dispersal kernels are probability density functions (PDF) but for random sampling purposes the inverse of the cumulative density function (CDF) is needed. The cumulative probability can be obtained by the integral:

<math>CDF(n) = \int^n_0 PDF(x) \, \mathrm{d}x</math>

The CDF allows us to utilise the Golden Rule for Sampling which originates from a letter from John von Neumann to Stan Ulam in 1947 (Eckhardt 1987):

1. Sample a random number R from U [0,] - where U [0,] is a uniform random number in the range [0,].

2. Equate R with the CDF: F (x) = R

3. Invert the CDF and solve for x : x = F −1 (R)

x is random number drawn from the PDF. In this case x is the distance travelled by a dispersal event.

Preparing Exponential kernel for sampling

Sampling approach utilizing the Golden rule for sampling (Eckhardt 1987, as cited in Pitt 2008).

Typically it is easier to fit the probability density function (PDF) to dispersal data (ie. Wangen 2011) than to directly fit the cumulative density function (CDF). As an example, the PDF form of a one-parameter negative exponential kernel would take the form

<math>f(x) = \alpha e^{-(\alpha x)}</math>

Randomly sampling this PDF using the Golden rule requires that we first generate a random value from a uniform distribution between 0 and 1

<math>p \sim Dunif(0,1)</math>

We then equate this value as the percentile the dispersal event achieved. In other words, a value of 0.9 would mean that the dispersal event reached the 90th percentile of the PDF. Calculating the corresponding distances requires the use of the CDF, which is calculated by taking the integral of the PDF

<math>CDF(n) = \int \! PDF(x) \, \mathrm{d}x</math>

or in the case of the negative exponential function:

<math>\int \! PDF(x) \, \mathrm{d}x = -e^{-\alpha x}</math>

The randomly generated probability (p) can be related to the corresponding distance by determining the generic formula for the definite integral:

<math>\int_a^b \! PDF(x) \, \mathrm{d}x = CDF(b) - CDF(a)</math>

which effectively returns the amount of area under the PDF between the values of a and b. Applying this to the negative exponential function, we can use the definite integral to calculate the area between zero and the specified percentile:

<math>\int_0^x \! PDF(x) \, \mathrm{d}x = [-e^{-\alpha] - [-e^{\alpha]</math>

which simplifies to

<math>\int_0^x \! PDF(x) \, \mathrm{d}x = -e^{-\alpha x} + 1</math>

Then we can set this equation equal to the randomly generated p value:

<math>p = -e^{-\alpha x} + 1</math>

note: doesn't make sense that CDF(0)=1?

and solve for the value of x, which is the distance traveled at the corresponding percentile (p):

<math>x = \frac{log(1-p)}{\alpha}</math>

Currently coded in MDiG as:

<math>x = log(-y+1)(-b)</math>

2-Parameter Exponential kernel

<math>f(x)=ae^{bx}</math>

<math>CDF(n) = \int \! PDF(x) \, \mathrm{d}x = \frac{ae^{bx}}{b} </math>

<math>\int_0^x \! PDF(x) \, \mathrm{d}x = CDF(d) - CDF(0) = \frac{ae^{bx}}{b} - \frac{a}{b}</math>

Set equal to y and solve for x; y=random number, x=distance traveled

<math> x = \frac{log \left(\frac{by}{a}+1\right)}{b}</math>

Currently in MDiG:

<math> x = \frac{log(1-a)-log(y)}{b}</math>

Clark Kernel

Manipulation of Clark Kernel

General Function / PDF form (Clark 1998):

<math>k(x;d,s) = \frac{1}{\left[\frac{\Gamma]} e^{- \left( \frac{x}{d} \right)^s}</math>

Integrand of General function:

<math>\int k(x;d,s) =- \frac{x \left( \left(\frac{x}{d} \right)^s \right)^{-\frac{1}{s}} \Gamma \left({\frac{1}{s}, \left( \frac{x}{d} \right)^s} \right)} {d \Gamma \left( \frac{1}{s} \right)}</math>

Preparing Three-parameter Kernel

Two-parameter General function:

<math>k(x;d_1,d_2,s) = \frac{1}{\left[\frac{\Gamma]} e^{- \left( \frac{x}{d_2} \right)^s}</math>

Integrand of two-parameter General function (obtained from http://integrals.wolfram.com/index.jsp?expr=%281%2F%28%28Gamma%5B1%2Fc%5D*a%29%2Fc%29%29*exp%28-%28x%2Fb%29^c%29&random=false):

<math>\int k(x;d_1,d_2,s) =- \frac{x \left( \left(\frac{x}{d_2} \right)^s \right)^{-\frac{1}{s}} \Gamma \left({\frac{1}{s}, \left( \frac{x}{d_2} \right)^s} \right)} {d_1 \Gamma \left( \frac{1}{s} \right)}</math>

Specification from MDiG files

kernel_math.c specification:

<math> ratio = \left( \frac{x}{d} \right)^s </math>

<math> a = ratio^{-\frac{1}{s}} </math>

<math> b = \Gamma \left( \frac{1}{s} \right) </math>

<math> c = \Gamma \left( \frac{1}{s}, ratio \right) </math>

<math> result = x \cdot a \cdot \frac{b-c}{s}</math>

Specification from kernel_math.c, after making substitutions:

<math>result = x \left( \left(\frac{x}{d} \right)^s \right)^{-\frac{1}{s}} \left( \frac{\Gamma \left( \frac{1}{s} \right) - \Gamma \left( \frac{1}{s}, \left( \frac{x}{d} \right)^s \right)}{s} \right)</math>

Equivalency

Then does it follow that:

<math>result = - \frac{x \left( \left(\frac{x}{d} \right)^s \right)^{-\frac{1}{s}} \Gamma \left({\frac{1}{s}, \left( \frac{x}{d} \right)^s} \right)} {d \Gamma \left( \frac{1}{s} \right)} = x \left( \left(\frac{x}{d} \right)^s \right)^{-\frac{1}{s}} \left( \frac{\Gamma \left( \frac{1}{s} \right) - \Gamma \left( \frac{1}{s}, \left( \frac{x}{d} \right)^s \right)}{s} \right)</math>

OR

using substitutions from MDiG specifications (detailed above):

<math>result = \frac{-x \cdot a \cdot c}{d \cdot b} = x \cdot a \cdot \frac{b-c}{s} ?</math>

Negative Exponential III Kernel

This is a custom scripted kernel that has been hard-coded to perform a very specific function; that is, specifying the dispersal kernel for randomly dispersed individuals from large-scale H. lepidulum in a large-scale application for those events that move further than one 30m cell away from their origin. While the specificity of this application means there is most likely no additional applications for this specific kernel, I am including a description of the development process in case it is helpful for others developing a custom kernel.