This function uses car::Anova(type = "III") to calculate global p-values variables. Output from tbl_regression and tbl_uvregression objects supported.

add_global_p(x, ...)

# S3 method for tbl_regression
add_global_p(
  x,
  include = everything(),
  type = NULL,
  keep = FALSE,
  quiet = NULL,
  ...,
  terms = NULL
)

# S3 method for tbl_uvregression
add_global_p(
  x,
  type = NULL,
  include = everything(),
  keep = FALSE,
  quiet = NULL,
  ...
)

Arguments

x

Object with class tbl_regression from the tbl_regression function

...

Additional arguments to be passed to car::Anova

include

Variables to calculate global p-value for. Input may be a vector of quoted or unquoted variable names. Default is everything()

type

Type argument passed to car::Anova. Default is "III"

keep

Logical argument indicating whether to also retain the individual p-values in the table output for each level of the categorical variable. Default is FALSE

quiet

Logical indicating whether to print messages in console. Default is FALSE

terms

DEPRECATED. Use include= argument instead.

Example Output

Example 1

Example 2

See also

Author

Daniel D. Sjoberg

Examples

# Example 1 ---------------------------------- tbl_lm_global_ex1 <- lm(marker ~ age + grade, trial) %>% tbl_regression() %>% add_global_p()
#> add_global_p: Global p-values for variable(s) `add_global_p(include = c("age", #> "grade"))` were calculated with #> `car::Anova(x$model_obj, type = "III")`
# Example 2 ---------------------------------- tbl_uv_global_ex2 <- trial[c("response", "trt", "age", "grade")] %>% tbl_uvregression( method = glm, y = response, method.args = list(family = binomial), exponentiate = TRUE ) %>% add_global_p()
#> add_global_p: Global p-values for variable(s) `add_global_p(include = c("trt", #> "age", "grade"))` were calculated with #> `car::Anova(mod = x$model_obj, type = "III")`