Organizes repeated count data along with the covariates and possibly the dates on which each survey was conducted. This S4 class is required by the data argument of pcountOpen

unmarkedFramePCO(y, siteCovs=NULL, obsCovs=NULL, yearlySiteCovs, mapInfo,
    numPrimary, primaryPeriod)

Arguments

y

An MxJT matrix of the repeated count data, where M is the number of sites, J is the maximum number of secondary sampling periods per site 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

obsCovs

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

yearlySiteCovs

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

mapInfo

Currently ignored

numPrimary

Maximum number of observed primary periods for each site

primaryPeriod

matrix of integers indicating the primary period of each survey.

Details

unmarkedFramePCO is the S4 class that holds data to be passed to the pcountOpen model-fitting function.

The unmarkedFramePCO class is similar to the unmarkedFramePCount class except that it contains the dates for each survey, which needs to be supplied .

Value

an object of class unmarkedFramePCO

Examples


# Repeated count data with 5 primary periods and
# no secondary sampling periods (ie J==1)
y1 <- matrix(c(
    0, 2, 3, 2, 0,
    2, 2, 3, 1, 1,
    1, 1, 0, 0, 3,
    0, 0, 0, 0, 0), nrow=4, ncol=5, byrow=TRUE)

# Site-specific covariates
sc1 <- data.frame(x1 = 1:4, x2 = c('A','A','B','B'))

# Observation-specific covariates
oc1 <- list(
    x3 = matrix(1:5, nrow=4, ncol=5, byrow=TRUE),
    x4 = matrix(letters[1:5], nrow=4, ncol=5, byrow=TRUE))

# Primary periods of surveys
primaryPeriod1 <- matrix(as.integer(c(
    1, 2, 5, 7, 8,
    1, 2, 3, 4, 5,
    1, 2, 4, 5, 6,
    1, 3, 5, 6, 7)), nrow=4, ncol=5, byrow=TRUE)


# Create the unmarkedFrame
umf1 <- unmarkedFramePCO(y=y1, siteCovs=sc1, obsCovs=oc1, numPrimary=5,
    primaryPeriod=primaryPeriod1)
#> Warning: siteCovs contains characters. Converting them to factors.
#> Warning: obsCovs contains characters. Converting them to factors.

# Take a look
umf1
#> Data frame representation of unmarkedFrame object.
#>   y.1 y.2 y.3 y.4 y.5 x1 x2 x3.1 x3.2 x3.3 x3.4 x3.5 x4.1 x4.2 x4.3 x4.4 x4.5
#> 1   0   2   3   2   0  1  A    1    2    3    4    5    a    b    c    d    e
#> 2   2   2   3   1   1  2  A    1    2    3    4    5    a    b    c    d    e
#>  [ reached 'max' / getOption("max.print") -- omitted 2 rows ]
summary(umf1)
#> unmarkedFrame Object
#> 
#> 4 sites
#> Maximum number of observations per site: 5 
#> Mean number of observations per site: 5 
#> Number of primary survey periods: 5 
#> Number of secondary survey periods: 1 
#> Sites with at least one detection: 3 
#> 
#> Tabulation of y observations:
#> 0 1 2 3 
#> 9 4 4 3 
#> 
#> 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        
#> 
#> Observation-level covariates:
#>        x3    x4   
#>  Min.   :1   a:4  
#>  1st Qu.:2   b:4  
#>  Median :3   c:4  
#>  Mean   :3   d:4  
#>  3rd Qu.:4   e:4  
#>  Max.   :5        






# Repeated count data with 4 primary periods and
# no 2 secondary sampling periods (ie J=2)
y2 <- matrix(c(
    0,0,  2,2,  3,2,  2,2,
    2,2,  2,1,  3,2,  1,1,
    1,0,  1,1,  0,0,  0,0,
    0,0,  0,0,  0,0,  0,0), nrow=4, ncol=8, byrow=TRUE)


# Site-specific covariates
sc2 <- data.frame(x1 = 1:4, x2 = c('A','A','B','B'))

# Observation-specific covariates
oc2 <- list(
    x3 = matrix(1:8, nrow=4, ncol=8, byrow=TRUE),
    x4 = matrix(letters[1:8], nrow=4, ncol=8, byrow=TRUE))

# Yearly-site covariates
ysc <- list(
    x5 = matrix(c(
        1,2,3,4,
        1,2,3,4,
        1,2,3,4,
        1,2,3,4), nrow=4, ncol=4, byrow=TRUE))

# Primary periods of surveys
primaryPeriod2 <- matrix(as.integer(c(
    1,2,5,7,
    1,2,3,4,
    1,2,4,5,
    1,3,5,6)), nrow=4, ncol=4, byrow=TRUE)

# Create the unmarkedFrame
umf2 <- unmarkedFramePCO(y=y2, siteCovs=sc2, obsCovs=oc2,
    yearlySiteCovs=ysc,
    numPrimary=4, primaryPeriod=primaryPeriod2)
#> Warning: siteCovs contains characters. Converting them to factors.
#> Warning: obsCovs contains characters. Converting them to factors.

# Take a look
umf2
#> Data frame representation of unmarkedFrame object.
#>   y.1 y.2 y.3 y.4 y.5 y.6 y.7 y.8 x1 x2 x5.1 x5.2 x5.3 x5.4 x3.1 x3.2 x3.3 x3.4
#> 1   0   0   2   2   3   2   2   2  1  A    1    2    3    4    1    2    3    4
#>   x3.5 x3.6 x3.7 x3.8 x4.1 x4.2 x4.3 x4.4 x4.5 x4.6 x4.7 x4.8
#> 1    5    6    7    8    a    b    c    d    e    f    g    h
#>  [ reached 'max' / getOption("max.print") -- omitted 3 rows ]
summary(umf2)
#> unmarkedFrame Object
#> 
#> 4 sites
#> Maximum number of observations per site: 8 
#> Mean number of observations per site: 8 
#> Number of primary survey periods: 4 
#> Number of secondary survey periods: 2 
#> Sites with at least one detection: 3 
#> 
#> Tabulation of y observations:
#>  0  1  2  3 
#> 15  6  9  2 
#> 
#> 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        
#> 
#> Observation-level covariates:
#>        x3             x4   
#>  Min.   :1.00   a      :4  
#>  1st Qu.:2.75   b      :4  
#>  Median :4.50   c      :4  
#>  Mean   :4.50   d      :4  
#>  3rd Qu.:6.25   e      :4  
#>  Max.   :8.00   f      :4  
#>                 (Other):8  
#> 
#> Yearly-site-level covariates:
#>        x5      
#>  Min.   :1.00  
#>  1st Qu.:1.75  
#>  Median :2.50  
#>  Mean   :2.50  
#>  3rd Qu.:3.25  
#>  Max.   :4.00