Artur Guerra
Artur Guerra

Reputation: 85

Equation from interaction in a logistic regression (GLM)

I have the following glm regression:

fitglm= glm(Resp ~ Doses*Seasons, data=DataJenipa,family=binomial(link = 
"probit"))

That gives that summary:

Call:
glm(formula = Resp ~ Doses * Seasons, family = binomial(link = "probit"), 
    data = DataJenipa)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.6511  -0.4289  -0.3035  -0.3035   2.6079  

Coefficients:
               Estimate Std. Error z value Pr(>|z|)  
(Intercept)    -0.63423    0.26604  -2.384   0.0171 *
Doses          -0.23989    0.09339  -2.569   0.0102 *
Seasons2       -1.06117    0.44979  -2.359   0.0183 *
Doses:Seasons2  0.23989    0.14380   1.668   0.0953 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 208.05  on 399  degrees of freedom
Residual deviance: 195.71  on 396  degrees of freedom
AIC: 203.71

To visualize my model, I'm using interact_plot (from jtools package)

interact_plot(fitglm, pred = Doses, modx = Seasons, plot.points = T, point.shape = T,interval = F,modx.labels = c("Summer", "Winter"), line.thickness = 1.5) 

and I get the following:

graphic

How do I get my two math equations from the two lines above? (like: Summer(Y) = -0.63423 -0.23989x ... and goes on)

I know my example is wrong, but how do I get these two equations from the graphic??

Upvotes: 0

Views: 206

Answers (1)

Artur Guerra
Artur Guerra

Reputation: 85

Already found a way! I simply need to run two different glm regressions, each one with only one season (without the interaction Doses*Season). Doing that I'll have each line and their coefficients to make my equation!

So:

fitglmSummer <- glm(Resp ~ Doses, data=DataSummer,family=binomial(link = "probit"))
fitglmWinter <- glm(Resp ~ Doses, data=DataWinter,family=binomial(link = "probit"))

Thanks!

Upvotes: 1

Related Questions