calculateDensity | R Documentation |
calculateDensity
is a NIMBLE function to calculate number of individual activity centers (s) in each habitat cell.
calculateDensity(s, habitatGrid, indicator, numWindows, nIndividuals)
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 |
|
Cyril Milleret
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 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.