| ct_fit_ds | R Documentation |
ct_fit_ds fits detection functions to camera trap distance sampling data and estimates
animal density or abundance using bootstrap variance estimation. Supports both
single model fitting and automated model selection procedures.
ct_fit_ds(
data,
estimate = c("density", "abundance"),
cutpoints = NULL,
truncation = set_truncation(data = data, cutpoints = cutpoints),
formula = ~1,
key = c("hn", "hr", "unif"),
adjustment = c("cos", "herm", "poly"),
nadj = NULL,
order = NULL,
select_model = FALSE,
model_params = list(key = list("hn", "hr", "unif"), adjustment = list("cos", "herm",
"poly"), nadj = list(0, 1, 2), order = NULL),
availability,
n_bootstrap = 100,
n_cores = 1,
fast_bootstrap = TRUE,
seed = NULL,
...
)
data |
A data frame containing distance sampling observations. Must include following columns:
|
estimate |
Character string specifying the parameter to estimate. Either
|
cutpoints |
if the data are binned, this vector gives the cutpoints of
the bins. Supplying a distance column in your data and specifying cutpoints
is the recommended approach for all standard binned analyses.
Ensure that the first element is 0 (or the left truncation
distance) and the last is the distance to the end of the furthest bin.
(Default |
truncation |
either truncation distance (numeric, e.g. 5) or percentage
(as a string, e.g. "15%","15"). Can be supplied as a |
formula |
formula for the scale parameter. For a CDS analysis leave
this as its default |
key |
key function to use; |
adjustment |
adjustment terms to use; |
nadj |
the number of adjustment terms to fit. In the absence of
covariates in the formula, the default value ( |
order |
order of adjustment terms to fit. The default value ( |
select_model |
Logical. If |
model_params |
Named list defining candidate models for selection when
|
availability |
A list containing availability rate corrections (output from
|
n_bootstrap |
Integer. Number of bootstrap replicates for variance estimation of density/abundance. Default is 100. Larger values provide more precise confidence intervals but increase computation time. |
n_cores |
Integer. Number of CPU cores to use for parallel bootstrap computation.
Default is 1. Used only when the bootstrap is run by |
fast_bootstrap |
Logical. If |
seed |
Optional integer. If supplied, the random-number generator is seeded
with this value immediately before bootstrapping, making the resampling
reproducible. If |
... |
Arguments passed on to
|
A named list containing: A list containing:
QAIC: (only if select_model = TRUE) QAIC comparison table.
Chi2: (only if select_model = TRUE) Chi-squared goodness-of-fit comparison.
best_model: The best fitted detection function model selected.
rho: Estimated effective detection radius (in meters).
density or abundance: A tibble with density or abundance estimates containing:
median, mean, se: standard error, lcl: lower confidence limit,
ucl: upper confidence limit
The right truncation point is by default set to be largest observed distance or bin end point. This is a default will not be appropriate for all data and can often be the cause of model convergence failures. It is recommended that one plots a histogram of the observed distances prior to model fitting so as to get a feel for an appropriate truncation distance. (Similar arguments go for left truncation, if appropriate). Buckland et al. (2001) provide guidelines on truncation.
When specified as a percentage, the largest right and smallest left
percent distances are discarded. Percentages cannot be supplied when using
binned data.
For left truncation, there are two options: (1) fit a detection function to
the truncated data as is (this is what happens when you set left). This
does not assume that g(x)=1 at the truncation point. (2) manually remove
data with distances less than the left truncation distance – effectively
move the centre line out to be the truncation distance (this needs to be
done before calling ds). This then assumes that detection is certain at
the left truncation distance. The former strategy has a weaker assumption,
but will give higher variance as the detection function close to the line
has no data to tell it where to fit – it will be relying on the data from
after the left truncation point and the assumed shape of the detection
function. The latter is most appropriate in the case of aerial surveys,
where some area under the plane is not visible to the observers, but their
probability of detection is certain at the smallest distance.
When adjustment terms are used, it is possible for the detection function to not always decrease with increasing distance. This is unrealistic and can lead to bias. To avoid this, the detection function can be constrained for monotonicity (and is by default for detection functions without covariates).
Monotonicity constraints are supported in a similar way to that described
in Buckland et al. (2001). 20 equally spaced points over
the range of the
detection function (left to right truncation) are evaluated at each round
of the optimisation and the function is constrained to be either always
less than it's value at zero ("weak") or such that each value is
less than or equal to the previous point (monotonically decreasing;
"strict"). See also check.mono.
Even with no monotonicity constraints, checks are still made that the
detection function is monotonic, see check.mono.
One can supply data only to simply fit a detection function. However, if
abundance/density estimates are necessary further information is required.
Either the region_table, sample_table and obs_table data.frames can
be supplied or all data can be supplied as a "flat file" in the data
argument. In this format each row in data has additional information that
would ordinarily be in the other tables. This usually means that there are
additional columns named: Sample.Label, Region.Label, Effort and
Area for each observation. See flatfile for an example.
Note that if the data contains a column named size, cluster size will be
estimated and density/abundance will be based on a clustered analysis of
the data. Setting this column to be NULL will perform a non-clustered
analysis (for example if "size" means something else in your dataset).
Buckland, S.T., Anderson, D.R., Burnham, K.P., Laake, J.L., Borchers, D.L., and Thomas, L. (2001). Distance Sampling. Oxford University Press. Oxford, UK.
Howe, E. J., Buckland, S. T., Després-Einspenner, M., & Kühl, H. S. (2017). Distance sampling with camera traps. Methods in Ecology and Evolution, 8(11), 1558-1565. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/2041-210X.12790")}
Howe, E. J., Buckland, S. T., Després-Einspenner, M., & Kühl, H. S. (2019). Model selection with overdispersed distance sampling data. Methods in Ecology and Evolution, 10(1), 38-47. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/2041-210X.13082")}
Rowcliffe, J. M., Kays, R., Kranstauber, B., Carbone, C., & Jansen, P. A. (2014). Quantifying levels of animal activity using camera trap data. Methods in Ecology and Evolution, 5(11), 1170-1179. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/2041-210X.12278")}
ct_availability(), ct_select_model(), ct_QAIC(), ct_chi2_select()
## Not run:
data("duikers")
# Calculates animal availability adjustment factor
trigger_events <- duikers$VideoStartTimesFullDays
avail <- ct_availability(times = trigger_events$time,
format = "%H:%M", n_bootstrap = 100)
# Estimate density, building multiple models
flat_data <- duikers$DaytimeDistances %>%
dplyr::rename(fraction = multiplier) %>%
dplyr::slice_sample(prop = .2) # sample 20% of rows
duiker_density <- ct_fit_ds(data = flat_data,
estimate = "density",
select_model = TRUE,
model_params = list(key = list("hn", "hr"),
adjustment = list("cos"),
nadj = list(2, 3),
order = NULL),
availability = avail,
truncation = list(left = 2, right = 15),
n_bootstrap = 2,
cutpoints = c(seq(2, 8, 1), 10, 12, 15)
)
# View density
duiker_density$density
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.