jay.Rd
The Swiss breeding bird survey ("Monitoring Haufige Brutvogel" MHB) has monitored the populations of 150 common species since 1999. The MHB sample consists of 267 1-km squares that are laid out as a grid across Switzerland. Fieldwork is conducted by about 200 skilled birdwatchers, most of them volunteers. Avian populations are monitored using a simplified territory mapping protocol, where each square is surveyed up to three times during the breeding season (only twice above the tree line). Surveys are conducted along a transect that does not change over the years.
The list jay
has the data for European Jay territories for 238 sites surveyed in 2002.
data("jay")
jay
is a list with 3 elements:
a data frame with rows for 238 sites and columns for each of the observable detection histories. For the sites visited 3 times, these are "100", "010", "001", "110", "101", "011", "111"
. Sites visited twice have "10x", "01x", "11x"
.
Each row gives the number of territories with the corresponding detection history, with NA for the detection histories not applicable: sites visited 3 times have NAs in the last 3 columns while those visited twice have NAs in the first 7 columns.
In previous versions, jay
had additional information not required for the analysis, and a data frame with essentially the same information as the Switzerland
data set.
Swiss Ornithological Institute
Royle, J.A., Kery, M., Gauthier, R., Schmid, H. (2007) Hierarchical spatial models of abundance and occurrence from imperfect survey data. Ecological Monographs, 77, 465-481.
Kery & Royle (2016) Applied Hierarachical Modeling in Ecology Section 7.9
data(jay)
str(jay)
#> List of 3
#> $ caphist :'data.frame': 238 obs. of 10 variables:
#> ..$ 100: num [1:238] 1 0 0 1 1 1 0 0 2 1 ...
#> ..$ 010: num [1:238] 0 0 2 0 0 0 0 0 0 1 ...
#> ..$ 001: num [1:238] 0 1 0 0 0 0 0 0 0 3 ...
#> ..$ 110: num [1:238] 0 0 0 0 0 2 0 1 0 2 ...
#> ..$ 101: num [1:238] 0 0 0 0 0 0 0 1 0 2 ...
#> ..$ 011: num [1:238] 0 0 0 0 0 1 0 0 0 4 ...
#> ..$ 111: num [1:238] 0 0 0 0 0 0 0 0 0 0 ...
#> ..$ 10x: num [1:238] NA NA NA NA NA NA NA NA NA NA ...
#> ..$ 01x: num [1:238] NA NA NA NA NA NA NA NA NA NA ...
#> ..$ 11x: num [1:238] NA NA NA NA NA NA NA NA NA NA ...
#> $ sitecovs:'data.frame': 238 obs. of 3 variables:
#> ..$ elev : num [1:238] 420 450 1050 1110 510 630 590 530 1140 770 ...
#> ..$ length: num [1:238] 6.2 5.1 4.3 5.4 3.6 6.1 5.1 3.7 3.8 7.7 ...
#> ..$ forest: int [1:238] 3 21 32 35 2 60 5 13 50 57 ...
#> $ covinfo :'data.frame': 238 obs. of 8 variables:
#> ..$ x : num [1:238] 922942 928942 928942 934942 946942 ...
#> ..$ y : num [1:238] 63276 79276 103276 111276 95276 ...
#> ..$ dur1 : num [1:238] 240 160 120 180 210 150 115 155 165 220 ...
#> ..$ dur2 : num [1:238] 240 155 105 170 225 180 105 140 165 230 ...
#> ..$ dur3 : num [1:238] 240 140 85 145 235 195 95 135 180 255 ...
#> ..$ date1: num [1:238] 29 13 30 23 28 17 16 24 25 21 ...
#> ..$ date2: num [1:238] 58 39 47 44 56 56 37 47 46 38 ...
#> ..$ date3: num [1:238] 73 62 74 71 73 73 76 74 70 50 ...
# Carry out a simple analysis, without covariates:
# Create a customised piFun (see ?piFun for details)
crPiFun <- function(p) {
p1 <- p[,1] # Extract the columns of the p matrix, one for
p2 <- p[,2] # each of J = 3 sample occasions
p3 <- p[,3]
cbind( # define multinomial cell probabilities:
"100" = p1 * (1-p2) * (1-p3),
"010" = (1-p1) * p2 * (1-p3),
"001" = (1-p1) * (1-p2) * p3,
"110" = p1 * p2 * (1-p3),
"101" = p1 * (1-p2) * p3,
"011" = (1-p1) * p2 * p3,
"111" = p1 * p2 * p3,
"10x" = p1*(1-p2),
"01x" = (1-p1)*p2,
"11x" = p1*p2)
}
# Build the unmarkedFrame object
mhb.umf <- unmarkedFrameMPois(y=as.matrix(jay$caphist),
obsToY=matrix(1, 3, 10), piFun="crPiFun")
# Fit a model
( fm1 <- multinomPois(~1 ~1, mhb.umf) )
#> Warning: Custom pi functions are not supported by C engine. Using R engine instead.
#> Error in crPiFun(p = structure(c(0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5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