Hi everyone,
I am using Unmarked package to model occupancy for the first time. For my analysis, I have 65 sites, maximum 12 replications, 5 site covariates and 1 survey covariate. My data has many missing values in detection history that matches survey covariates.
In the past I have used PRESENCE where missing values were replaced by "-". I already have tried blank cells as missing values and models run alright. I have tried parametric bootstrapping with goodness-of-fit using chi-square and Freeman-Tukey, but retruns NA values. I have added na.rm=TRUE and works fine; however I am not sure if I am doing it right (please see the code in the following)-
code: fitstats <- function(pi_SL_CWED_psi_distvil_CWED) {
observed <- getY(pi_SL_CWED_psi_distvil_CWED@data)
expected <- fitted(pi_SL_CWED_psi_distvil_CWED)
resids <- residuals(pi_SL_CWED_psi_distvil_CWED)
sse <- sum(resids^2, na.rm=TRUE)
chisq <- sum(((observed - expected)^2 / expected), na.rm=TRUE)
freeTuke <- sum(((sqrt(observed) - sqrt(expected))^2), na.rm=TRUE)
out <- c(SSE=sse, Chisq=chisq, freemanTukey=freeTuke)
return(out)
}
(pb <- parboot(pi_SL_CWED_psi_distvil_CWED, fitstats, nsim=1000, report=1))
# pi_SL_CWED_psi_distvil_CWED is my global model
I also tried to estimate MacKenzie and Bailey (2004) goodness-of-fit test using
mb.gof.test in
AICCmodavg package. It gives an error message-
Error in preds.p.not.na[j, ] : incorrect number of dimensions. I am really stuck with my analysis at this point.
I think this is due to the high number of missing values. I would really appreciate if anyone could let me know how to input missing values in Unmarked or if I am doing somethign wrong.
Thanks in advance!
Abid