unmarkedFrameMPois.Rd
Organizes count data along with the covariates.
This S4 class is required by the data argument of
multinomPois
unmarkedFrameMPois(y, siteCovs=NULL, obsCovs=NULL, type, obsToY, mapInfo, piFun)
y | An RxJ matrix of count data, where R is the number of sites (transects) and J is the maximum number of observations per site. |
---|---|
siteCovs | A |
obsCovs | Either a named list of RxJ |
type | Either "removal" for removal sampling, "double" for standard
double observer sampling, or "depDouble" for dependent double observer
sampling. If this argument not specified, the user must
provide an |
obsToY | A matrix describing the relationship between |
mapInfo | Currently ignored |
piFun | Function used to compute the multinomial cell probabilities
from a matrix of detection probabilities. This is created automatically
if |
unmarkedFrameMPois is the S4 class that holds data to be passed
to the multinomPois
model-fitting function.
an object of class unmarkedFrameMPois
Royle, J. A. (2004). Generalized estimators of avian abundance from count survey data. Animal Biodiversity and Conservation, 27(1), 375-386.
# Fake doulbe observer data R <- 4 # number of sites J <- 2 # number of observers y <- matrix(c( 1,0,3, 0,0,0, 2,0,1, 0,0,2), nrow=R, ncol=J+1, byrow=TRUE) y#> [,1] [,2] [,3] #> [1,] 1 0 3 #> [2,] 0 0 0 #> [3,] 2 0 1 #> [4,] 0 0 2#> x1 x2 #> 1 1 A #> 2 2 B #> 3 3 A #> 4 4 Bobs.covs <- list( x3 = matrix(c( -1,0, -2,0, -3,1, 0,0), nrow=R, ncol=J, byrow=TRUE), x4 = matrix(c( 'a','b', 'a','b', 'a','b', 'a','b'), nrow=R, ncol=J, byrow=TRUE)) obs.covs#> $x3 #> [,1] [,2] #> [1,] -1 0 #> [2,] -2 0 #> [3,] -3 1 #> [4,] 0 0 #> #> $x4 #> [,1] [,2] #> [1,] "a" "b" #> [2,] "a" "b" #> [3,] "a" "b" #> [4,] "a" "b" #># Create unmarkedFrame umf <- unmarkedFrameMPois(y=y, siteCovs=site.covs, obsCovs=obs.covs, type="double")#> Warning: obsCovs contains characters. Converting them to factors.# The above is the same as: o2y <- matrix(1, 2, 3) pifun <- function(p) { M <- nrow(p) pi <- matrix(NA, M, 3) pi[, 1] <- p[, 1] * (1 - p[, 2]) pi[, 2] <- p[, 2] * (1 - p[, 1]) pi[, 3] <- p[, 1] * p[, 2] return(pi) } umf <- unmarkedFrameMPois(y=y, siteCovs=site.covs, obsCovs=obs.covs, obsToY=o2y, piFun="pifun")#> Warning: obsCovs contains characters. Converting them to factors.#> Warning: Custom pi functions are not supported by C engine. Using R engine instead.#> Error in pifun(p = structure(c(0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5), dim = c(4L, 2L))): could not find function "pifun"