Learn R Programming

smam (version 0.7.2)

dtm: Density for Time Spent in Moving or Resting

Description

Density for time spent in moving or resting in a time interval, unconditional or conditional on the initial state.

Usage

dtm(w, t, lamM, lamR, s0 = NULL)

dtr(w, t, lamM, lamR, s0 = NULL)

Value

a vector of the density evaluated at w.

Arguments

w

time points at which the density is to be evaluated

t

length of the time interval

lamM

rate parameter of the exponentially distributed duration in moving

lamR

rate parameter of the exponentially distributed duration in resting

s0

initial state. If NULL, the unconditional density is returned; otherwise, it is one of "m" or "s", standing for moving and resting, respectively, and the conditional density is returned given the initial state.

Functions

  • dtr(): Density of time spent in resting

Details

dtm returns the density for time in moving; dtr returns the density for time in resting.

References

Yan, J., Chen, Y., Lawrence-Apfel, K., Ortega, I. M., Pozdnyakov, V., Williams, S., and Meyer, T. (2014) A moving-resting process with an embedded Brownian motion for animal movements. Population Ecology. 56(2): 401--415.

Examples

Run this code
lamM <- 1
lamR <- c(1/2, 1, 2)
lr <- length(lamR)
totalT <- 10
old.par <- par(no.readonly=TRUE)
par(mfrow=c(1, 2), mar=c(2.5, 2.5, 1.1, 0.1), mgp=c(1.5, 0.5, 0), las=1)
curve(dtm(x, totalT, 1, 1/2, "m"), 0, totalT, lty=1, ylim=c(0, 0.34),
      xlab="M(10)", ylab="density")
curve(dtm(x, totalT, 1, 1, "m"), 0, totalT, lty=2, add=TRUE)
curve(dtm(x, totalT, 1, 2, "m"), 0, totalT, lty=3, add=TRUE)
mtext(expression("S(0) = 1"))
legend("topleft", legend = expression(lambda[r] == 1/2, lambda[r] == 1,
       lambda[r] == 2), lty = 1:lr)
curve(dtm(x, totalT, 1, 1/2, "r"), 0, totalT, lty=1, ylim=c(0, 0.34),
      xlab="M(10)", ylab="density")
curve(dtm(x, totalT, 1, 1, "r"), 0, totalT, lty=2, add=TRUE)
curve(dtm(x, totalT, 1, 2, "r"), 0, totalT, lty=3, add=TRUE)
mtext(expression("S(0) = 0"))
legend("topleft", legend = expression(lambda[r] == 1/2, lambda[r] == 1,
      lambda[r] == 2), lty = 1:lr)
par(old.par)

Run the code above in your browser using DataLab