Likelihood ratio test pvalues in gtsummary

Viewed 137

How do l incorporate likelihood ratio test p values in gtsummary output table?

library(gtsummary)

    trial %>% 
      select(response, grade) %>% 
      tbl_uvregression(
        method = glm,
        y = response,
        method.args = list(family = binomial),
exponentiate = TRUE)
1 Answers

You can use add_global_p(test = "LR") to add the LRT p-value. In the background, the function is using car::Anova(mod = x, type = "III", test = "LR") to calculate the p-value

library(gtsummary)
#> #BlackLivesMatter

tbl <-
  trial %>% 
  select(response, grade) %>% 
  tbl_uvregression(
    method = glm,
    y = response,
    method.args = list(family = binomial)
  ) %>%
  add_global_p(test = "LR")

#> add_global_p: Global p-values for variable(s) `add_global_p(include = "grade")`
#> were calculated with
#>   `car::Anova(mod = x$model_obj, type = "III", test = "LR")`

enter image description here Created on 2021-05-12 by the reprex package (v2.0.0)

Related