Can you share your data (dput())? Cheers, Roman On Mon, Nov 23, 2015 at 11:58 PM, Lotte van Boheemen <
lotte.van.boheemen at monash.edu> wrote:
Hi,
My goal is to plot the predicted values of the mcmcglmm model with
variables: NoFeeds ~ offset(ObsDuration) + Month + AnnualInsects +
TQc_Combined + NoOffspring + NoH*Status + Status*WatchType ,
random=~idh(Status):BirdID + NestID:NestWatchID + Obs
Predicted values are calculated as:
mpred0 <- predict(model,interval="confidence")
colnames(mpred0) <- paste("mpred0",c("fit","lwr","upr"),sep=".")
mpred1 <- predict(model,interval="confidence",marginal=~ BirdID + MateID +
NestID:NestWatchID + Year:Month + Obs)
colnames(mpred1) <- paste("mpred1",c("fit","lwr","upr"),sep=".")
dataf <- data.frame(data_UnID,mpred0,mpred1)
g0 <- ggplot(dataf,aes(x=NoH,y=FeedsPerHour))+
stat_sum(aes(size=factor(..n..)),alpha=0.5)+
facet_grid(~Status+WatchType)+
scale_size_discrete(name="n",range=c(2,5))
g0 + geom_line(aes(x=as.numeric(NoH),y=mpred0.fit),colour="red")+
geom_ribbon(aes(x=as.numeric(NoH),y=mpred0.fit,
ymin=mpred0.lwr,ymax=mpred0.upr),fill="red",
alpha=0.3)
However, the plots this results in show 'jagged' predictions for the model,
e.g. it seems like at one particular value of NoH, the model predicts 2
different values, which is not the case (figure attached).
Lotte Anna van Boheemen
PhD Research Candidate
School of Biological Sciences
Monash University
-
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
In God we trust, all others bring data. [[alternative HTML version deleted]]