sim_filter: Filter 'sim_fit' simulations

View source: R/sim_filter.R

sim_filterR Documentation

Filter sim_fit simulations

Description

This function calculates the similarity between the simulations generated by sim_fit and the SSM-estimated path from the ssm fit, and returns a sim_fit object containing the most similar tracks based on a user specified quantile. In this context, similarity is calculated as the sum of normalised differences in net displacement (km) and overall bearing (deg) between the SSM-estimated path and the simulated paths.

Usage

sim_filter(trs, keep = 0.25, flag = 2, var = NULL, FUN = "mean", ...)

Arguments

trs

a sim_fit object

keep

the quantile of flag values to retain

flag

the similarity flag method (see details). Ignored if var != NULL.

var

the name(s) of the appended variable(s) to use for similarity calculations. Default is NULL, in which case similarity is calculated based on distance and bearing - e.g., Hazen et al (2017).

FUN

one of the following functions in quotes: mean, median, var, sd, sum, min, or max. Ignored if var = NULL.

...

additional arguments to the specified FUN (e.g., na.rm = TRUE). Ignored if var = NULL.

Details

  • flag = 1 will use an index based on Hazen (2017)

  • flag = 2 (the default) will use a custom index

Value

a sim_fit object containing the filtered paths

References

Hazen et al. (2017) WhaleWatch: a dynamic management tool for predicting blue whale density in the California Current J. Appl. Ecol. 54: 1415-1428

Examples

## fit crw model to Argos LS data
fit <- fit_ssm(ellie, model = "crw", time.step = 72)

set.seed(pi)
## generate 5 simulated paths from ssm fit
trs <- sim_fit(fit, what = "predicted", reps = 5)

## filter simulations and keep paths in top 40% of flag values
trs_f <- sim_filter(trs, keep = 0.4, flag = 2)

## compare unfiltered and filtered simulated paths

plot(trs) | plot(trs_f)



ianjonsen/foieGras documentation built on Jan. 17, 2025, 11:15 p.m.