Insert confidence interval in a quasi-poisson regression plot

977 views Asked by At

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

0

There are 0 answers