I'm being confused about how to interpret my logistic regression and I would appreciate some input on the matter. I work with R's glm.

I have one binary response (emerged/not emerged), and two predictors, one continuous (treatment time) and one binary (group, 0 or 1). My n=20 per group per treatment.

My data looks like this (I've calculated the % emergence for each treatment):

GRP 0___________0____0____0____0___59___70___97___100
GRP 1__________50___21___51___79___87___97___100__100

My question is "Does group 1 emerge faster than group 0"?

I have built a model with an interaction for time*group, here is R's output where sp = group and trait = time treatment.

glm(formula = hatch ~ sp * trait, family = binomial(link = "logit"), 
    data = logecl2)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.7110  -0.3975   0.1659   0.5032   1.6355  

            Estimate Std. Error z value Pr(>|z|)    
(Intercept) -66.0207     8.3820  -7.876 3.37e-15 ***
sp1          43.7401     8.8134   4.963 6.94e-07 ***
trait         2.0491     0.2602   7.877 3.36e-15 ***
sp1:trait    -1.2903     0.2755  -4.683 2.82e-06 ***
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 822.09  on 610  degrees of freedom
Residual deviance: 399.09  on 607  degrees of freedom
AIC: 407.09

Number of Fisher Scoring iterations: 7 

 (Intercept)          sp1        trait    sp1:trait 
2.126048e-29 9.910386e+18 7.760981e+00 2.751994e-01 

Apparently the interaction is statisticaly significant. At first glance, it's obvious that group 1 emerges faster than group 0, but I'm not sure how my model supports this observation, or how to interpret it correctly.

Can someone help me interpret the results?

Every replicate is unique: I take 20 eggs of each group for treament 28h, check their status, then dissect them. I repeat the process for every development time (treatment). Here is the structure of the data :

   id sp trait line hatch  
1   1  0    28   A5     0  
2   2  0    28   A5     0  
3 363  1    28   A5     1  
4 364  1    28   A5     0  
5 365  1    28   A5     1  
6 366  1    28   A5     1  

sp = group : 1 for test; 0 for control
trait = time treatment, from 28 to 35 (h)
Line = is irrelevant
Hatch = emerged (1) or not (0)

  • 1
    $\begingroup$ Could you clarify the structure of the data? You say that you have a binary outcome, but you're asking a question about how fast each group emerges. If the outcome really is binary, you can't answer that question. The best you can do is say if one group is more likely to emerge than the other. I suspect from your description that you're applying a treatment, and then checking at set intervals if each subject has emerged or not. $\endgroup$
    – KMcC
    Commented Jul 6, 2017 at 18:34
  • 1
    $\begingroup$ Yes, I have two sets of individuals, one control with no special intervention, and one test group with an intervention. I then check my eggs to see if they have hatched (emerged / not emerged response) for each treatment time (28 to 35 hours, each hour). I want to know if the test group emerges faster, but I guess saying "has more probabilities to emerge" would mean the same. If you look at the % data in the first message, you see that the test group emerges from 28 to 34h, while the control emerges from 32 to 35. I also have a couple zero cells in the control. $\endgroup$ Commented Jul 6, 2017 at 19:39
  • $\begingroup$ But how exactly is you table? Is it possible for you to edit the question showing head(logecl2) so we can check it out? $\endgroup$ Commented Jul 6, 2017 at 19:42
  • $\begingroup$ also, what are the contrasts for the response variable? $\endgroup$ Commented Jul 6, 2017 at 19:45
  • $\begingroup$ It sounds as though you have a repeated measures design here. Providing more info about the data structure would help me know for sure, but I am also not sure, based on your description so far, that a glm model is the right analysis given your research question. $\endgroup$ Commented Jul 6, 2017 at 19:45

1 Answer 1


Within the comments I can see you keep saying 'emerged faster/quicker/in a shorter amount of time' but a plain logistic regression, with the variables you've presented us, does not answer this question.

The plain interpretation of a coefficient in a logistic regression is:

a change in one unit of the independent variable will cause beta change in the log-odds of the dependent variable, given the other independent variables fixed.

Now, to interpret log-odds, keep in mind that a log-odds of 5 is equivalent to a probability of y = 1 close to 0.99. (you can see the code for a table showing this right here).

With that in mind, what I can interpret from your glm output is:

  • it is highly unlikely that a emerged result will happen if sp == 0, unless the observation has a trait closer to 35 associated with it.

  • if the observation is of sp == 1, the chance of emerged is higher, and the higher the trait the greater the chance (at lowering rates of importance).

But, a picture is worth a thousand words they say, and to picture this type of relationship, there is something called a counter factual plot, which I've built using the glm output you've provided.

enter image description here

You can sure make it tangible, pretty, and more informative, but I think you get the idea. The code I've used to make this plot is:


cf <- 
    trait = seq(28, 35, 0.1)
) %>% 
    crossing(tibble(sp = c(0, 1))) %>% 
    mutate(pred_log_odds_ratio = -66.0207 + sp*43.7401 + trait*2.0491 + sp*trait*(-1.2903),
           pred_p_emerge = exp(pred_log_odds_ratio)/(1+exp(pred_log_odds_ratio))

cf %>% 
    mutate(sp = as.factor(sp)) %>% 
    ggplot(aes(x = trait, y = pred_p_emerge)) + 
    geom_line(aes(group = sp, color = sp), size = 1)
  • $\begingroup$ Thank you Guilherme for the answer and for taking the time to build this plot, it's very graphic indeed. $\endgroup$ Commented Jul 7, 2017 at 18:54
  • $\begingroup$ The first obvious thing is that the probability curves are pretty much following the calculated % of emergence. The second thing I am wondering about is if the regression a sufficient tool to determine whether the group 1 is significantly different, or in other terms, if it emerges faster. I'm trying to demonstate the fact that my test group has a shorter development time. The model seems to indicate a significant difference between groups. And finally, there is also the interaction that's left unexplained and that has a negative coefficient, what could you say about that? $\endgroup$ Commented Jul 7, 2017 at 19:01
  • 1
    $\begingroup$ in the model there isn't anything that can say it if faster if sp == 1, only that if sp == 1 there will be a higher probability of y == 1 if sp == 1. About the interaction being negative: 1) it only is important when sp == 1 . 2) , as show in the plot, it only means that the the probability grows as trait increases, but at decreasing reates, as in it flattens, or higher trait values contribute less and less to the probability of y == 1. $\endgroup$ Commented Jul 7, 2017 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.