calculateDensity {nimbleSCR} | R Documentation |
NIMBLE function to calculate the density of individuals alive in each habitat cell.
Description
calculateDensity
is a NIMBLE function to calculate number of individual activity centers (s) in each habitat cell.
Usage
calculateDensity(s, habitatGrid, indicator, numWindows, nIndividuals)
Arguments
s |
|
habitatGrid |
Matrix of habitat window indices. Cell values should correspond to the
order of habitat windows in spatial probabilities (e.g. |
indicator |
|
numWindows |
|
nIndividuals |
|
Author(s)
Cyril Milleret
Examples
lowerCoords <- matrix(c(0, 0, 1, 0, 0, 1, 1, 1), nrow = 4, byrow = TRUE)
upperCoords <- matrix(c(1, 1, 2, 1, 1, 2, 2, 2), nrow = 4, byrow = TRUE)
logIntensities <- log(rep(1,4))
logSumIntensity <- log(sum(c(1:4)))
habitatGrid <- matrix(c(1:4), nrow = 2, byrow = TRUE)
numGridRows <- nrow(habitatGrid)
numGridCols <- ncol(habitatGrid)
s <- matrix(NA,nrow=10,ncol=2)
for(i in 1:10){
s[i,] <- rbernppAC(n=1, lowerCoords, upperCoords, logIntensities, logSumIntensity,
habitatGrid, numGridRows, numGridCols)
}
calculateDensity(s = s,
habitatGrid = habitatGrid,
indicator = rep(1, 10),
numWindows = prod(dim(habitatGrid)),
nIndividuals = 10
)