0

I have built a model using the gls function of the nlme and I have plot the the model with ggplot. Here an example of the data and the code:

df
t   count
4   4051
5   2028
6   4.58
7   7.87
8   11.2
9   8950
20  2938
29  4.89
31  23292
44  10.18
46  17908
61  8761
62  33292
63  7501

m1<-gls(count~t, data=df)
fit<-fitted(m1)
ggplot(df, aes(x=t, y=count))+
  geom_point(size =3)+geom_line(aes(as.vector(t), y=as.vector(fit)), color = "red", linewidth=1)

In the same plot I would like to add the confidence interval of the model. I have tried different methods but I am not understanding how to do that. Any help please? Thank you!

Franc
  • 15
  • 6

0 Answers0