# Internals: Derivatives

Here we give expressions for the derivatives of the detection function likelihood. This document provides some analytic results that improve computation time.

Computations were performed using Wolfram Mathematica 10. The workbook used for the computations may be downloaded here.

## Preamble

In general the likelihood is of the following form for line transects:

Naturally, we think about this on the log scale:

## Half-normal detection function

Note to define the error function in R, use:

```
erf <- function(x) 2 * pnorm(x * sqrt(2)) - 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.