unmarkedFrameDS.Rd
Organizes count data along with the covariates and metadata.
This S4 class is required by the data argument of distsamp
unmarkedFrameDS(y, siteCovs=NULL, dist.breaks, tlength, survey,
unitsIn, mapInfo)
An RxJ matrix of count data, where R is the number of sites (transects) and J is the number of distance classes.
A data.frame
of covariates that vary at the
site level. This should have R rows and one column per covariate
vector of distance cut-points delimiting the distance classes. It must be of length J+1.
A vector of length R containing the trasect lengths. This is ignored when survey="point".
Either "point" or "line" for point- and line-transects.
Either "m" or "km" defining the measurement units for
both dist.breaks
and tlength
.
unmarkedFrameDS is the S4 class that holds data to be passed
to the distsamp
model-fitting function.
an object of class unmarkedFrameDS
If you have continuous distance data, they must be "binned" into discrete distance classes, which are delimited by dist.breaks.
Royle, J. A., D. K. Dawson, and S. Bates (2004) Modeling abundance effects in distance sampling. Ecology 85, pp. 1591-1597.
# 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
#> [,1] [,2] [,3]
#> [1,] 5 4 3
#> [2,] 0 0 0
#> [3,] 2 1 1
#> [4,] 1 1 0
site.covs <- data.frame(x1=1:4, x2=factor(c('A','B','A','B')))
site.covs
#> x1 x2
#> 1 1 A
#> 2 2 B
#> 3 3 A
#> 4 4 B
umf <- unmarkedFrameDS(y=y, siteCovs=site.covs, dist.breaks=db, survey="point",
unitsIn="m") # organize data
umf # look at data
#> Data frame representation of unmarkedFrame object.
#> y.1 y.2 y.3 x1 x2
#> 1 5 4 3 1 A
#> 2 0 0 0 2 B
#> 3 2 1 1 3 A
#> 4 1 1 0 4 B
summary(umf) # summarize
#> unmarkedFrameDS Object
#>
#> point-transect survey design
#> Distance class cutpoints (m): 0 10 20 30
#>
#> 4 sites
#> Maximum number of distance classes per site: 3
#> Mean number of distance classes per site: 3
#> Sites with at least one detection: 3
#>
#> Tabulation of y observations:
#> 0 1 2 3 4 5
#> 4 4 1 1 1 1
#>
#> Site-level covariates:
#> x1 x2
#> Min. :1.00 A:2
#> 1st Qu.:1.75 B:2
#> Median :2.50
#> Mean :2.50
#> 3rd Qu.:3.25
#> Max. :4.00
fm <- distsamp(~1 ~1, umf) # fit a model