Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

add_global_p

Add the global p-values


Description

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

Usage

add_global_p(x, ...)

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

## S3 method for class '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

Author(s)

Daniel D. Sjoberg

See Also

Examples

# Example 1 ----------------------------------
if (requireNamespace("car")) {
  tbl_lm_global_ex1 <-
    lm(marker ~ age + grade, trial) %>%
    tbl_regression() %>%
    add_global_p()
}

# Example 2 ----------------------------------
if (requireNamespace("car")) {
  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()
}

gtsummary

Presentation-Ready Data Summary and Analytic Result Tables

v1.4.0
MIT + file LICENSE
Authors
Daniel D. Sjoberg [aut, cre] (<https://orcid.org/0000-0003-0862-2018>), Michael Curry [aut] (<https://orcid.org/0000-0002-0261-4044>), Margie Hannum [aut] (<https://orcid.org/0000-0002-2953-0449>), Joseph Larmarange [aut] (<https://orcid.org/0000-0001-7097-700X>), Karissa Whiting [aut] (<https://orcid.org/0000-0002-4683-1868>), Emily C. Zabor [aut] (<https://orcid.org/0000-0002-1402-4498>), Esther Drill [ctb] (<https://orcid.org/0000-0002-3315-4538>), Jessica Flynn [ctb] (<https://orcid.org/0000-0001-8310-6684>), Jessica Lavery [ctb] (<https://orcid.org/0000-0002-2746-5647>), Stephanie Lobaugh [ctb], Gustavo Zapata Wainberg [ctb] (<https://orcid.org/0000-0002-2524-3637>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.