# Type I Response

### Description

A generic type-I (linear) response.

### Usage

1 2 3 4 |

### Arguments

`data ` |
A dataframe containing X and Y. |

`samp ` |
A vector specifying the rows of data to use in the fit. Provided by |

`start ` |
A named list. Starting values for items to be optimised. Usually 'a'. |

`fixed ` |
A names list. 'Fixed data' (not optimised). Usually 'T'. |

`boot ` |
A logical. Is the function being called for use by |

`windows ` |
A logical. Is the operating system Microsoft Windows? |

`a ` |
The capture rate |

`T ` |
T: Total time available |

`X ` |
The X variable. Usually prey density. |

`Y ` |
The Y variable. Usually the number of prey consumed. |

### Details

This implements a simple type-I, or linear functional response. This is helpful when the response is known (or suspected) to be handling time independent. It is implemented as:

*Ne = a*N0*T*

where *a* is the capture rate, *T* is the total time available and *N_0* (== X) is the initial prey density.

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.

`typeI_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 `typeI_nll`

function to optimise `typeI`

.

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

### Author(s)

Daniel Pritchard

### See Also

`frair_fit`

.

### Examples

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 26 27 28 29 30 31 32 33 34 35 36 37 | ```
datx <- rep(1:60, times=5)
r1 <- rnorm(60*5, mean = 0.25, sd = 0.1)
r2 <- rnorm(60*5, mean = 0.75, sd = 0.1)
r1[r1>1] <- 1
r2[r2>1] <- 1
daty1 <- abs(round(r1*datx, 0))
daty2 <- abs(round(r2*datx, 0))
dat <- data.frame(datx,daty1,daty2)
TI1 <- frair_fit(daty1~datx, data=dat, response='typeI',
start=list(a=0.5), fixed=list(T=1))
TI2 <- frair_fit(daty2~datx, data=dat, response='typeI',
start=list(a=0.5), fixed=list(T=1))
plot(c(0,60), c(0,60), type='n', xlab='Density', ylab='No. Eaten')
points(TI1)
points(TI2, col=4)
lines(TI1)
lines(TI2, col=4)
# Test with frair_compare
frair_compare(TI1, TI2)
## Not run:
# Test with a big stick
TI1b <- frair_boot(TI1)
TI2b <- frair_boot(TI2)
confint(TI1b)
confint(TI2b)
plot(c(0,60), c(0,60), type='n', xlab='Density', ylab='No. Eaten')
drawpoly(TI1b, col=1)
drawpoly(TI2b, col=4)
points(TI1b, pch=20)
points(TI2b, pch=20, col=4)
## End(Not run)
``` |