# fr_hollingsII: Holling's Original Type II Response In frair: Tools for Functional Response Analysis

## Description

Holling's Type II predator-prey function.

## Usage

 ```1 2 3 4``` ``` hollingsII_fit(data, samp, start, fixed, boot=FALSE, windows=FALSE) hollingsII_nll(a, h, T, X, Y) hollingsII(X, a, h, T) ```

## Arguments

 `data ` A dataframe containing X and Y. `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 'a' 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? `a, h ` Capture rate and 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 Hollings original type-II functional response, otherwise known as the 'disc equation'. An important assumption of this equation is that prey density remains constant (i.e. a 'replacement' experimental design). In practice this is often not the case and often the Roger's 'random predator' equation may be more appropriate (see `rogersII`).

In Holling's original formulation the number of prey eaten (Ne) follows the relationship:

Ne=(a*N0*T)/(1+a*N0*h)

Where N_0 is the initial number of prey and a, h and T are the capture rate, handling time and the total time available, receptively. It is implemented internally in FRAIR as:

`Ne <- (a*X*T)/(1+a*X*h)`

where X = N_0.

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

`rogersII_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 `rogersII_nll` function to optimise `rogersII`.

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

Daniel Pritchard

## References

Bolker BM (2008) Ecological Models and Data in R. Princeton University Press, Princeton, NJ.

`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``` ```datx <- rep(c(1,2,3,4,6,12,24,50,100), times=10) daty1 <- round(hollingsII(X=datx, a=0.75*rnorm(length(datx), mean=1, sd=0.1), h=0.1*rnorm(length(datx), mean=1, sd=0.1), T=1),0) daty2 <- round(hollingsII(X=datx, a=0.75*rnorm(length(datx), mean=1, sd=0.1), h=0.01*rnorm(length(datx), mean=1, sd=0.1), T=1),0) dat <- data.frame(datx,daty1,daty2) hollII_1 <- frair_fit(daty1~datx, data=dat, response='hollingsII', start=list(a=1, h=0.1), fixed=list(T=1)) hollII_2 <- frair_fit(daty2~datx, data=dat, response='hollingsII', start=list(a=1, h=0.01), fixed=list(T=1)) plot(c(0,100), c(0,40), type='n', xlab='Density', ylab='No. Eaten') points(hollII_1) points(hollII_2, col=4) lines(hollII_1) lines(hollII_2, col=4) frair_compare(hollII_1, hollII_2) ```