if (FALSE) {
expected.n(secrdemo.0)
expected.n(secrdemo.0, bycluster = TRUE)
expected.n(ovenbird.model.D)
## Clustered design
mini <- make.grid(nx = 3, ny = 3, spacing = 50, detector =
"proximity")
tempgrids <- trap.builder (cluster = mini , method = "all",
frame = expand.grid(x = seq(1000, 9000, 2000),
y = seq(1000, 9000, 2000)), plt = TRUE)
capt <- sim.capthist(tempgrids, popn = list(D = 2))
tempmask <- make.mask(tempgrids, buffer = 100,
type = "clusterbuffer")
fit <- secr.fit(capt, mask = tempmask, trace = FALSE)
En <- expected.n(fit, bycluster = TRUE)
## GoF or overdispersion statistic
p <- length(fit$fit$par)
y <- cluster.counts(capt)
## scaled by n-p
sum((y - En)^2 / En) / (length(En)-p)
sum((y - En)^2 / En) / sum(y/En)
}
Run the code above in your browser using DataLab