Compute the cell probabilities used in the multinomial-Poisson models multinomPois and gmultmix. These functions use piFuns internally to calculate multinomial likelihoods from the occasion-wise detection probabilities. The only reason to call them directly is to check their behaviour.

removalPiFun(p)
doublePiFun(p)

Arguments

p

matrix of detection probabilities at each site for each observation

Details

These two functions are provided as examples of possible functions to calculate multinomial cell probabilities. Users may write their own functions for specific sampling designs (see the example).

Value

For removalPiFun, a matrix of cell probabilities for each site and sampling period.

For doublePiFun, a matrix of cell probabilities for each site and observer combination. Column one is probability observer 1 but not observer 2 detects the object, column two is probability that observer 2 but not observer 1 detects the object, and column 3 is probability of both detecting.

See also

makePiFuns for factory functions to create customised piFuns.

Examples

(pRem <- matrix(0.5, nrow=3, ncol=3)) # Capture probabilities
#> [,1] [,2] [,3] #> [1,] 0.5 0.5 0.5 #> [2,] 0.5 0.5 0.5 #> [3,] 0.5 0.5 0.5
removalPiFun(pRem) # Cell probs
#> [,1] [,2] [,3] #> [1,] 0.5 0.25 0.125 #> [2,] 0.5 0.25 0.125 #> [3,] 0.5 0.25 0.125
(pDouble <- matrix(0.5, 3, 2)) # Observer detection probs
#> [,1] [,2] #> [1,] 0.5 0.5 #> [2,] 0.5 0.5 #> [3,] 0.5 0.5
doublePiFun(pDouble) # Cell probs
#> [,1] [,2] [,3] #> [1,] 0.25 0.25 0.25 #> [2,] 0.25 0.25 0.25 #> [3,] 0.25 0.25 0.25
# A user-defined piFun calculating removal probs when time intervals differ. # Here 10-minute counts were divided into 2, 3, and 5 minute intervals. # This function could be supplied to unmarkedFrameMPois along with the obsToY # argument shown below. instRemPiFun <- function(p) { M <- nrow(p) J <- ncol(p) pi <- matrix(NA, M, J) p[,1] <- pi[,1] <- 1 - (1 - p[,1])^2 p[,2] <- 1 - (1 - p[,2])^3 p[,3] <- 1 - (1 - p[,3])^5 for(i in 2:J) { pi[,i] <- pi[, i - 1]/p[, i - 1] * (1 - p[, i - 1]) * p[, i] } return(pi) } instRemPiFun(pRem)
#> [,1] [,2] [,3] #> [1,] 0.75 0.21875 0.03027344 #> [2,] 0.75 0.21875 0.03027344 #> [3,] 0.75 0.21875 0.03027344
# Associated obsToY matrix required by unmarkedFrameMPois o2y <- diag(3) # if y has 3 columns o2y[upper.tri(o2y)] <- 1 o2y
#> [,1] [,2] [,3] #> [1,] 1 1 1 #> [2,] 0 1 1 #> [3,] 0 0 1