path2ctmc: Function to turn a discrete-time continuous-space path into a...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/path2ctmc.R

Description

This function takes a movement path defined by xyt values (not necessarily equally spaced in time), and converts it into a CTMC path (a continuous-time discrete-space path on grid cells in a raster).

Usage

1
2
path2ctmc(xy, t, rast,directions=4,zero.idx=integer(),print.iter=FALSE,
method="ShortestPath")

Arguments

xy

A matrix of x,y locations at T time points.

t

A vector of T times associated with the T locations in "xy".

rast

A raster object or raster stack object that will define the discrete-space grid cells for the CTMC movement path.

directions

Integer. Either 4 (indicating a "Rook's neighborhood" of 4 neighboring grid cells) or 8 (indicating a "King's neighborhood" of 8 neighboring grid cells).

zero.idx

Integer vector of the indices of raster cells that are not passable and should be excluded. These are cells where movement should be impossible. Default is zero.idx=integer().

print.iter

Logical. If true, then the progress stepping through each observed location in "xy" and "t" will be output in the terminal.

method

Specifies interpolation method. Either "ShortestPath", which uses the shortest graphical path on the raster graph, or "LinearInterp", which linearly interpolates between observed locations. "ShortestPath" is slower, slightly more accurate, and allows for impassible barriers specified through "zero.idx". "LinearInterp" is faster but does not allow for impassible barriers.

Details

This takes a xyt path and turns it into a list of the embedded chain and residence times of a continuous time Markov chain walk on the graph. A "zero.idx" indicates impassible grid cells. When successive (x,y) locations are not in the same grid cell, a shortest path between locations is found using the "shortestPath" function from gdistance, and the time between (x,y) locations is then evenly divided between all grid cells in the shortest path.

Value

ec

A vector of the sequential grid cells (the embedded chain) in the CTMC movement path

rt

A vector of residence times in each sequential grid cell in the CTMC movement path

trans.times

A vector of times in which the movement path enters the grid cell in "ec".

Author(s)

Ephraim M. Hanks

References

Hanks, E. M.; Hooten, M. B. & Alldredge, M. W. Continuous-time Discrete-space Models for Animal Movement The Annals of Applied Statistics, 2015, 9, 145-165

Examples

1
2
3
## For example code, do
##
## > help(ctmcMove)

Example output

Loading required package: raster
Loading required package: sp
Loading required package: Matrix
Loading required package: fda
Loading required package: splines

Attaching package: 'fda'

The following object is masked from 'package:graphics':

    matplot

Loading required package: gdistance
Loading required package: igraph

Attaching package: 'igraph'

The following object is masked from 'package:raster':

    union

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union


Attaching package: 'gdistance'

The following object is masked from 'package:igraph':

    normalize

ctmcmove documentation built on May 1, 2019, 7:56 p.m.