Combine terms from a regression model into a single row of the table. The
p-value comes from stats::anova() comparing the full model against the
reduced model without the combined terms; the combined row shows no
estimate or confidence interval.
Arguments
- x
(
tbl_regression)
Atbl_regressionobject.- formula_update
(
formula)
Formula update passed tostats::update(). The updated formula constructs the reduced model, which is then passed tostats::anova()to calculate the p-value of the removed terms. See theformula.argument ofstats::update()for the syntax.- label
(
string)
Optional label of the combined row.- ...
Additional arguments passed to
stats::anova(), e.g.test = "LRT".
See also
Other regression tables:
add_glance_table(),
add_global_p(),
add_n_regression,
add_nevent(),
add_significance_stars(),
add_vif(),
glance_fun_s3(),
global_pvalue_fun(),
tbl_regression(),
tbl_uvregression()
Examples
# Example 1 ----------------------------------
# Logistic regression, LRT p-value
glm(response ~ marker + I(marker^2) + grade,
trial[c("response", "marker", "grade")] |> na.omit(), # keep complete cases only!
family = binomial) |>
tbl_regression(label = grade ~ "Grade", exponentiate = TRUE) |>
# collapse non-linear terms to a single row in output using anova
combine_terms(
formula_update = . ~ . - marker - I(marker^2),
label = "Marker (non-linear terms)",
test = "LRT"
)