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.
sim_filter(trs, keep = 0.25, flag = 2, var = NULL, FUN = "mean", ...)a sim_fit object
the quantile of flag values to retain
the similarity flag method (see details). Ignored if var != NULL.
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).
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.
a sim_fit object containing the filtered paths
flag = 1 will use an index based on Hazen (2017)
flag = 2 (the default) will use a custom index
Hazen et al. (2017) WhaleWatch: a dynamic management tool for predicting blue whale density in the California Current J. Appl. Ecol. 54: 1415-1428
## fit crw model to Argos LS data
fit <- fit_ssm(ellie, model = "crw", time.step = 72)
#> fitting crw SSM to 1 tracks...
#>
pars: 1 1 0 -3.35398
pars: 0.39011 0.36995 -0.01715 -3.83437
pars: -1.43958 -1.5202 -0.06862 -5.27553
pars: -2.32555 -2.54729 -0.19371 -4.12371
pars: -0.8182 -0.89535 -0.06643 -4.50381
pars: -1.32519 -1.50336 -0.13293 -2.80663
pars: -3.81139 -3.52862 -0.34792 -0.87863
pars: -1.51253 -5.47288 -1.30472 -0.80788
pars: -3.56306 -3.42149 -0.36507 -0.7161
pars: -3.61181 -2.9318 -0.72005 -0.53937
pars: -3.39586 -3.32216 -0.39527 -0.57711
pars: -3.37045 -3.27625 -0.58861 -0.44326
pars: -3.3622 -3.35641 -0.78714 -0.33305
pars: -3.40515 -3.26117 -1.00386 -0.31998
pars: -3.35787 -3.28832 -1.23731 -0.34408
pars: -3.34955 -3.21862 -1.90879 -0.28844
pars: -3.47591 -3.24158 -5.51865 0.09773
pars: -3.40948 -3.22951 -3.62074 -0.1053
pars: -3.24252 -3.2088 -4.51921 -0.46913
pars: -3.24252 -3.2088 -4.51921 -0.46913
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
# \donttest{
plot(trs) | plot(trs_f)
# }