Description Usage Arguments Details Value Author(s) References See Also Examples
Explicitly model, and then test, the difference between two functional response fits.
1 | frair_compare(frfit1, frfit2, start = NULL)
|
frfit1 |
An object of class |
frfit2 |
An object of class |
start |
A named numeric list with starting values for the combined fit. See Details. |
This function provides a sensible test of the optimised coefficients between two functional responses fitted by frair_fit
. This is achieved by explicitly modelling a 'difference' (delta) parameter for each optimised variable following the advice outlined in Juliano (2001). Briefly, consider the following Hollings type-II model:
a*X*T/(1+a*X*h)
the model containing delta parameters becomes:
(a-Da*grp)*X*T/(1+(a-Da*grp)*X*(h-Dh*grp))
where grp
is a dummy coding variable and Da
and Dh
are the delta parameters. Here, the first functional response fit (frfit1
) is coded grp=0
and the second fit (frfit2
) is coded grp=1
. ThereforeDa
and Dh
represent the difference between the two modelled coefficients and the standard output from the maximum likelihood fitting explicitly tests the null hypothesis of no difference between the two groups.
The difference model is re-fit to the combined data in frfit1
and frfit2
using the same maximum likelihood approaches outlined in frair_fit
.
This function could be seen as a less computationally intensive alternative to bootstrapping but relies on mle2
successfully returning estimates of the standard error. mle2
does this by inverting a Hessian matrix, a procedure which might not always be successful.
Future versions of FRAIR will look to improve the integration between mle2
and allow users access to the various Hessian control parameters. In the meantime, the following delta functions are exported so users can 'roll their own' maximum likelihood implementation using this approach:
Original Function | Difference Function | Difference NLL Function |
typeI | typeI_diff | typeI_nll_diff |
hollingsII | hollingsII_diff | hollingsII_nll_diff |
rogersII | rogersII_diff | rogersII_nll_diff |
hassIII | hassIII_diff | hassIII_nll_diff |
hassIIInr | hassIIInr_diff | hassIIInr_nll_diff |
emdII | emdII_diff | emd_nll_diff |
flexp | flexp_diff | flexp_nll_diff |
flexpnr | flexpnr_diff | flexpnr_nll_diff
|
Prints the results of the test to screen and invisibly returns on object of class frcompare
inheriting from class(list)
containing:
frfit1 |
The first FR fit, as supplied. |
frfit2 |
The second FR fit, as supplied. |
test_fit |
The output of the re-fitted model. |
result |
Coefficients from the test that are otherwise printed to screen. |
Daniel Pritchard
Juliano SA (2001) Nonlinear curve fitting: Predation and functional response curves. In: Scheiner SM, Gurevitch J (eds). Design and analysis of ecological experiments. Oxford University Press, Oxford, United Kingdom. pp 178–196.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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))
# The following tests the null hypothesis that the
# true difference between the coefficients is zero:
frair_compare(pulexfit, celtfit) # Reject null for 'h', do not reject for 'a'
## Not run:
# Provides a similar conclusion to bootstrapping followed by 95% CIs
pulexfit_b <- frair_boot(pulexfit)
celtfit_b <- frair_boot(celtfit)
confint(pulexfit_b)
confint(celtfit_b) # 'a' definitely overlaps
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.