The function combines terms from a regression model, and replaces the terms
with a single row in the output table. The p-value is calculated using
stats::anova()
.
Arguments
- x
(
tbl_regression
)
Atbl_regression
object- formula_update
(
formula
)
formula update passed to thestats::update()
. This updated formula is used to construct a reduced model, and is subsequently passed tostats::anova()
to calculate the p-value for the group of removed terms. See thestats::update()
function'sformula.=
argument for proper syntax.- label
(
string
)
Optional string argument labeling the combined rows- quiet
- ...
Additional arguments passed to stats::anova
Examples
# Example 1 ----------------------------------
# Logistic Regression Example, 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"
)
Characteristic
OR
95% CI
p-value
Abbreviations: CI = Confidence Interval, OR = Odds Ratio