##anuran larvae example from Mazerolle (2006)
data(min.trap)
##assign "UPLAND" as the reference level as in Mazerolle (2006)
min.trap$Type <- relevel(min.trap$Type, ref = "UPLAND")
##run model
m1 <- glm(Num_anura ~ Type + log.Perimeter + Num_ranatra,
family = poisson, offset = log(Effort),
data = min.trap)
##check c-hat for global model
c_hat(m1) #uses Pearson's chi-square/df
##display results corrected for overdispersion
summaryOD(m1, c_hat(m1))
summaryOD(m1, c_hat(m1), out.type = "nhst")
##example with occupancy model
if (FALSE) {
##load unmarked package
if(require(unmarked)){
data(bullfrog)
##detection data
detections <- bullfrog[, 3:9]
##assemble in unmarkedFrameOccu
bfrog <- unmarkedFrameOccu(y = detections)
##run model
fm <- occu(~ 1 ~ 1, data = bfrog)
##check GOF
##GOF <- mb.gof.test(fm, nsim = 1000)
##estimate of c-hat: 1.89
##display results after overdispersion adjustment
summaryOD(fm, c.hat = 1.89)
summaryOD(fm, c.hat = 1.89, out.type = "nhst")
detach(package:unmarked)
}
}
Run the code above in your browser using DataLab