I have a generalized linear model (family - gamma) with interaction, and need to plot it specifically in ggplot2 (on a response scale). The model was constructed with following code:
fit1mult = glm(SIZE_OOCYTE ~ TREATMENT * CASTE,
family = Gamma(link = "log"), data=data1)
I made a plot using the lattice
package, and it looks like this:
How can I make a similar one in
ggplot
? I know that the geom_smooth
has an option glm
, but don't know how to apply it.
Thanks in advance for suggestions!
UPD. Solution:
library(ggeffects)
mydf1 <- ggpredict(fit1mult, terms = c("CASTE", "TREATMENT"))
plot(mydf1)
Result: new plot