Title: | Estimate flight tracks from telemetry data |
---|---|
Description: | `movetrack` is an `R` package that provides simple functionality to estimate flight tracks from telemetry data using a hidden Markov model written in Stan. |
Authors: | Georg Rüppel [aut, cre] |
Maintainer: | Georg Rüppel <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.0 |
Built: | 2025-03-04 06:08:52 UTC |
Source: | https://github.com/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. |
summary.movetrack()
Extract draws from a movetrack
object.
getDraws(fit, nsim = 50)
getDraws(fit, nsim = 50)
fit |
An object of class |
nsim |
The number of simulations to extract; defaults to |
A data.frame
with the draws.
Calculate point estimates based on antenna bearing and signal strength.
locate( data, ID = "tagDeployID", ts = "ts", sig = "sig", aLon = "recvDeployLon", aLat = "recvDeployLat", aType = NULL, aBearing = "antBearing", aRange = 12, dTime = 2 )
locate( data, ID = "tagDeployID", ts = "ts", sig = "sig", aLon = "recvDeployLon", aLat = "recvDeployLat", aType = NULL, aBearing = "antBearing", aRange = 12, dTime = 2 )
data |
A |
ID |
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, only required for antenna-specific detection ranges. |
aBearing |
Antenna bearing column. |
aRange |
Assumed maximum detection range of antennas in kilometres. Can be a single value or a named list of values for different antenna types. |
dTime |
Time interval in minutes for which point estimates are to be calculated. |
This function performs the following steps 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 (by signal strength) for each time interval
dTime
.
Returns a data.frame
containing estimated coordinates and measurement
errors for each time interval together with the proportions of time
intervals w
.
## Not run: data(motusData) locate(motusData) locate(motusData, dTime = 1, aRange = 10) locate(motusData, aType = "antType", aRange = list("yagi-5" = 10, "yagi-6" = 12) ) ## End(Not run)
## Not run: data(motusData) locate(motusData) locate(motusData, dTime = 1, aRange = 10) locate(motusData, aType = "antType", aRange = list("yagi-5" = 10, "yagi-6" = 12) ) ## End(Not run)
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 mean trajectory. Defaults to |
alpha |
The alpha value for the posterior draws. Defaults to |
Returns an overview map with the mean 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
motusData
motusData
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 |
... |
Additional arguments passed to |
Returns one or multiple ggplot
plots.
movetrack::summary()
## Not run: # Set ggplot theme theme_set(theme_bw(base_size = 20)) # Plot plot(fit) plot(fit, vars = "speed", prob = 0.89, ci = "ETI") ## End(Not run)
## Not run: # Set ggplot theme theme_set(theme_bw(base_size = 20)) # Plot plot(fit) plot(fit, vars = "speed", prob = 0.89, ci = "ETI") ## End(Not run)
Print a summary for a movetrack
object.
## S3 method for class 'movetrack' print(x, digits = 3, ...)
## S3 method for class 'movetrack' print(x, digits = 3, ...)
x |
An object of class |
digits |
The minimal number of significant digits; defaults to |
... |
Additional arguments passed to |
summary.movetrack()
Create a summary of a movetrack
object.
## S3 method for class 'movetrack' summary(object, var = c("lon", "lat"), ci = "HDI", prob = 0.9, ...)
## S3 method for class 'movetrack' summary(object, var = c("lon", "lat"), ci = "HDI", prob = 0.9, ...)
object |
An object of class |
var |
The variable to summarise; defaults to |
ci |
The method used to calculate the credible intervals. Available
options are |
prob |
The probability mass of the credible interval; defaults to |
... |
Unused; for compatibility with the generic method. |
A data.frame
with the summary statistics.
## Not run: summary(fit) summary(fit, var = "distance") summary(fit, ci = "ETI", prob = 0.89) ## End(Not run)
## Not run: summary(fit) summary(fit, var = "distance") summary(fit, ci = "ETI", prob = 0.89) ## End(Not run)
Model flight path from point estimates using a Hidden Markov Model.
track(data, states = 1, i_lambda = TRUE, ...)
track(data, states = 1, i_lambda = TRUE, ...)
data |
A |
states |
The number of states to use in the model; defaults to |
i_lambda |
Logical indicating whether to estimate individual correlation
parameters; defaults to |
... |
Additional arguments passed to |
This function calls Stan via cmdstanr and uses a Hidden Markov Model (HMM) to estimate individual flight paths.
Returns a movetrack
object including the posterior distributions for
longitude, latitude, distance, and speed per 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) # Estimate locations loc <- locate(motusData, dTime = 2) # Model flight paths track(loc, states = 2, parallel_chains = 4) track(loc, i_lambda = FALSE, parallel_chains = 4) ## End(Not run)
## Not run: # Load data data(motusData) # Estimate locations loc <- locate(motusData, dTime = 2) # Model flight paths track(loc, states = 2, parallel_chains = 4) track(loc, i_lambda = FALSE, parallel_chains = 4) ## End(Not run)