Dear all,
I have fit numerous distance functions to point count observations of around 200 bird species. I have extracted the best-fitting model for each species at each site class (forest or farmland) (since I tried lots of different detection functions, some species-specific ones, some with observations across species combined & species identity as a covariate, some with the proportion of closed habitat around each point as a covariate etc.).
Now, I am trying to use predict() to get the effective areas surveyed for the points where I did not record an individual. However, I keep getting this error:
Error in predict.ds(af.farm.mod, newdata = data.frame(name_latin = filled_data4$name_latin), :
fields or factor levels in `newdata` do not match data used in fitted model
This happens even when I extract the data directly from the model (so it is literally the data that was used to fit the model), eg:
af.farm.data <- (functm_chosen6[["Acridotheres_fuscus.farm"]][["model"]][["data"]])
##get ds object
af.farm.mod <- functm_chosen6[["Acridotheres_fuscus.farm"]][["model"]]
predict(af.farm.mod, newdata = NULL, esw = TRUE) ###works
predict(af.farm.mod, newdata = af.farm.data, esw = TRUE) ##does not work
functm_chosen6 is a large list containing the best fitting detection models for each species-site class combination.
I have also attached my R code & happy to provide more information or data.
Does anyone have any idea what has gone wrong?
Thank you so much for your help,
Iris