3
$\begingroup$

I have run this binomial GLMM:

m17 <- glmer(Attendance ~ Day + Sex + (1|AgeClass) + (1|Year) + (1|Plastic), data = test2, family = binomial(link = "logit"))

This is the summary output of the model:

Generalized linear mixed model fit by maximum likelihood (Laplace  Approximation)
 [glmerMod]
 Family: binomial  ( logit )
Formula: Attendance ~ Day + Sex + (1 | AgeClass) + (1 | Year) + (1 | Plastic)
   Data: test2

     AIC      BIC   logLik deviance df.resid 
 16138.4  16182.7  -8063.2  16126.4    11868 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.5394 -0.9688 -0.5740  0.9656  1.8762 

Random effects:
 Groups   Name        Variance  Std.Dev.
 Plastic  (Intercept) 0.1374817 0.3708  
 Year     (Intercept) 0.0531973 0.2306  
 AgeClass (Intercept) 0.0009734 0.0312  
Number of obs: 11874, groups:  Plastic, 237; Year, 4; AgeClass, 3

Fixed effects:
             Estimate Std. Error z value Pr(>|z|)    
(Intercept)  0.135928   0.137669   0.987  0.32347    
Day         -0.005972   0.002061  -2.897  0.00377 ** 
SexFemales  -0.248756   0.063937  -3.891    1e-04 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
           (Intr) Day   
Day        -0.378       
SexFemales -0.240  0.004

As evidenced by the p-values, both Day and Sex have a significant effect on attendance. However, when I use plot_model to graph it, I get this result:

enter image description here

As you can see, the error bars are nearly overlapping, or overlapping, the predicted probability values for each sex. I haven't had this issue before with other graphs I've made with plot_model, so I'm confused as to why I'm getting these contradictory results. Does it have to do with the conversion of log-odds beta coefficients to predicted probability values? Or, is there something wrong with my code below?

plot_model(m17, type = "pred" ,
                    terms = c("Day [all]", "Sex"), 
                    colors = c("blue", "red"), 
                    ci.lvl = .95,
                    legend.title = NA,
                    line.size = 1,
                    show.legend = FALSE) +
  labs(x = "Days Relative to Clutch Initiation", y = "P(Attend at night)", title = NULL) +
  scale_x_continuous(expand = c(0, 0), breaks = breaks, labels = labels) + 
  scale_y_continuous(limit = c(0, 1), expand = c(0, 0)) + 
  theme_classic() + 
  guides(fill=guide_legend(nrow=2,byrow=TRUE)) +
  theme(axis.text=element_text(size=22, color = "black", family = "serif"), 
        axis.title=element_text(size=22, color = "black", family = "serif"), 
        axis.title.x = element_text(vjust=-0.5),
        axis.title.y = element_text(vjust=2.5),
        axis.ticks.length=unit(0.1,"inch"), 
        legend.key.size = unit(1, 'cm'), 
        legend.position = c(0.15, 0.92),
        legend.text = element_text(colour="black", size=20, family = "serif"),
        plot.margin = margin(1,.5,1,1, "cm"))

All help is appreciated, and please let me know if there is another place I should post this question!

$\endgroup$
4
  • $\begingroup$ Non-overlap of 95% confidence intervals (CI) is much more stringent than is required for $p<0.05$. This answer shows that non-overlap of 95% CI is approximately equivalent to $p<0.005$ instead, in a t-test. $\endgroup$
    – EdM
    Commented Nov 16, 2023 at 16:32
  • $\begingroup$ @EdM By non-overlap of 95% CIs, you do mean the overlapping of the CIs themselves, or the overlapping of one CI with the predicted values of another group? Specifically, I am concerned that the 95% CI for "Males" is overlapping the predicted values for "Females" in the graph above, not just the 95% CI for "Females". I was also under the assumption that CIs were inherently related to p-values: is this not the case, or is it just different for binomial data? $\endgroup$ Commented Nov 16, 2023 at 17:59
  • $\begingroup$ I mean the overlap of the CIs themselves. As the answer that I linked points out, there is certainly an association between p-values and CI, but it's not as simple as you might think at first, in any type of regression. From your plot it's not clear that the CI for one sex are systematically overlapping the point estimates of the other sex. Also, this type of display sometimes involves a multiple-comparisons correction to take into account the number of days for which you are making estimates. That would lead to wider CI. $\endgroup$
    – EdM
    Commented Nov 16, 2023 at 18:10
  • $\begingroup$ So is this type of graph just not useful then? I know the predicted values are accurate because I have manually calculated them using the coefficients from the model, but when interpreting the model itself, should I feel confident in justifying a sex effect given the p-value? I guess I'm just confused as to how the CIs could be so close to the predicted values if the p-value is so small for the sex coefficient, and I'm wondering how I should deal with this discrepancy. $\endgroup$ Commented Nov 16, 2023 at 19:03

1 Answer 1

3
$\begingroup$

Interpreting this type of plot takes some care, for a few reasons.

First, the simple relationship between 95% confidence intervals (CI) and $p < 0.05$ only holds for comparisons of the CI against fixed values. Non-overlap of 95% CI for two estimates from a model is much more stringent than $p < 0.05$ as a significance criterion for the difference between the estimates. This answer shows that such non-overlap is approximately equivalent to $p < 0.005$ in the context of a t-test. It's similarly too stringent in any comparison between two statistical estimates.

Second, the 95% CI shown on your plot include the joint error estimates for all of the coefficients involved, not just the error in the SexFemales coefficient. The calculations involve the variance-covariance matrix of all the coefficients involved in the modeled estimates, together with the formula for the variance of a weighted sum of variables.

To get a sense of what's going on, try constructing not only the point estimates but also the 95% CI at Day 11 using only the standard error of the SexFemales coefficient. Work first in the (log-odds) coefficient scale where that coefficient estimate has an asymptotic normal distribution, then transform the CI back to the probability scale. You will probably see that the CI you get are narrower than what's displayed on the graph. The plot involves uncertainties beyond that in the SexFemales coefficient.

Third, in some implementations, this type of plot includes a correction for multiple comparisons based on the number of values of Day that were used for the estimates. That correction will widen the 95% CI. A quick glance at the documentation for plot_model() (from the sjPlot package) suggests that might not be the case here, but you need to check the documentation carefully to know how the software you use handles multiple comparisons.

$\endgroup$

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.