0
votes

I'm using the lme4 package in R to fit a negative binomial model that I'd like to use in mediation (it fits better than Poisson).

I get an error: "glmer family for the outcome model not supported"

To be slick, I simply switched the class to lmer; e.g., from

> class(model.Y)
[1] "glmerMod"
attr(,"package")
[1] "lme4"

to

> class(model.Ynew)
[1] "lmerMod"
attr(,"package")
[1] "lme4"

and it works. Obviously, this might create issues but I checked the residuals, fitted, and predicted values and there's no change. The results also agree with the Poisson model results.

> summary(residuals(model.Y)-residuals(model.Ynew))
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0       0       0       0       0       0 
> summary(fitted(model.Y)-fitted(model.Ynew))
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0       0       0       0       0       0 
> summary(predict(model.Y)-predict(model.Ynew))
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0       0       0       0       0       0  

Does anyone have insight into the effects of this or a possible way forward that isn't so ad hoc?

1

1 Answers

0
votes

I would be interested if you explored mediation with negative binomial regression analysis further, and possibly what you learned