I am fairly new to unmarked as a package, but I'm trying to estimate the occupancy of Cooper's Hawks across Denver considering a list of covariates. I've found that percent tree canopy cover (PCT_CAN) and redlining grade (GRADE) out compete the other covariates I've considered in an AICc table and now I'm trying to create partial derivative xy plots of the estimates I get for occupancy for each of these within their own models. I'm having a difficult time creating predictions using my unmarked dataframe because R can't process an estimate around the categorical GRADE. I've included a screenshot of my unmarkedFrame. I need to 1) identify how to separate out GRADE and correctly process it because I'll need to create occupancy estimates for that covariate as well and 2) figure out the code for developing these xy plots with a 95% confidence interval envelope around it. Happy to provide more info, I'm not entirely sure what would be most useful.
Here's what I usually get back when I try to run this:
occu_modavg_psi_predict_df <- data.frame(Predicted =
occu_modavg_psi_predict$mod.avg.pred, lower =
occu_modavg_psi_predict$lower.CL, upper =
occu_modavg_psi_predict$upper.CL, siteCovs)
head(occu_modavg_psi_predict_df)
occu_PCTCAN_newdata <- data.frame(PCT_CAN =
seq(min(siteCovs$PCT_CAN),
max(siteCovs$PCT_CAN), by = 0.5),
Pct_Built = mean(siteCovs$Pct_Built),
# hold other variables constant
NDVI = mean(siteCovs$NDVI), NN = mean(siteCovs$NN))
# Model-averaged prediction of occupancy and confidence interval
occu_PCTCAN_pred <- modavgPred(occu_model_list, # c.hat =
# to change variance inflation factor, default = 1)
parm.type = "psi", # psi = occupancy
newdata = occu_PCTCAN_newdata)[c("mod.avg.pred",
"lower.CL", "upper.CL")]
Error in eval(predvars, data, env) : object 'GRADE' not found
occu_PCTCAN_newdata <- data.frame(PCT_CAN =
seq(min(siteCovs$PCT_CAN), max(siteCovs$PCT_CAN),
by = 0.5), Pct_Built = mean(siteCovs$Pct_Built),
# hold other variables constant
NDVI = mean(siteCovs$NDVI),
NN = mean(siteCovs$NN),
GRADE= mean(siteCovs$GRADE))
Warning: argument is not numeric or logical: returning NA
occu_PCTCAN_pred <- modavgPred(occu_model_list,
# c.hat = # to change variance inflation factor, default = 1)
parm.type = "psi", # psi = occupancy
newdata = occu_PCTCAN_newdata)[c("mod.avg.pred",
"lower.CL", "upper.CL")]
Warning: variable 'GRADE' is not a factorError in .local(obj,
coefficients, ...) :
ncol(coefficients) == length(est) is not TRUE