Organizes distance sampling data and experimental design information from multiple primary periods along with associated covariates. This S4 class is required by the data argument of distsampOpen

unmarkedFrameDSO(y, siteCovs=NULL, yearlySiteCovs=NULL, numPrimary, 
       primaryPeriod, dist.breaks, tlength, survey, unitsIn)

Arguments

y

An MxJT matrix of the repeated count data, where M is the number of sites (i.e., points or transects), J is the number of distance classes and T is the maximum number of primary 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

yearlySiteCovs

Either a named list of MxT data.frames, or a site-major data.frame with MT rows and 1 column per covariate

numPrimary

Maximum number of observed primary periods for each site

primaryPeriod

An MxJT matrix of integers indicating the primary period of each observation

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 transect 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

Details

unmarkedFrameDSO is the S4 class that holds data to be passed to the distsampOpen model-fitting function. Unlike most unmarked functions, obsCovs cannot be supplied.

If you have continuous distance data, they must be "binned" into discrete distance classes, which are delimited by dist.breaks.

When gamma or omega are modeled using year-specific covariates, the covariate data for the final year will be ignored; however, they must be supplied.

If the time gap between primary periods is not constant, an M by T matrix of integers should be supplied using the primaryPeriod argument.

Value

an object of class unmarkedFrameDSO

Examples


# Fake data
M <- 4 # number of sites
J <- 3 # number of distance classes
T <- 2 # number of primary periods

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

y <- matrix(c(
   5,4,3, 6,2,1, # In bin 1: 5 detections in primary period 1, 6 in period 2
   0,0,0, 0,1,0,
   2,1,1, 0,0,0,
   1,1,0, 1,1,1), nrow=M, ncol=J*T, byrow=TRUE)
y
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    5    4    3    6    2    1
#> [2,]    0    0    0    0    1    0
#> [3,]    2    1    1    0    0    0
#> [4,]    1    1    0    1    1    1

# Primary periods of observations
# In this case there are no gaps
primPer <- matrix(as.integer(c(
    1,2,
    1,2,
    1,2,
    1,2)), nrow=M, ncol=T, byrow=TRUE)

#Site covs: M rows and 1 column per covariate
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

#Yearly site covs on gamma/omega
ysc <- list(
    x3 = matrix(c(
        1,2,
        1,2,
        1,2,
        1,2), nrow=M, ncol=T, byrow=TRUE))

umf <- unmarkedFrameDSO(y=y, siteCovs=site.covs, yearlySiteCovs=ysc,
                        numPrimary=T, primaryPeriod=primPer,
                        dist.breaks=db, survey="point", unitsIn="m")            

umf                         # look at data
#> Data frame representation of unmarkedFrame object.
#>   y.1 y.2 y.3 y.4 y.5 y.6 x1 x2 x3.1 x3.2
#> 1   5   4   3   6   2   1  1  A    1    2
#> 2   0   0   0   0   1   0  2  B    1    2
#> 3   2   1   1   0   0   0  3  A    1    2
#> 4   1   1   0   1   1   1  4  B    1    2
summary(umf)                # summarize
#> unmarkedFrame Object
#> 
#> 4 sites
#> Maximum number of observations per site: 6 
#> Mean number of observations per site: 6 
#> Number of primary survey periods: 2 
#> Number of secondary survey periods: 1 
#> Sites with at least one detection: 4 
#> 
#> Tabulation of y observations:
#> 0 1 2 3 4 5 6 
#> 9 9 2 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        
#> 
#> Yearly-site-level covariates:
#>        x3     
#>  Min.   :1.0  
#>  1st Qu.:1.0  
#>  Median :1.5  
#>  Mean   :1.5  
#>  3rd Qu.:2.0  
#>  Max.   :2.0