I've modeled the relative abundance of ocelots with the Royle & Nichols models at unmarked and now I'm trying to compute the c-hat for the most parameterized model. I've used this code:
# Goodness of fit
fitstats <- function(fm){
observed <- getY(umfRN_b200_leg2)
expected <- fitted(fm)
resids <- residuals(fm)
sse <- sum(resids^2)
chisq <- sum(((observed-expected)^2)/expected)
freeTuke <- sum((sqrt(observed)-sqrt(expected))^2)
out <- c(SSE = sse, Chisq=chisq, freemanTukey = freeTuke)
return(out)
}
pb <- parboot(rDES_lamGl, fitstats, nsim=50)
But when I called the object 'pb' I've got this error message:
Call: parboot(object = rDES_lamGl, statistic = fitstats, nsim = 50)
Parametric Bootstrap Statistics:
t0 mean(t0 - t_B) StdDev(t0 - t_B) Pr(t_B > t0)
SSE NA NA NA NA
Chisq NA NA NA NA
freemanTukey NA NA NA NA
t_B quantiles:
Error in quantile.default(newX[, i], ...) :
missing values and NaN's not allowed if 'na.rm' is FALSE
As I have NAs at my occurence matrix I tried the function parboot with na.rm = TRUE, but R says that it is an unused argument.
Does anyone have any idea about what is happening or what shoud I do to compute the goodness of fit?
I've also tried to remove the NAs from the unmarked frame with the function na.omit, but it didn't work.
Thank you very much for your help.
best regards,
-- Att.
Roberta Montanheiro Paolino
Bióloga
Mestranda em Biologia Comparada - FFCLRP / USP-RP
Laboratório de Ecologia e Conservação de Mamíferos
(16) 99182 3123