Internals: Integrals

A very common task during optimisation and for various post-fitting tasks is the calculation of the integral of the detection function. That is:

where $\text{left}$ and $\text{right}$ are the left and right truncation points, which are shortened to $l$ and $r$ below, respectively.

This document provides some analytic results that improve computation time.

Computations were performed using Maxima 5.30.0 (with some simplification by hand). The (wxMaxima) workbook used for the computations may be downloaded here.

Note: For the cases where covariates occur in the detection function, we just have a bunch of different $\sigma$s, so we just do the integral many times for the different values of $\sigma$.

General key plus adjustments (K+A) results

The general form of the K+A model is:

where $A$ is some sum of adjustment terms (cosines, simple polynomials or Hermite polynomials).

Integrating that:

and since $A$ is a series, we can write $A(x,\mathbf{z},\theta) = \sum_j A_j(x,\mathbf{z},\theta)$, so:

Half-normal detection function

For half-normal, $g$ has the following form:

Half-normal, key only

Note to define the error function in R, use:

erf <- function(x) 2 * pnorm(x * sqrt(2)) - 1

Half-normal with cosine adjustments

by the above, we need only to calculate

which only changes due to differing $a_j$ and $j$ in this case, so the integral we’re interested in is:

where $i=\sqrt{-1}$

Hazard-rate

Gamma

From Becker and Quang (2009),

where $X \sim \Gamma(r,1)$ and

$r>1$ is the shape parameter of the gamma (to be estimated) and $0 < h \leq 1$.

References

Becker, EF, and PX Quang. A Gamma-Shaped Detection Function for Line-Transect Surveys with Mark-Recapture and Covariate Data. Journal of Agricultural, Biological, and Environmental Statistics 14(2) (2009): 207–23.