This function uses car::Anova() (by default) to calculate global p-values
for model covariates.
Output from tbl_regression and tbl_uvregression objects supported.
add_global_p(x, ...)
# S3 method for class 'tbl_regression'
add_global_p(
x,
include = everything(),
keep = FALSE,
anova_fun = global_pvalue_fun,
type = "III",
quiet,
...
)
# S3 method for class 'tbl_uvregression'
add_global_p(
x,
include = everything(),
keep = FALSE,
anova_fun = global_pvalue_fun,
type = "III",
quiet,
...
)(tbl_regression, tbl_uvregression)
Object with class 'tbl_regression' or 'tbl_uvregression'
Additional arguments to be passed to car::Anova,
aod::wald.test() or anova_fun (if specified)
(tidy-select)
Variables to calculate global p-value for. Default is everything()
(scalar logical)
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.
(function)
Function used to calculate global p-values.
Default is generic global_pvalue_fun(), which wraps car::Anova() for
most models. The type argument is passed to this function. See help file for details.
To pass a custom function, it must accept as its first argument is a model.
Note that anything passed in ... will be passed to this function.
The function must return an object of class 'cards' (see cardx::ard_car_anova() as an example),
or a tibble with columns 'term' and 'p.value' (e.g. \(x, type, ...) car::Anova(x, type, ...) |> broom::tidy()).
Type argument passed to anova_fun. Default is "III"
# Example 1 ----------------------------------
lm(marker ~ age + grade, trial) |>
tbl_regression() |>
add_global_p()
Characteristic
Beta
95% CI
p-value
Abbreviation: CI = Confidence Interval
# Example 2 ----------------------------------
trial[c("response", "age", "trt", "grade")] |>
tbl_uvregression(
method = glm,
y = response,
method.args = list(family = binomial),
exponentiate = TRUE
) |>
add_global_p()
Characteristic
N
OR
95% CI
p-value
Abbreviations: CI = Confidence Interval, OR = Odds Ratio