multi_reg | R Documentation |
Fits multivariable regression models for binary, count, or continuous outcomes and returns a publication-ready summary table using 'gtsummary'. Depending on the specified 'approach', the function estimates adjusted Odds Ratios (OR), Risk Ratios (RR), Incidence Rate Ratios (IRR), or Beta coefficients.
multi_reg(data, outcome, exposures, approach = "logit")
data |
A data frame containing the analysis variables. |
outcome |
The name of the outcome variable. Must be a character string. |
exposures |
A character vector of predictor variables to include. |
approach |
Modeling approach to use. One of: - '"logit"' for logistic regression (OR), - '"log-binomial"' for log-binomial regression (RR), - '"poisson"' for Poisson regression (IRR), - '"robpoisson"' for robust Poisson regression (RR), - '"linear"' for linear regression (Beta coefficients), - '"negbin"' for negative binomial regression (IRR). |
An object of class 'multi_reg', extending 'gtsummary::tbl_regression'. Additional components can be accessed using:
x$models
: List of fitted model objects.
x$model_summaries
: List of summary outputs.
x$reg_check
: Regression diagnostics (only for linear models).
x$table
: Returns the main regression table.
$models
List of fitted model objects.
$model_summaries
A tibble of tidy regression summaries for each model.
[uni_reg()], [plot_reg()], [plot_reg_combine()]
if (requireNamespace("mlbench", quietly = TRUE)) {
data(PimaIndiansDiabetes2, package = "mlbench")
pima <- dplyr::mutate(PimaIndiansDiabetes2,
diabetes = ifelse(diabetes == "pos", 1, 0))
model <- multi_reg(
data = pima,
outcome = "diabetes",
exposures = c("age", "mass"),
approach = "logit"
)
print(model)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.