Constructor for unmarkedFrames.

unmarkedFrame(y, siteCovs=NULL, obsCovs=NULL, mapInfo, obsToY)

Arguments

y

An MxJ matrix of the observed measured data, where M is the number of sites and J is the maximum number of observations 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 MxJ rows in site-major order.

obsToY

optional matrix specifying relationship between observation-level covariates and response matrix

mapInfo

geographic coordinate information. Currently ignored.

Details

unmarkedFrame is the S4 class that holds data structures to be passed to the model-fitting functions in unmarked.

An unmarkedFrame contains the observations (y), covariates measured at the observation level (obsCovs), and covariates measured at the site level (siteCovs). For a data set with M sites and J observations at each site, y is an M x J matrix. obsCovs and siteCovs are both data frames (see data.frame). siteCovs has M rows so that each row contains the covariates for the corresponding sites. obsCovs has M*obsNum rows so that each covariates is ordered by site first, then observation number. Missing values are coded with NA in any of y, siteCovs, or obsCovs.

Additionally, unmarkedFrames contain metadata: obsToY, mapInfo. obsToY is a matrix describing relationship between response matrix and observation-level covariates. Generally this does not need to be supplied by the user; however, it may be needed when using multinomPois. For example, double observer sampling, y has 3 columns corresponding the observer 1, observer 2, and both, but there were only two independent observations. In this situation, y has 3 columns, but obsToY must be specified.

Several child classes of unmarkedFrame require addional metadata. For example, unmarkedFrameDS is used to organize distsance sampling data for the distsamp function, and it has arguments dist.breaks, tlength, survey, and unitsIn, which specify the distance interval cut points, transect lengths, "line" or "point" transect, and units of measure, respectively.

All site-level covariates are automatically copied to obsCovs so that site level covariates are available at the observation level.

Value

an unmarkedFrame object

See also

Examples

# Set up data for pcount() data(mallard) mallardUMF <- unmarkedFramePCount(mallard.y, siteCovs = mallard.site, obsCovs = mallard.obs) summary(mallardUMF)
#> unmarkedFrame Object #> #> 239 sites #> Maximum number of observations per site: 3 #> Mean number of observations per site: 2.76 #> Sites with at least one detection: 40 #> #> Tabulation of y observations: #> 0 1 2 3 4 7 10 12 <NA> #> 576 54 11 9 6 1 1 1 58 #> #> Site-level covariates: #> elev length forest #> Min. :-1.436000 Min. :-4.945000 Min. :-1.2650000 #> 1st Qu.:-0.956500 1st Qu.:-0.563000 1st Qu.:-0.9560000 #> Median :-0.198000 Median : 0.045000 Median :-0.0650000 #> Mean :-0.000046 Mean :-0.000029 Mean : 0.0000669 #> 3rd Qu.: 0.994000 3rd Qu.: 0.626000 3rd Qu.: 0.7900000 #> Max. : 2.434000 Max. : 2.255000 Max. : 2.2990000 #> #> Observation-level covariates: #> ivel date #> Min. :-1.75300 Min. :-2.90400 #> 1st Qu.:-0.66600 1st Qu.:-1.11900 #> Median :-0.13900 Median :-0.11900 #> Mean : 0.00002 Mean : 0.00007 #> 3rd Qu.: 0.54900 3rd Qu.: 1.31000 #> Max. : 5.98000 Max. : 3.81000 #> NA's :52 NA's :42
# Set up data for occu() data(frogs) pferUMF <- unmarkedFrameOccu(pfer.bin) # Set up data for distsamp() data(linetran) ltUMF <- with(linetran, { unmarkedFrameDS(y = cbind(dc1, dc2, dc3, dc4), siteCovs = data.frame(Length, area, habitat), dist.breaks = c(0, 5, 10, 15, 20), tlength = linetran$Length * 1000, survey = "line", unitsIn = "m") }) summary(ltUMF)
#> unmarkedFrameDS Object #> #> line-transect survey design #> Distance class cutpoints (m): 0 5 10 15 20 #> #> 12 sites #> Maximum number of distance classes per site: 4 #> Mean number of distance classes per site: 4 #> Sites with at least one detection: 11 #> #> Tabulation of y observations: #> 0 1 2 3 4 5 6 8 #> 14 9 10 4 2 4 3 2 #> #> Site-level covariates: #> Length area habitat #> Min. :1 Min. :3.873 A:6 #> 1st Qu.:3 1st Qu.:4.473 B:6 #> Median :4 Median :5.426 #> Mean :4 Mean :5.351 #> 3rd Qu.:5 3rd Qu.:6.027 #> Max. :7 Max. :7.059
# Set up data for multinomPois() data(ovendata) ovenFrame <- unmarkedFrameMPois(ovendata.list$data, siteCovs=as.data.frame(scale(ovendata.list$covariates[,-1])), type = "removal") summary(ovenFrame)
#> unmarkedFrame Object #> #> 70 sites #> Maximum number of observations per site: 4 #> Mean number of observations per site: 4 #> Sites with at least one detection: 44 #> #> Tabulation of y observations: #> 0 1 2 3 #> 218 49 11 2 #> #> Site-level covariates: #> ufc trba #> Min. :-1.4713 Min. :-2.0099 #> 1st Qu.:-0.7408 1st Qu.:-0.6931 #> Median :-0.2535 Median :-0.1287 #> Mean : 0.0000 Mean : 0.0000 #> 3rd Qu.: 0.9844 3rd Qu.: 0.7178 #> Max. : 2.3444 Max. : 2.8811
if (FALSE) { # Set up data for colext() frogUMF <- formatMult(masspcru) summary(frogUMF) }