ctmc2glm: Convert a "ctmc" object into Poisson glm format.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/ctmc2glm.R

Description

Transforms a "ctmc" object and covariate rasters into data suitable for analysis using Poisson GLM software (like glm in R).

Usage

1
2
3
ctmc2glm(ctmc, stack.static, stack.grad, crw = TRUE,
    normalize.gradients = FALSE, grad.point.decreasing = TRUE,
    include.cell.locations=TRUE,directions=4,zero.idx=integer())

Arguments

ctmc

A "ctmc" object (output from "path2ctmc").

stack.static

A rasterStack object, where each layer in the stack is a location-based covariate.

stack.grad

A rasterStack object, where each layer in the stack is a directional gradient-based covariate

crw

Logical. If TRUE (default), an autocovariate is created for each cell visited in the CTMC movement path. The autocovariate is a unit-length directional vector pointing from the center of the most recent grid cell to the center of the current grid cell.

normalize.gradients

Logical. Default is FALSE. If TRUE, then all gradient covariates are normalized by dividing by the length of the gradient vector at each point.

grad.point.decreasing

Logical. If TRUE, then the gradient covariates are positive in the direction of decreasing values of the covariate. If FALSE, then the gradient covariates are positive in the direction of increasing values of the covariate (like a true gradient).

include.cell.locations

Logical. If TRUE, then the x and y locations of the centers of the (1) current and (2) neighboring raster cells will be returned for each row in the created data matrix.

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().

Details

This code creates one data row for each possible transition from each grid cell visited by the CTMC path.

Value

z

Response variable (either zero or 1) for analysis using GLM software.

X

Matrix of predictor variables for analysis using GLM software. Created from the location-based and gradient-based covariates.

tau

Offset for each row in a Poisson GLM with log link.

t

Vector of the time each raster grid cell was entered

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.