I've been working on a project to obtain estimates for abundance of particular species at a several specific points based on point counts. The data I have includes point counts, with every species that was observed during the surveys and their corresponding distances.
I've been instructed to use the data for all species to construct a ds() model and explore different covariates, including species. So far, species is the only covariate that seems to significantly improve the model, so I've included it as a covariate. The best model is a ds() using hazard-rate with species as the one covariate:
KAEL_model.hr.sp <- ds(KAEL, transect = "point", key = "hr", truncation = "15%", formula = ~species)
Using this model, I'd like to get bootstrap abundance estimates for only certain key species. I tried to subset the original data frame into one that only has one species. The issue is that bootdht() doesn't seem to work when species only has one factor level. Here is the bootdht() I am performing and the error it yields:
KAEL_boot<-bootdht(
KAEL_model.hr.sp,
flatfile=KAEL_only,
resample_strata = FALSE,
resample_obs = FALSE,
resample_transects = TRUE,
nboot = 500,
summary_fun = bootdht_Nhat_summarize,
convert_units = 1,
select_adjustments = FALSE,
sample_fraction = 1,
multipliers = NULL,
progress_bar = "base",
cores = 1,
)
in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
It seems that bootdht() is unable to get abundance estimates when the species covariate only has one factor level. My question is: is there an effective way to perform a bootstrap for only one, or a few select species? Would it still be accurate?
I have considered performing a bootstrap of the entire original dataset and then subsetting only the species I am interested in, but it seems that this would take an inordinate amount of time. I would like to avoid this unless it is absolutely necessary, but I'm not sure if there is another option.
Thank you for your help!
Ben