Skip to contents

Performs multivariable regression with multiple exposures on a binary, count, or continuous outcome, stratified by a specified variable. NA values in the stratifier are excluded from analysis.

Usage

stratified_multi_reg(data, outcome, exposures, stratifier, approach = "logit")

Arguments

data

A data frame containing the variables.

outcome

name of the outcome variable.

exposures

vector specifying the predictor (exposure) variables.

stratifier

A character string specifying the stratifying variable.

approach

Modeling approach to use. One of: `"logit"` (Adjusted Odds Ratios), `"log-binomial"` (Adjusted Risk Ratios), `"poisson"` (Adjusted IRRs), `"robpoisson"` (Adjusted RRs), or `"linear"` (Beta coefficients), `"negbin"` (Adjusted IRRs).

Value

An object of class `stratified_multi_reg`, which includes: - `table`: A `gtsummary::tbl_stack` object of regression tables by stratum, - `models`: A named list of model objects for each stratum, - `model_summaries`: A list of tidy model summaries, - `reg_check`: Diagnostics results (if available for the model type).

Accessors

$table

Stacked table of stratified regression outputs.

$models

Named list of fitted models per stratum.

$model_summaries

Tidy summaries for each model.

$reg_check

Regression diagnostic checks (when applicable).

See also

[multi_reg()], [stratified_uni_reg()], [plot_reg()]

Examples

if (requireNamespace("mlbench", quietly = TRUE) &&
  requireNamespace("dplyr", quietly = TRUE)) {
  data(PimaIndiansDiabetes2, package = "mlbench")
  pima <- dplyr::mutate(
    PimaIndiansDiabetes2,
    diabetes = ifelse(diabetes == "pos", 1, 0),
    glucose_cat = dplyr::case_when(
      glucose < 140 ~ "Normal",
      glucose >= 140 ~ "High"
    )
  )
  stratified_multi <- stratified_multi_reg(
    data = pima,
    outcome = "diabetes",
    exposures = c("age", "mass"),
    stratifier = "glucose_cat",
    approach = "logit"
  )
  stratified_multi$table
}
#> Running stratified multivariable regression by: glucose_cat
#>   > Stratum: glucose_cat = High
#>   > Stratum: glucose_cat = Normal
Characteristic
glucose_cat = High
glucose_cat = Normal
Adjusted OR 95% CI p-value Adjusted OR 95% CI p-value
age 1.02 1.00, 1.05 0.12 1.04 1.02, 1.06 <0.001
mass 1.07 1.02, 1.13 0.005 1.10 1.07, 1.14 <0.001
Abbreviations: CI = Confidence Interval, OR = Odds Ratio
glucose_cat = High: N = 197 complete cases included per stratum
glucose_cat = Normal: N = 555 complete cases included per stratum