rintervalsglmmtmb

ggpredict : confidence interval for negative binomial models


I used the following code to model count data :

ModActi<-glmmTMB(Median ~ H_veg + D_veg + Landscape + JulianDay + 
    H_veg:D_veg + (1 | Site), 
    data=MyDataActi, family=nbinom2)

I then used the ggpredict function of the ggeffects package to plot the predicted values of my model for the categorical variable "Landscape":

pr1 <- ggpredict(ModActi, "Landscape")
plot(pr1)

I obtain this Graph.

As you can see, lower confidence intervals are negative, as if the function would calculate them for a normal distribution.

In the help menu of ggpredict, it is not clear to me if there is a way to calculate confidence intervals for a negative binomial distribution (as stated in the model)?

If I use glmer in poisson, the confidence intervals are correct.


Solution

  • This was because glmmTMB only returned predictions on the response scale and these were not back transformed. Now glmmTMB was update on CRAN and I also revised ggeffects. You can try out the current dev-version at https://github.com/strengejacke/ggeffects, which now properly computes the CI (after updating glmmTMB to version 0.2.1).