getLocalObjects {nimbleSCR}R Documentation

Local Objects Identification

Description

R utility function to identify all objects (e.g. traps) within a given radius dmax of each cell in a habitat mask. Used in the implementation of the local evaluation approach in SCR models (dbinomLocal_normal;dpoisLocal_normal). The distance to the activity center and the detection probability are then calculated for local objects only (i.e. the detection probability is assumed to be 0 for all other objects as they are far enough from the activity center).

Usage

getLocalObjects(habitatMask, coords, dmax, resizeFactor = 1, plot.check = TRUE)

Arguments

habitatMask

a binary matrix object indicating which cells are considered as suitable habitat.

coords

A matrix giving the x- and y-coordinate of each object (i.e. trap). x- and y- coordinates should be scaled to the habitat (scaleCoordsToHabitatGrid).

dmax

The maximal radius from a habitat cell center within which detection probability is evaluated locally for each trap.

resizeFactor

An aggregation factor to reduce the number of habitat cells to retrieve local objects for. Defaults to 1; no aggregation.

plot.check

A visualization option (if TRUE); displays which objects are considered "local objects" for a randomly chosen habitat cell.

Details

The getLocalObjects function is used in advance of model building.

Value

This function returns a list of objects:

Author(s)

Cyril Milleret and Pierre Dupont

Examples

colNum <- sample(20:100,1)
rowNum <- sample(20:100,1)
coords <- expand.grid(list(x = seq(0.5, colNum, 1),
                               y = seq(0.5, rowNum, 1)))

habitatMask <- matrix(rbinom(colNum*rowNum, 1, 0.8), ncol = colNum, nrow = rowNum)

localObject.list <- getLocalObjects(habitatMask, coords,  dmax = 7,resizeFactor = 1)


[Package nimbleSCR version 0.2.1 Index]