Hi, I am having some trouble using the covariate.prediction function. I've run CJS models with several weather covariates for survival of different groups, and I'd like to predict survival rates under certain weather conditions. The problem I'm having is that the output using covariate.prediction is exactly the same as the original survival estimates over a number of years (through the whole range of weather conditions), rather than a single estimate for survival in the one particular set of weather conditions. I'm sure it's just a coding error somewhere, but I haven't figured it out yet.
Here is some (abbreviated) code, where A1, A, H, and L are the different groups, and djf1, avg, rain, and rain1 are different weather covariates:
model=function() {
Phi.L.djf1_A1_A1.avg_A_A.rain_H_H.rain1=list(formula=~L:djf1+A1+A1:avg+A+A:rain+H+H:rain1)
p.time=list(formula=~time)
cml=create.model.list("CJS")
results=mark.wrapper(cml,data=sosp.process,ddl=sosp.ddl,output=FALSE)
return(results)
}
results=model()
A1pims=c(1,30,58,85,111,136,160,183,205,226,246,265,283,300,316,331,345,358,370,381,391,400,408,415,421,426,430,433,435)
#prediction for A1 group, for avg=1.59
predict.A1=covariate.predictions(results,data=data.frame(avg=1.59),indices=A1pims)
The covariate is labelled the same as in the original model, and it doesn't seem to matter whether I use only one model or a marklist of models, or if I try the prediction for multiple groups/covariates at the same time.
I would appreciate any insights you might have. Thanks!