R/pf_analyse_path.R
pf_loglik.Rd
This function calculates the total log-probability of each movement path reconstructed by a particle filtering (PF) algorithm, including the acoustic-container (AC), depth-contour (DC) or acoustic-container depth-contour (ACDC) algorithms.
pf_loglik(paths)
A dataframe containing movement paths from pf
plus pf_simplify
(see pf_path-class
). At a minimum, this should contain a unique identifier for each path (named `path_id') and the probability associated with each cell along each path (`cell_pr').
The function returns a dataframe with the log likelihood (`loglik') of each path (`path_id'). Rows are ordered by log-probability and a `delta' column is provided with the differences in log-probability between the most likely path and every other path.
For each path, at each time step the probability associated with the sampled location depends on (a) the `intrinsic' probability associated with each cell (assigned by the AC, DC or ACDC algorithm) and (b) a user-defined movement model that is driven by the distance between the sampled locations for the individual at the previous and current time steps (and other user-defined parameters). This function simply sums the logarithms of these probabilities for each path as a measure of their relative likelihood, given the movement model.
# An example with the DCPF paths dataset included in flapper
pf_loglik(dat_dcpf_paths)
#> path_id loglik delta
#> 1 4 -145.7709 0.00000000
#> 2 5 -145.8111 0.04017947
#> 3 3 -145.8431 0.07217439
#> 4 2 -145.9346 0.16376265
#> 5 1 -146.8934 1.12246741
#> 6 19 -147.6582 1.88729381
#> 7 24 -147.6644 1.89348096
#> 8 18 -147.6736 1.90275861
#> 9 23 -147.6798 1.90894575
#> 10 9 -147.6820 1.91112531
#> 11 14 -147.6882 1.91731246
#> 12 8 -147.6975 1.92659011
#> 13 13 -147.7037 1.93277725
#> 14 16 -147.7395 1.96864247
#> 15 17 -147.7395 1.96864247
#> 16 21 -147.7457 1.97482962
#> 17 22 -147.7457 1.97482962
#> 18 6 -147.7634 1.99247397
#> 19 7 -147.7634 1.99247397
#> 20 11 -147.7695 1.99866112
#> 21 12 -147.7695 1.99866112
#> 22 20 -151.9751 6.20417920
#> 23 25 -151.9813 6.21036635
#> 24 10 -151.9989 6.22801070
#> 25 15 -152.0051 6.23419785