mt_sim_brownian_motion {move2}R Documentation

Simulate Brownian motion

Description

Creates a move2 object with simulated data following a Brownian motion

Usage

mt_sim_brownian_motion(
  t = 1L:10L,
  sigma = 1L,
  tracks = 2L,
  start_location = c(0L, 0L),
  track_id = NULL
)

Arguments

t

a vector of timestamps, numeric values or times to simulate for. If multiple tracks are created this vector will be used for all of them, alternatively a list with a vector per track can be provided.

sigma

The Brownian motion variance movement rate [\frac{\sigma}{time}] either as scalar number or a vector with a number per segment. Not that this argument is the movement rate so the motion variance will be adjusted for the length of the interval. Alternatively a function that is integrated over time in the simulation function, this function needs to be vectorized (if needed see Vectorize). If a list is provided one element of the list is taken per track.

tracks

Either the number of tracks or a vector containing the names of the tracks.

start_location

Either one or a list of start locations, as a vector with two numbers.

track_id

The identifier of the track if a single track is requested.

Details

Note that when lists are provided as in input the names of these lists are ignored. Individuals are simulated by order.

If t is numeric the movement rate (sigma) is assumed to be expressed per unit t, if t is a timestamp or a date, sigma is assumed to be expressed per second.

Value

a move2 object

Examples

mt_sim_brownian_motion() |> plot()
mt_sim_brownian_motion(list(1:10, 1:100)) |>
  mt_track_lines() |>
  plot()
mt_sim_brownian_motion(1:200,
  sigma = .25, letters[1:4],
  list(c(0, 0), c(10, 0), c(0, 10), c(10, 10))
) |>
  mt_track_lines() |>
  plot()

[Package move2 version 0.3.0 Index]