0

I ran a quasipoisson regression using the following code:

plot(ori_brk ~ year_imd,pch=16,col="darkgreen",cex.lab=1.2,cex.axis=1.2,xlab="Year",ylab="No. of    break days",ylim=c(0,30),cex=1.2)

and inserted a trend line using the following code:

xv<-seq(1951,2007,1)
yv<-predict(ori_brk_qpmdl,list(Distance=xv))
lines(xv,exp(yv),col="darkgreen",lwd=2)

Now I need to insert 95% confidence interval around the trend line.

I am aware that I can use ggplot2 using the following code:

ggplot(ori,aes(x=year,y=brk))+ylim(0,35)+stat_smooth(method='glm',family='quasipoisson',lty="dotted") +geom_point()+theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
panel.background = element_blank(), axis.line = element_line(colour = "black"))

But I am specifically looking to do it using the plot function in R

Thanks

user53020
  • 889
  • 2
  • 10
  • 33
  • I think [this answer](http://stackoverflow.com/questions/14069629/plotting-confidence-intervals) will help – keegan Nov 11 '14 at 12:48
  • 1
    What is `class(ori_brk_qpmdl)`? Does it's `predict()` function generate the confidence intervals for you? Do you just not know how to plot them or do you not know how to calculate them? It would be easier to help if you supplied a minimal [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – MrFlick Nov 11 '14 at 16:16

0 Answers0