I am trying to plot interaction effects in R for a negative binomial regression model (glm.nb). The dependent variable meetings is numeric. Variable EU is dichotomous and variable "type" is categorical 1/2/3.
glmnbmodel <- glm.nb(meetings ~ EU + type + EU*type, data = data)
I tried plotting using this command: interplot(m = glm.nb, var1 = "meetings", var2 = "type")
Which gives this error:
> interplot(m = glmnbmodel, var1 = "EU", var2 = "type")
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘sim’ for signature ‘"negbin"’
I tried the same with a glm model instead, wherein R does not recognize the interaction in the model:
> glmmodel <- glm(meetings ~ EU + type + EU*type, data = data)
> interplot(m = glmmodel, var1 = "EU", var2 = "type")
Error in interplot.default(m = glmmodel, var1 = "EU", var2 = "type") :
Model does not include the interaction of EU and type .
What am I doing wrong?
- How can I plot interaction effects in negative binomial regression models otherwise?
- Why doesn't R find the interaction in the models?
I have been stuck on this for quite some time, so any help is most appreciated!