fit_distance_models: Fit detection curves to formatted data

Description Usage Arguments Details Value Author(s) Examples

View source: R/fit_distance_models.R

Description

Fit detection curves to formatted data

Usage

1
2
fit_distance_models(data, spec, maxdist = 100, bins = c(0, 10, 20, 30, 40,
  50, 75, 100), modlist = c("unif.cos", "hn.cos", "hr.poly"), debug = 0)

Arguments

data

Dataframe formatted for use with package Distance, e.g. output from format_data

spec

Species name or code to subset data

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 Distance. See details.

Details

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.

Value

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.

Author(s)

Kristen Dybala, kdybala@pointblue.org

Examples

1
## Not run: fdat = format.data(data=dat, strata='group')

kdybala/pbdistance documentation built on May 20, 2019, 8:28 a.m.