Learn R Programming

unmarked (version 1.4.3)

unmarkedFrameOccu: Organize data for the single season occupancy models fit by occu and occuRN

Description

Organizes detection, non-detection data along with the covariates. This S4 class is required by the data argument of occu and occuRN

Usage

unmarkedFrameOccu(y, siteCovs=NULL, obsCovs=NULL, mapInfo)

Value

an object of class unmarkedFrameOccu

Arguments

y

An RxJ matrix of the detection, non-detection data, where R is the number of sites, J is the maximum number of sampling periods per site.

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 RxJ rows in site-major order.

mapInfo

Currently ignored

Details

unmarkedFrameOccu is the S4 class that holds data to be passed to the occu and occuRN model-fitting function.

See Also

unmarkedFrame-class, unmarkedFrame, occu, occuRN

Examples

Run this code

# Fake data
R <- 4 # number of sites
J <- 3 # number of visits
y <- matrix(c(
   1,1,0,
   0,0,0,
   1,1,1,
   1,0,1), nrow=R, ncol=J, byrow=TRUE)
y

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

obs.covs <- list(
   x3 = matrix(c(
      -1,0,1,
      -2,0,0,
      -3,1,0,
      0,0,0), nrow=R, ncol=J, byrow=TRUE),
   x4 = matrix(c(
      'a','b','c',
      'd','b','a',
      'a','a','c',
      'a','b','a'), nrow=R, ncol=J, byrow=TRUE))
obs.covs

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


Run the code above in your browser using DataLab