Hello I am trying to do a goodness of fit analysis for a single season Occupancy model made with the package unmarked and assessed with the package AICcmodavg. You can download the original model as an RDS here
library(unmarked)
library(AICcmodavg)
BestMylu <- readRDS("best2.My.Lu2.rds")
obs.boot <- mb.gof.test(BestMylu, nsim = 5000)
I get the following error:
Error in data.frame(det.hist, preds.psi) : arguments imply differing number of rows: 123, 111 In addition: Warning messages: 1: Some observations have been discarded because corresponding covariates were missing. 2: 12 sites have been discarded because of missing data. 3: Some observations have been discarded because corresponding covariates were missing. 4: 12 sites have been discarded because of missing data.
I know that I got that because of NA data in my original data.frame, and I can go back and remove those rows, but I would have to redo 25 different models, and I would rather overcome this error.
Is there any way to overcome the error in this function, or is it possible to use another function to get the goodness of fit?
This error more looks like you have missing data in your response variable- so when the comparison between actual response and predicted response is performed, the number of rows are unequal- check both your response variable number of rows on your train and also the number of rows in your prediction output and see why they are not equal.