Search code examples
rconfidence-intervalgtsummary

Problem with 95% CI output - gtsummary package in R


From time to time, I've found the 95% CI outputs like so (see image below) using the gtsummary package. Sometimes I've noticed it is because it doesn't like a colon, space or apostrophe in the variable name or because there are NA's in the factor levels. When I've changed the names, the CI is fixed. However this time it does not seem to be the case. Any ideas what might be the cause of this output?

Thank you

fit3 <- glmer(cclintr ~ SEX + Rg + agroup + death +
              psource_group + region + BMI + HOSPVENT + 
              PATMANICU + fibandflutter + MEDHISTO_03 + 
              MEDHISTO_35 + Cerebrovasc_group
              smo_vape + DOCUSYMP_12 + admonth + (1|FACILITY_DISPLAY_ID),
             data= filthosp,
             family = binomial,
             nAGQ = 1, 
             control=glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=2e5)))

#Summary into table 
library(gtsummary)
f2model_tab <- fit3 %>%
  tbl_regression(exponentiate = TRUE ) %>%
  bold_labels() %>%
  bold_p(t= 0.05) 

Output

enter image description here


Solution

  • From what we see here, gtsummary is reporting what it should. The issue is that the confidence bounds are HUGE for the BM level of the admonth variable. The coef is -13.8 with standard error 74. If we were to calculate the upper confidence bound ourselves it would be:

    -13.8 + 1.96 * 74 = 131.24
    

    Then we're exponentiating to get the odds ratio:

    exp(131.24) = 9.92e+56    !!
    

    The tbl_regression() function by default formats and rounds the bounds with the style_ratio() function, which does not use scientific notation (hence printing the HUGE number). You can use the tbl_regression(estimate_fun=) argument to pass another function to round the estimates that uses scientific notation, so the print is not wild looking.

    Other than that, I would suggest playing with your model a bit to see if you can get more reasonable estimates.

    Happy Programming!