Learn R Programming

smam (version 0.2-2)

rMovRes: Sampling from a Moving-Resting Process with Embedded Brownian Motion

Description

A moving-resting process consists of two states: moving and resting. The transition between the two states is modeled by an alternating renewal process, with expenentially distributed duration. An animal stays at the same location while resting, and moves according to a Brownian motion while moving.

Usage

rMovRes(time, lamM, lamR, sigma, s0, dim = 2)

Arguments

time
time points at which observations are to be simulated
lamM
rate parameter of the exponential duration while moving
lamR
rate parameter of the exponential duration while resting
sigma
volatility parameter of the Brownian motion while moving
s0
the state at time 0, must be one of "m" or "r", for moving and resting, respectively
dim
the dimension of the Brownian motion

Value

A data.frame whose first column is the time points and whose other columns are coordinates of the locations.

References

Yan, J., Chen, Y., Lawrence-Apfel, K., Ortega, I. M., Pozdnyakoc, V., Williams, S., and Meyer, T. (2013+) A moving-resting process with an embedded Brownian motion for animal movements. Population Ecology. Forthcoming.

Examples

Run this code
tgrid <- seq(0, 10, length=1001)
## make it irregularly spaced
tgrid <- sort(sample(tgrid, 800))
dat <- rMovRes(tgrid, 1, 1, 1, "m")
plot(dat[,1], dat[,2], xlab="t", ylab="X(t)", type='l')

Run the code above in your browser using DataLab