sim: simulate animal tracks

Description Usage Arguments Value Examples

Description

simulate from the rw, crw of mpm process models to generate a set of x,y (or lon,lat) coordinates with or without error from supplied input parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
sim(
  N = 100,
  start = list(c(0, 0), as.POSIXct(format(Sys.time(), tz = "UTC", usetz = TRUE))),
  model = c("rw", "crw", "mpm"),
  vmax = 4,
  sigma = c(4, 4),
  rho_p = 0,
  D = 0.05,
  sigma_g = 1.25,
  error = c("ls", "kf"),
  tau = c(1.5, 0.75),
  rho_o = 0,
  tdist = c("reg", "gamma"),
  ts = 3,
  tpar = c(0.23, 1),
  alpha = c(0.9, 0.8)
)

Arguments

N

number of time steps to simulate

start

coordinates and datetime of start location for simulated track

model

simulate from the rw, crw or mpm process models

vmax

maximum travel rate (m/s) of simulated animal

sigma

a vector of process error sd's for the rw model (ignored if model != "rw")

rho_p

correlation parameter for rw model process covariance matrix (ignored if model != "rw")

D

diffusion coefficient for crw model process covariance matrix (ignored if model != "crw")

sigma_g

random walk sd for time-varying move persistence parameter (ignored if model != "mpm")

error

indicates whether measurement error should mimic Argos Least-Squares ("ls") or Argos Kalman Filter ("kf")

tau

vector of LS measurement error sd's (ignored if error = "kf")

rho_o

correlation parameter for LS covariance matrix (ignored if error = "kf")

tdist

distribution for simulating location times ("reg" generates locations at regular ts intervals, in h; "gamma" uses a gamma distribution to generate random time intervals)

ts

time interval in h (ignored if tdist = "gamma")

tpar

shape and scale parameters for the gamma distributed times (ignored if tdist = "reg")

alpha

transition probabilities switching model versions of rw or crw models. Probabilities are the transition matrix diagonals (ignored if sigma has length 2 or D has length 1)

Value

a tibble is returned with columns that can include some or all of the following, depending on the arguments used

date

time as POSIXct tz = UTC (default)

lc

Argos location class

lon

longitude with error

lat

latitude with error

x

x in km from arbitrary origin without error

y

y in km from arbitrary origin without error

x.err

a random deviate drawn from Argos LS or KF error distribution

y.err

a random deviate drawn from Argos LS or KF error distribution

smaj

Argos error ellipse semi-major axis in m (if error = "kf")

smin

Argos error ellipse semi-minor axis in m (if error = "kf")

eor

Argos error ellipse orientation in degrees (if error = "kf")

u

velocity in x direction (if model = "crw")

v

velocity in y direction (if model = "crw")

b

behavioural state (if model = "rw" or "crw" and multiple process variances given, see examples)

g

movement persistence - the autocorrelation between successive movements on the interval 0,1 (if model = "mpm")

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
tr <- sim(N = 200, model = "crw", D = 0.1, error = "kf", tdist = "reg", ts=12)
plot(tr, error = TRUE)

tr <- sim(N = 200, model = "rw", sigma = c(4,4,0.5,0.5), error = "ls", tdist = "reg")
plot(tr)

tr <- sim(N = 200, model = "crw", D = c(0.1, 0.05), error = "kf", tdist="reg")
plot(tr)

tr <- sim(N = 200, model = "mpm", sigma_g = 1.2, error = "ls", tau = c(2, 1.5), 
tdist = "gamma", tpar = c(1, 4))
plot(tr, error = TRUE, pal = "Cividis")

foieGras documentation built on April 27, 2021, 1:05 a.m.