| Title: | Model flight paths from radio-telemetry data |
|---|---|
| Description: | movetrack is an R package that provides simple functionality to model flight tracks from telemetry data using a hidden Markov model written in Stan. |
| Authors: | Georg Rüppel [aut, cre] (ORCID: <https://orcid.org/0000-0001-5459-6717>) |
| Maintainer: | Georg Rüppel <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.1.2 |
| Built: | 2026-06-03 08:27:35 UTC |
| Source: | https://codeberg.org/g-rppl/movetrack |
Coerce a movetrack object to a data.frame.
## S3 method for class 'movetrack' as.data.frame(x, ...)## S3 method for class 'movetrack' as.data.frame(x, ...)
x |
An object of class |
... |
Unused; for compatibility with the generic method. |
Extract draws from a movetrack object.
getDraws(fit, n = 50)getDraws(fit, n = 50)
fit |
An object of class |
n |
The number of draws to extract; defaults to |
A data.frame with the draws.
Map individual flight trajectories and model uncertainty.
mapTrack(fit, id = NULL, nsim = 50, lwd = 2, alpha = 0.1)mapTrack(fit, id = NULL, nsim = 50, lwd = 2, alpha = 0.1)
fit |
An object of class |
id |
The individuals to plot. Defaults to |
nsim |
The number of posterior draws to plot. Defaults to |
lwd |
The line width for the median trajectory. Defaults to |
alpha |
The alpha value for the posterior draws. Defaults to |
Returns an overview map with the median trajectories and nsim posterior
draws per individual.
## Not run: mapTrack(fit) mapTrack(fit, nsim = 100, alpha = 0.05) ## End(Not run)## Not run: mapTrack(fit) mapTrack(fit, nsim = 100, alpha = 0.05) ## End(Not run)
Motus test data
motusDatamotusData
An object of class tbl_df (inherits from tbl, data.frame) with 4464 rows and 7 columns.
Plot model results per individual and variable.
## S3 method for class 'movetrack' plot(x, vars = c("lon", "lat"), id = NULL, ...)## S3 method for class 'movetrack' plot(x, vars = c("lon", "lat"), id = NULL, ...)
x |
An object of class |
vars |
The variables to plot. Defaults to |
id |
The individuals to plot. Defaults to |
... |
Unused; for compatibility with the generic method. |
Returns one or multiple ggplot plots.
Print a summary for a movetrack object.
## S3 method for class 'movetrack' print(x, ...)## S3 method for class 'movetrack' print(x, ...)
x |
An object of class |
... |
Unused; for compatibility with the generic method. |
Create a summary of a movetrack object.
## S3 method for class 'movetrack' summary(object, var = c("lon", "lat"), ...)## S3 method for class 'movetrack' summary(object, var = c("lon", "lat"), ...)
object |
An object of class |
var |
The variable(s) to summarise; defaults to |
... |
Additional arguments passed to |
A data.frame with the summary statistics.
'posterior::summarise_draws()
## Not run: summary(fit) summary(fit, var = "lambda") summary(fit, var = c("distance", "speed"), "mean", "sd") ## End(Not run)## Not run: summary(fit) summary(fit, var = "lambda") summary(fit, var = c("distance", "speed"), "mean", "sd") ## End(Not run)
Model flight paths from raw telemetry data using a hidden Markov model.
track( data, ID = "tagDeployID", ts = "ts", sig = "sig", aLon = "recvDeployLon", aLat = "recvDeployLat", aType = "antType", aBearing = "antBearing", aRange = default_aRange(), dTime = 2, states = 2, i_lambda = TRUE, model = TRUE, ... ) default_aRange()track( data, ID = "tagDeployID", ts = "ts", sig = "sig", aLon = "recvDeployLon", aLat = "recvDeployLat", aType = "antType", aBearing = "antBearing", aRange = default_aRange(), dTime = 2, states = 2, i_lambda = TRUE, model = TRUE, ... ) default_aRange()
data |
A |
||||||||||||||
ID |
Column containing unique identifier for individuals or tag deployments. |
||||||||||||||
ts |
Timestamp column. |
||||||||||||||
sig |
Signal strength column. |
||||||||||||||
aLon |
Antenna longitude column. |
||||||||||||||
aLat |
Antenna latitude column. |
||||||||||||||
aType |
Antenna type column, required for antenna-specific detection ranges. Omnidirectional antennas must be named "monopole". |
||||||||||||||
aBearing |
Antenna bearing column. |
||||||||||||||
aRange |
Theoretical antenna ranges in kilometres. Can be a single
numeric value or a named list of values for different antenna types
defined in the
Overwrite or add values using |
||||||||||||||
dTime |
Time interval in minutes for which point estimates are to be calculated. |
||||||||||||||
states |
The number of states to use in the model; defaults to |
||||||||||||||
i_lambda |
Logical indicating whether to estimate individual correlation
parameters; defaults to |
||||||||||||||
model |
Logical indicating whether to run the model; defaults to |
||||||||||||||
... |
Additional arguments passed to |
This function first calculates point estimates based on antenna bearing and signal strength as described in Baldwin et al. 2018:
Estimate locations for each detection: half of the maximum detection
range aRange along the directional beam.
Derive oscillating measurement error arising from antenna geometry and orientation.
Calculate weighted means and errors (by signal strength) for each time
interval dTime.
For omnidirectional antennas, the station’s location is used with a circular measurement error.
The results are then passed to Stan via cmdstanr and individual flights paths are estimated using a hidden Markov model (HMM).
Returns a movetrack object including the posterior distributions for
longitude, latitude, distance in m, and speed per time interval in m/s. If
model is FALSE, only the results from the first step are returned as a
data.frame containing estimated coordinates and measurement errors for each
time interval.
Auger‐Méthé, M., Newman, K., Cole, D., Empacher, F., Gryba, R., King, A. A., ... & Thomas, L. (2021). A guide to state–space modeling of ecological time series. Ecological Monographs, 91(4), e01470. doi:10.1002/ecm.1470
Baldwin, J. W., Leap, K., Finn, J. T., & Smetzer, J. R. (2018). Bayesian state-space models reveal unobserved off-shore nocturnal migration from Motus data. Ecological Modelling, 386, 38-46. doi:10.1016/j.ecolmodel.2018.08.006
Jonsen, I. D., Flemming, J. M., & Myers, R. A. (2005). Robust state–space modeling of animal movement data. Ecology, 86(11), 2874-2880. doi:10.1890/04-1852
cmdstanr::sample()
## Not run: # Load data data(motusData) # Model flight paths track(motusData) track(motusData, aRange = 10, dTime = 5) track(motusData, aRange = modifyList(default_aRange(), list("yagi-4" = 7, "custom-6" = 10)) ) track(motusData, states = 1, i_lambda = FALSE) # Location estimates only track(motusData, model = FALSE) track(motusData, dTime = 1, aRange = 10, model = FALSE) ## End(Not run)## Not run: # Load data data(motusData) # Model flight paths track(motusData) track(motusData, aRange = 10, dTime = 5) track(motusData, aRange = modifyList(default_aRange(), list("yagi-4" = 7, "custom-6" = 10)) ) track(motusData, states = 1, i_lambda = FALSE) # Location estimates only track(motusData, model = FALSE) track(motusData, dTime = 1, aRange = 10, model = FALSE) ## End(Not run)