Dear all
I am hoping someone can please assist.
I am mapping occupancy probability.
I have undertaken model selection. elev_year_group is the top ranking model where occupancy varies by elevation and detection by year_group. This model outputs sensible results and I can predict the occupancy at each monitored point by using the following code:
E.psi<-predict(elev_year_group, type="psi")
I can produce a plot of estimated occupancy without confidence using the following code:
(beta<-coef(elev_year_group))
Elevation<-raster("tasdem25.tif")
attr(sc,"scaled:scale")
ele.s<-(Elevation-348)/265
(beta<-coef(elev_year_group))
logit.psi<-beta[1]+beta[2]*ele.s
psi<-exp(logit.psi)/(1+exp(logit.psi))
plot(psi)
This produces a great map, however when I attempt to map confidence of occupancy using the following code:
ef <- stack(ele.s) #note this is a dummy stack because there is only one raster layer however when I type plot(ef) the correct map is produced
E.psi <- predict(elev_year_group, type="state", newdata=ef)
the following error results
Error in nrow(X) : object 'X' not found
and when I try
E.psi <- predict(elev_year_group, type="psi", newdata=ef)
Error in .local(object, ...) :
At least 1 covariate in the formula is not in the raster stack.
You probably need to assign them using
'names(object) <- covariate.names'
I would be very grateful for any suggestions.
Regards,
Billie.