# fr_hassIII: Hassell's Type III Response In frair: Tools for Functional Response Analysis

## Description

Hassell's original type-III response (assuming replacement)

## Usage

 ```1 2 3 4``` ``` hassIII_fit(data, samp, start, fixed, boot=FALSE, windows=FALSE) hassIII_nll(b, c, h, T, X, Y) hassIII(X, b, c, h, T) ```

## Arguments

 `data ` A data frame containing X and Y (at least). `samp ` A vector specifying the rows of data to use in the fit. Provided by `boot()` or manually, as required. `start ` A named list. Starting values for items to be optimised. Usually b, c and h. `fixed ` A names list. 'Fixed data' (not optimised). Usually T. `boot ` A logical. Is the function being called for use by `boot()`? `windows ` A logical. Is the operating system Microsoft Windows? `b,c,h ` Hassel's b and c, plus h, the handling time. Usually items to be optimised. `T ` T, the total time available. `X ` The X variable. Usually prey density. `Y ` The Y variable. Usually the number of prey consumed.

## Details

This implements the original Hassel's type-III functional response, assuming prey density is kept constant (i.e. a 'replacement' experimental design). In practice, constant prey density might be an unrealistic assumption, in which case users should consider the `hassIIIr` function instead.

In Hassel et al.'s original formulation, the capture rate a is assumed to vary with the prey density in the following hyperbolic relationship:

`a <- (b*X)/(1+c*X)`

where `b` and `c` are coefficients to be fitted and X is the initial prey density. This is the initial formulation of Hassell et al. (1977) and uses their naming conventions. The value for a is then used within a traditional Holling's disc equation (see `hollingsII`).

None of these functions are designed to be called directly, though they are all exported so that the user can do so if desired. The intention is that they are called via `frair_fit`, which calls them in the order they are specified above.

`hassIII_fit` does the heavy lifting and also pulls double duty as the `statistic` function for bootstrapping (via `boot()` in the boot package). The `windows` argument if required to prevent needless calls to `require(frair)` on platforms that can manage sane parallel processing.

The core fitting is done by `mle2` from the `bbmle` package and users are directed there for more information. `mle2` uses the `hassIII_nll` function to optimise `hassIII`.

Further references and recommended reading can be found on the help page for frair_fit.

Daniel Pritchard

## References

Hassell M, Lawton J, Beddington J (1977) Sigmoid functional responses by invertebrate predators and parasitoids. Journal of Animal Ecology 46: 249–262.

`frair_fit`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25``` ```datx <- rep(c(1,2,3,4,6,12,24,50,100), times=10) daty1 <- round(hassIII(X=datx, b=0.08*rnorm(length(datx), mean=1, sd=0.1), c=0.1*rnorm(length(datx), mean=1, sd=0.1), h=0.1*rnorm(length(datx), mean=1, sd=0.1), T=1),0) daty2 <- round(hassIII(X=datx, b=0.05*rnorm(length(datx), mean=1, sd=0.1), c=0.1*rnorm(length(datx), mean=1, sd=0.1), h=0.2*rnorm(length(datx), mean=1, sd=0.1), T=1),0) dat <- data.frame(datx,daty1,daty2) hassIII_1 <- frair_fit(daty1~datx, data=dat, response='hassIII', start=list(b=0.05, c=0.1, h=0.1), fixed=list(T=1)) hassIII_2 <- frair_fit(daty2~datx, data=dat, response='hassIII', start=list(b=0.05, c=0.1, h=0.1), fixed=list(T=1)) plot(c(0,100), c(0,15), type='n', xlab='Density', ylab='No. Eaten') points(hassIII_1) points(hassIII_2, col=4) lines(hassIII_1) lines(hassIII_2, col=4) frair_compare(hassIII_1, hassIII_2) ```