# 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
# 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
#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
summary(umf) # summarize
Run the code above in your browser using DataLab