I am trying to model average the predictions for Model 3. I keep getting the error below and I don’t know how to fix it. coy_cov is an obsCov with 1 ,0 or NA for each survey. Am I missing something obvious? Thank you
M<-42
J<-246
T <- 3
season<- matrix(c('1','2','3'), nrow(raccoon), T, byrow=TRUE)
coy_cov<-coyoteMS.data[,2:247]
coy_cov[is.na(coy_cov) != is.na(coy_cov)]<-NA
hcov<-humans[,2:247]
hcov[is.na(hcov) != is.na(hcov)]<-NA
raccoonMS.umf <- unmarkedMultFrame(y=raccoon[,2:247],
siteCovs = NULL,
obsCovs= list(coy=coy_cov,hcov=hcov),
yearlySiteCovs=list(season=season),
numPrimary = T)
Cand.models<-list()
Cand.models[[1]]<-colext(psiformula= ~1, gammaformula = ~ 1, epsilonformula = ~ 1, pformula = ~season-1, raccoonMS.umf, se=TRUE)
Cand.models[[2]]<-colext(psiformula= ~1, gammaformula = ~ 1, epsilonformula = ~ 1, pformula = ~coy, raccoonMS.umf, se=TRUE)
Cand.models[[3]]<-colext(psiformula= ~1, gammaformula = ~ 1, epsilonformula = ~ 1, pformula = ~season-1+ coy, raccoonMS.umf, se=TRUE)
Cand.models[[4]]<-colext(psiformula= ~1, gammaformula = ~ 1, epsilonformula = ~ 1, pformula = ~hcov, raccoonMS.umf, se=TRUE)
Modnames <- paste("mod", 1:length(Cand.models), sep = "")
new.dat<-data.frame(season=factor(season,levels=unique(season)),coy=coy_cov)
modavgPred(cand.set = Cand.models, modnames = Modnames,newdata='new.dat',parm.type='detect')
Error in if (ncolumns == 1) newdata$blank.fake.column.NAs <- NA :
argument is of length zero