Here is the code I used:
data<-read.table("YB.txt",header=T)
attach(data)
fit2<-glm(cbind(success,fail)~time*col,data=data,family=binomial)
summary(fit2)
predict.data<-as.data.frame(predict(fit2,newdata=temp.data,type="link",se=TRUE))
new.data<-cbind(temp.data,predict.data)
std<-qnorm(0.95/2+0.5)
new.data$ymin<-fit2$family$linkinv(new.data$fit-std*new.data$se)
new.data$ymax<-fit2$family$linkinv(new.data$fit+std*new.data$se)
new.data$fit<-fit2$family$linkinv(new.data$fit)
op<-cbind(success/(Neggs))
p<-ggplot(data,aes(x=time,y=op,fill=col,color=col))+geom_point()
p+geom_ribbon(data=new.data,aes(y=fit,ymin=ymin,ymax=ymax),alpha=0.1,linetype="dashed")+geom_line(data=new.data,aes(y=fit),linetype="solid")+labs(x="patatou",y="patata",title="patati")+theme_calc()+scale_color_manual(values=c("#CC6666", "#9999CC"))+labs(colour="Eggs color",linetype="Eggs color",shapes="Eggs color")
=> I got two beautiful prediction curves. However, my collected data start at 5 days and end at 13 days. I would like to have the curve for 0-5 days and after 13 days (i.e: to 20 days). In order to have a prediction of what I should get. So I tried this:
NewData<-as.matrix(cbind(time,col))
colnames<-(NewData)
colnames(NewData)<-c("time","col")
predict(fit2,NewData,se.fit=TRUE,scale=NULL,df=Inf,interval=c("none","confidence","prediction"),level=0.95)
Didn't work... Somebody have an idea to solve this?