Mnat.size.processed=process.data(Mnat.size,model="CJS",begin.time=2003,groups=c("colony"))
Mnat.size.ddl=make.design.data(Mnat.size.processed)
Phi.size=list(formula=~size)
mod.size=mark(Mnat.size.processed, Mnat.size.ddl, model.parameters = list(Phi=Phi.size))
size.seq <- seq(37,44, by=0.5)
phibysize=covariate.predictions(mod.size,data=data.frame(size.seq), indices = c(1))
> phibysize$estimates
vcv.index model.index par.index covdata estimate se lcl ucl fixed
1 1 1 1 37.0 0.8523615 0.01082037 0.8298717 0.8723357
2 2 1 1 37.5 0.8523615 0.01082037 0.8298717 0.8723357
3 3 1 1 38.0 0.8523615 0.01082037 0.8298717 0.8723357
4 4 1 1 38.5 0.8523615 0.01082037 0.8298717 0.8723357
5 5 1 1 39.0 0.8523615 0.01082037 0.8298717 0.8723357
6 6 1 1 39.5 0.8523615 0.01082037 0.8298717 0.8723357
7 7 1 1 40.0 0.8523615 0.01082037 0.8298717 0.8723357
8 8 1 1 40.5 0.8523615 0.01082037 0.8298717 0.8723357
9 9 1 1 41.0 0.8523615 0.01082037 0.8298717 0.8723357
10 10 1 1 41.5 0.8523615 0.01082037 0.8298717 0.8723357
11 11 1 1 42.0 0.8523615 0.01082037 0.8298717 0.8723357
12 12 1 1 42.5 0.8523615 0.01082037 0.8298717 0.8723357
13 13 1 1 43.0 0.8523615 0.01082037 0.8298717 0.8723357
14 14 1 1 43.5 0.8523615 0.01082037 0.8298717 0.8723357
15 15 1 1 44.0 0.8523615 0.01082037 0.8298717 0.8723357
plot(phibysize$estimates$covdata, phibysize$estimates$estimate, type = "l", lwd=2, ylim = c(0,1))
lines(phibysize$estimates$covdata, phibysize$estimates$lcl,lty=2)
lines(phibysize$estimates$covdata, phibysize$estimates$ucl,lty=2)
Mnat_NSH_ch_easy$temp2002=rep(10.1,453)
Mnat_NSH_ch_easy$temp2003=rep(11.1,453)
Mnat_NSH_ch_easy$temp2004=rep(12.1,453)
Mnat_NSH_ch_easy$temp2005=rep(14.1,453)
Mnat_NSH_ch_easy$temp2006=rep(15.1,453)
Mnat_NSH_ch_easy$temp2007=rep(12.1,453)
Mnat_NSH_ch_easy$temp2008=rep(10.1,453)
Mnat_NSH_ch_easy$temp2009=rep(15.1,453)
Mnat_NSH_ch_easy$temp2010=rep(12.1,453)
Mnat_NSH_ch_easy$temp2011=rep(19.1,453)
Mnat_NSH_ch_easy$temp2012=rep(10.1,453)
Mnat_NSH_ch_easy$temp2013=rep(13.1,453)
Mnat_NSH_ch_easy$temp2014=rep(10.1,453)
Mnat_NSH_ch_easy$temp2015=rep(15.1,453)
Mnat_NSH_ch_easy$temp2016=rep(10.1,453)
Mnat_NSH_ch_easy$temp2017=rep(18.1,453)
Mnat_NSH_ch_easy$temp2018=rep(10.1,453)
Mnat_NSH_ch_easy$temp2019=rep(12.1,453)
Mnat_NSH_ch_easy$temp2020=rep(10.1,453)
Mnat_NSH_ch_easy$temp2021=rep(11.1,453)
Mnat.NSH.ch.easy.processed=process.data(Mnat_NSH_ch_easy,model="CJS",begin.time=2002,groups=c("MA","colony"))
Mnat.NSH.ch.easy.ddl=make.design.data(Mnat.NSH.ch.easy.processed)
Phi.temp=list(formula=~temp)
Phi.t<-mark(Mnat.NSH.ch.easy.processed, Mnat.NSH.ch.easy.ddl, model.parameters = list(Phi=Phi.temp, p=p.dot), adjust=TRUE)
predictions=covariate.predictions(Phi.t,data=data.frame(Temp2002=10:20),indices=1)$estimates
with(predictions,
{
plot(10:20,estimate,xlab="Rain",ylab="Survival",ylim=c(0,1))
lines(10:20,lcl,lty=2)
lines(10:20,ucl,lty=2)
})
predictions$estimate
[1] 0.8452862 0.8452862 0.8452862 0.8452862 0.8452862 0.8452862 0.8452862 0.8452862 0.8452862 0.8452862 0.8452862
The argument data is a dataframe containing values for the covariates used in the models. The names for the fields should match the names of the covariates used in the model.
Users browsing this forum: No registered users and 15 guests