Building Regression Table
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_nandadd_nevent. - Merge tables by columns using
tbl_mergeand by rows usingtbl_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_regressionbeNAifBirthweightisNA.1ifBirthweightis less than 2500.0otherwise.
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_regressionbe1ifGA.at.outcome.weeksis less than 37.0otherwise.
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.