Description Usage Arguments Details Value Author(s) Examples
View source: R/fit_distance_models.R
Fit detection curves to formatted data
1 2 |
data |
Dataframe formatted for use with package |
spec |
Species name or code to subset |
maxdist |
Maximum distance (in meters) to include in analysis, i.e. truncation distance |
bins |
Vector of cutpoints for binned detections. See details. |
modlist |
List of detection curves to include in analysis. See details. |
debug |
Debug level to pass to |
This function will first subset a formatted point count data set (i.e. output from format_data
) to a
desired species and fit a standard list of detection functions to the data using detection bins. An AIC table
comparing detection function fits, including Akaike weight (w), whether fit was monotonic (mono), and the p-value
from a chi-square goodness-of-fit test (chisq) will then be created and printed. Any models that are monotonic and
have a chisq p-value>0.05 will be considered to have "good fit", and marked to be further considered (include = *).
Of the included models, the function will plot the results of the one with the lowest AIC score and print density
estimates by strata (individuals/ha). Take caution in accepting the goodness-of-fit test results, since the test
weights all bins equally even though the first bins are the most important. Check the plot for good agreement between
observed and predicted detections. It can be easy to pass the chi-square test with small sample sizes and poor
agreement, yet difficult to pass with large sample sizes and very good agreement. If agreement is poor, or none of
the models pass the chi-square test, consider lumping bins or reducing the maximum (truncation) distance.
The value for bins
defaults to the cutpoints for CADC protocol VCP25, bins = c(0,10,20,30,40,50,75,100), but
cutpoints can be changed for other protocols and/or dropped to lump bins together as needed. Take care in changing
cutpoints so that they align with the bins originally used to collect the data, particularly when combining data
using more than one protocol. The function will not check whether your bins make sense for your data!
The default list of detection functions to fit were originally derived from Thomas et al. 2010 J Appl Ecol 47:5-14.
These include:
- Uniform key with cosine adjustments (unif.cos)
- Half-normal key with no or cosine adjustments (hn.cos)
- Hazard-rate key with no or polynomial adjustments (hr.poly)
These model names are passed to package Distance
, which produces copious output as each model is running.
Distance
will start with no adjustment terms (or the simplest adjustments allowed) and then automatically
tries higher order adjustments until it finds one with a higher AIC (poorer fit) than the one before it, and returns
the previous model with the lowest AIC. Occasionally, individual models will not fit and will produce an error
message, but those will be skipped and the other models will continue to run.
Debug level defaults to 0 (none), but can be set to values 1-3 for increasing levels of debugging output.
Returns a named list including:
- The output of each model in modlist
- table
, containing the table of results printed
- D
, the density estimates (individuals/ha) for each stratum, calculated from the model with the lowest AIC
score (of the models with include = *, see Details)
- N
, the estimated total number of individuals per stratum, calculated from the same model as for D
above, based on extrapolating D
by the Area
of each stratum specified in data
. If Area
=1,
then N
= D
.
Kristen Dybala, kdybala@pointblue.org
1 | ## Not run: fdat = format.data(data=dat, strata='group')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.