Hi,
I'm sorry to ask this again, but I have the same issue, however, unfortunately didn't manage to solve it yet. I followed the code and instructions in the Appendix C and also in the Workshop notes with the weight example.
I also tried a more complex exampe with time varying covariates (temperatures) following the example "plotting environmental covariate relationships" in this forum
http://www.phidot.org/forum/viewtopic.php?f=21&t=3044&p=9773&hilit=time+varying+covariates#p9773But I always end up with a staight line and CIs and estimates that are all the same for each covariate value, no matter what I do.
Here is my very short and easy example. I would be glad if someone could tell me what's wrong.
- Code: Select all
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))
All values are the same. So its no surprise that I have a straight line
- Code: Select all
> 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
- Code: Select all
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)
or if I follow the dipper rain example:
- Code: Select all
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)
})
all estimates are the same.
- Code: Select all
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
I have no idea why
even it there's no effect, the estimates shouldn't be all the same for each value?!
Tank you
best
Bianca