Building Regression Table

Author

Jeremy Selva

Learning Goals

  • Create clinical summary logistics regression table using tbl_regression.
  • Display number of patients and positive events that enter the model in the regression table using add_n and add_nevent.
  • Merge tables by columns using tbl_merge and by rows using tbl_stack.

In this section, we try to create a regression table using some helpful functions from gtsummary

We start by choosing the relevant columns to make the regression table, keeping rows with a birth outcome (Non-live birth and Live birth).

Birth Weight Regression Table

Data Required

Here is the dataset required. To recall, we set

  • Birthweight_2500_regression be
    • NA if Birthweight is NA.
    • 1 if Birthweight is less than 2500.
    • 0 otherwise.

Create Regression Results

We create a univariable logistic regression model using just the Group column and the outcome Birthweight_2500_regression.

We can display the regression results using the tbl_regression. Setting exponentiate = TRUE will convert the predictors’ raw coefficient into odds ratio.

In addition, we can display the number of patients that enters the model using add_n.

add_nevent provides the number of events (Number of patients with Birthweight_2500_regression equal to 1 or have a live birth weight of less than 2500g).

We create a multivariable logistic regression model using additional columns (Group, Age, Education, Hypertension, Diabetes) and the outcome Birthweight_2500_regression.

We display the regression results using the same three functions.

Pregnancy Duration Regression Table

Data Required

Here is the dataset required. To recall, we set

  • Preg_duration_37_regression be
    • 1 if GA.at.outcome.weeks is less than 37.
    • 0 otherwise.

Create Regression Results

We create a univariable logistic regression model using just the Group column and the outcome Preg_duration_37_regression.

We create a multivariable logistic regression model using additional columns (Group, Age, Education, Hypertension, Diabetes) and the outcome Preg_duration_37_regression.

Combine

We can combine the birth weight and pregnancy duration regression table by column using the tbl_merge

Finally, we can combine the univariable and multivariable regression results table using the gtsummary::tbl_stack.