Learn R Programming

unmarked (version 0.11-0)

unmarkedFrameDS: Organize data for the distance sampling model of Royle et al. (2004) fit by distsamp

Description

Organizes count data along with the covariates and metadata. This S4 class is required by the data argument of distsamp

Usage

unmarkedFrameDS(y, siteCovs=NULL, dist.breaks, tlength, survey, unitsIn, mapInfo)

Arguments

y
An RxJ matrix of count data, where R is the number of sites (transects) and J is the number of distance classes.
siteCovs
A data.frame of covariates that vary at the site level. This should have R rows and one column per covariate
dist.breaks
vector of distance cut-points delimiting the distance classes. It must be of length J+1.
tlength
A vector of length R containing the trasect lengths. This is ignored when survey="point".
survey
Either "point" or "line" for point- and line-transects.
unitsIn
Either "m" or "km" defining the measurement units for both dist.breaks and tlength
mapInfo
Currently ignored

Value

Details

unmarkedFrameDS is the S4 class that holds data to be passed to the distsamp model-fitting function.

References

Royle, J. A., D. K. Dawson, and S. Bates (2004) Modeling abundance effects in distance sampling. Ecology 85, pp. 1591-1597.

See Also

unmarkedFrame-class, unmarkedFrame, distsamp

Examples

Run this code

# Fake data
R <- 4 # number of sites
J <- 3 # number of distance classes

db <- c(0, 10, 20, 30) # distance break points

y <- matrix(c(
   5,4,3, # 5 detections in 0-10 distance class at this transect
   0,0,0,
   2,1,1,
   1,1,0), nrow=R, ncol=J, byrow=TRUE)
y

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

umf <- unmarkedFrameDS(y=y, siteCovs=site.covs, dist.breaks=db, survey="point",
    unitsIn="m")            # organize data
umf                         # look at data
summary(umf)                # summarize
fm <- distsamp(~1 ~1, umf)  # fit a model


Run the code above in your browser using DataLab