Skip to contents

Summarise an ensemble of draws into a single path. With by = "stap", the positions of all draws are summarised separately for each stationary period. With by = "consensus_stay", the move probability of each boundary between consecutive periods is the proportion of draws whose grid cell changes there; boundaries above move_threshold split the track into consensus stays, and positions are summarised over all draws and periods of each stay. The function accepts both sampling_path() output and simulation paths with j but no chain column. Use path_collapse() to keep each draw instead.

Usage

path_summary(
  paths,
  stap = NULL,
  by = c("stap", "consensus_stay"),
  position = c("mean", "median", "mode"),
  move_threshold = 0.5
)

Arguments

paths

A path data frame containing stap_id, ind, lat, and lon, and optionally j, chain, start, and end.

stap

A stationary-period data frame containing stap_id, start, and end. If NULL, these columns are taken from paths.

by

Summary resolution: "stap" returns one row per stationary period; "consensus_stay" returns one row per consensus stay.

position

Position summary: "mean", "median", or "mode". The mode selects the most frequent grid cell and therefore retains a valid ind; the mean and median return NA for ind.

move_threshold

Probability above which a boundary is classified as a move when by = "consensus_stay".

Value

A data frame with one row per requested summary unit and columns stap_id, stap_id_start, stap_id_end, ind, lat, lon, start, end, and n_path. Consensus summaries also contain movement probabilities at the start and end boundaries.

See also

Other path: path_collapse()