title: R GAM visualisation - Negative Binomial
body: <p>This is a follow on question from my question answered by previously for a generic gaussian GAM model in R. This time I tried running a negative binomial GAM with the same dataset and I have attached the plot below. I am not sure if it is plotting what I want it to, as it is showing both two error intervals instead of how the previous GAM showed just the modelled error interval. [<img src="https://i.stack.imgur.com/2tPcr.png" alt="Negative Binomial GAM plot" />.</p>
  <pre><code>mod_gam3 &lt;-gam(y ~s(ï..x), data=Bird.data, family=nb, method=&quot;REML)
  
  mod_gam3$fitted.values
  result &lt;-data.frame(data = c(mod_gam3$fitted.values, Bird.data$y), 
  Year =rep(1991:2019, times ``= 2), 'source' = c(rep('Modelled', times = 29),
  rep('Observed', times = 29)))
  result$se=c(predict(mod_gam3, se=T)$se, rep(NA,29))
  
  ggplot(result, aes(x=Year, y =data, colour= source, fill=source))+
  geom_point()+
  geom_smooth(aes(ymin=data-1.96*se, ymax=+1.96*se), alpha=0.2)+
  labs(x=&quot;Year&quot;, y =&quot;Bird Island Total Debris Count&quot;)+
  scale_y_continous(limits =c(-200,1000))
  </code></pre>