Description Usage Arguments Details Note Author(s) References See Also Examples
Rogers' Type II decreasing prey function.
1 2 3 4 | rogersII_fit(data, samp, start, fixed, boot=FALSE, windows=FALSE)
rogersII_nll(a, h, T, X, Y)
rogersII(X, a, h, T)
|
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' and 'h'. |
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, 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. |
This implements the Rogers' 'random predator' type-II functional response. This does not assume prey are replaced throughout the experiment (c.f. hollingsII
). The number of prey eaten (N_e) follows the relationship:
Ne=N0*(1-exp(a*(Ne*h-T)))
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, respectively. The fact that N_e appears on both side of the equation, poses some problems, but can be efficiently dealt with using Lambert's transcendental equation (Bolker, 2008). FRAIR uses the lambertW0
function from the lamW package and uses this function internally as:
Ne <- X - lambertW0(a * h * X * exp(-a * (T - h * X)))/(a * h)
where X = N_0. For further information users are directed to Chapter 8 (and preceding chapters, if needed) of Bolker (2008) where this approach is discussed in depth. Note that Bolker (2008) uses an implementation that 'partitions' the a and h coefficients between multiple prey items. This code is implemented in FRAIR as emdII
.
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.
hollingsII_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.
Note that although Rogers (1972) is the most commonly cited reference for this equation, Royama (1971) described it one year earlier than Rogers and thus should also be given credit.
Daniel Pritchard
Bolker BM (2008) Ecological Models and Data in R. Princeton University Press, Princeton, NJ. Rogers, D. (1972). Random search and insect population models. The Journal of Animal Ecology, 369-383. Royama, T. (1971). A comparative study of models for predation and parasitism. Researches on Population Ecology, 13, 1-91.
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 | data(gammarus)
pulex <- gammarus[gammarus$spp=='G.pulex',]
celt <- gammarus[gammarus$spp=='G.d.celticus',]
pulexfit <- frair_fit(eaten~density, data=pulex,
response='rogersII', start=list(a = 1.2, h = 0.015),
fixed=list(T=40/24))
celtfit <- frair_fit(eaten~density, data=celt,
response='rogersII', start=list(a = 1.2, h = 0.015),
fixed=list(T=40/24))
plot(c(0,30), c(0,30), type='n', xlab='Density', ylab='No. Eaten')
points(pulexfit)
points(celtfit, col=4)
lines(pulexfit)
lines(celtfit, col=4)
frair_compare(pulexfit, celtfit)
## Not run:
pulexfit_b <- frair_boot(pulexfit)
celtfit_b <- frair_boot(celtfit)
confint(pulexfit_b)
confint(celtfit_b)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.