Learn R Programming

unmarked (version 1.4.3)

unmarkedFrameOccuMulti: Organize data for the multispecies occupancy model fit by occuMulti

Description

Organizes detection, non-detection data for multiple species along with the covariates. This S4 class is required by the data argument of occuMulti

Usage

unmarkedFrameOccuMulti(y, siteCovs=NULL, obsCovs=NULL, 
                              maxOrder, mapInfo)

Value

an object of class unmarkedFrameOccuMulti

Arguments

y

A list (optionally a named list) of length S where each element is an MxJ matrix of the detection, non-detection data for one species, where M is the number of sites, J is the maximum number of sampling periods per site, and S is the number of species in the analysis.

siteCovs

A data.frame of covariates that vary at the site level. This should have M rows and one column per covariate

obsCovs

Either a named list of data.frames of covariates that vary within sites, or a data.frame with MxJ rows in site-major order.

maxOrder

Optional; specify maximum interaction order. Defaults to number of species (all possible interactions). Reducing this value may speed up creation of unmarked frame if you aren't interested in higher-order interactions.

mapInfo

Currently ignored

Author

Ken Kellner contact@kenkellner.com

Details

unmarkedFrameOccuMulti is the S4 class that holds data to be passed to the occuMulti model-fitting function.

See Also

unmarkedFrame-class, unmarkedFrame, occuMulti

Examples

Run this code

# Fake data
S <- 3 # number of species
M <- 4 # number of sites
J <- 3 # number of visits

y <- list(matrix(rbinom(M*J,1,0.5),M,J), # species 1
          matrix(rbinom(M*J,1,0.5),M,J), # species 2
          matrix(rbinom(M*J,1,0.2),M,J)) # species 3

site.covs <- data.frame(x1=1:4, x2=factor(c('A','B','A','B')))
site.covs

umf <- unmarkedFrameOccuMulti(y=y, siteCovs=site.covs, 
    obsCovs=NULL)   # organize data
umf                     # look at data
summary(umf)            # summarize      
plot(umf)               # visualize
#fm <- occu(~1 ~1, umf)  # fit a model


Run the code above in your browser using DataLab