Skip to contents

Mark specific track segments so that their Brownian bridges are excluded when mt_dbbmm_ud() or mt_dbgb_ud() computes the utilisation distribution. A segment i is the bridge from location i to location i + 1; setting it to excluded drops the contribution of that bridge while leaving the variance estimates and the neighbouring bridges untouched.

Usage

mt_mask_segments(x, segments)

Arguments

x

A variance object of class mt_dbbmm_variance or mt_dbgb_variance, or a named list of such objects as returned by multi-track dispatch.

segments

Integer vector of segment indices to exclude (each in 1:(n_locs - 1)), or a logical vector of length n_locs - 1 or n_locs where TRUE means "exclude". NA entries are ignored.

Value

The variance object (or list of objects) with the mask field updated.

Details

The helper is a thin dispatcher over the per-class include-masks (interest on mt_dbbmm_variance, seg_interest on mt_dbgb_variance). Both masks have identical semantics: TRUE means "include this bridge in the UD", FALSE means "exclude it". Using this helper keeps user code identical across the two variance classes.

The common use case is removing long-gap bridges that would otherwise fan the UD out across regions the animal never visited. See vignette("UD_gap_aware_ud", package = "move2utils") for a worked example on the fisher data.

Examples

if (FALSE) { # \dontrun{
library(move2)
library(sf)
library(units)

fishers <- mt_read(mt_example())
fishers <- fishers[!st_is_empty(fishers), ]
leroy   <- fishers[mt_track_id(fishers) == "M1", ]
leroy   <- st_transform(leroy, mt_aeqd_crs(leroy))

lag_h <- as.numeric(set_units(mt_time_lags(leroy), "hour"))
long_gap <- which(lag_h > 6)

var <- mt_dbbmm_variance(leroy, location_error = 25,
                          window_size = 31, margin = 11)
var <- mt_mask_segments(var, long_gap)
ud  <- mt_dbbmm_ud(var, location_error = 25, raster = 100, ext = 0.5)
} # }