Skip to contents

Prepare and describe data

Import data, check variables before modelling, and build baseline tables.

import_data()
Import an analysis dataset
dissect()
Dissect a dataset before regression
descriptive_table()
Descriptive summary table

Regression tables

Crude and adjusted estimates for binary, count and continuous outcomes.

uni_reg()
Univariable regression
multi_reg()
Multivariable regression

Special study designs

Matched case-control, clustered, ordered and unordered outcomes.

conditional_logit_reg()
Conditional logistic regression for matched case-control studies
multilevel_reg()
Random-intercept multilevel regression
ordinal_reg()
Proportional-odds ordinal logistic regression
multinomial_reg()
Multinomial logistic regression

Absolute effects

Absolute risks, risk difference and NNTB/NNTH for two-group comparisons.

risk_difference()
Risk difference between two groups

Stratified analysis

The same model repeated within each level of a stratifier.

stratified_uni_reg()
Stratified univariable regression
stratified_multi_reg()
Stratified multivariable regression

Survival: describe and compare

Kaplan-Meier and cumulative incidence curves, summaries and tests.

km_plot()
Kaplan-Meier survival plot
km_risk_table()
Kaplan-Meier risk table
survival_summary()
Kaplan-Meier survival summary table
survival_quantiles()
Kaplan-Meier survival quantile table
survival_prob()
Kaplan-Meier survival probability table
rmst_table()
Restricted mean survival time table
logrank_test()
Log-rank test for Kaplan-Meier survival curves
cuminc_plot()
Cumulative incidence plot for competing risks

Survival: models

Cox, parametric and competing-risk regression, with checks and predictions.

cox_reg()
Cox proportional hazards regression
surv_reg()
Parametric survival regression
competing_risk_reg()
Fine-Gray competing-risk regression
check_ph()
Check proportional hazards assumption for Cox models
plot(<gtregression_ph>)
Plot proportional hazards diagnostics
plot_cox_survival()
Plot adjusted survival curves from a Cox model
surv_model_compare()
Compare parametric survival model distributions
plot_surv_fit()
Plot observed and fitted parametric survival curves
surv_predict()
Predict survival probabilities from a parametric survival model

Plots and forest plots

Visualise estimates from one or two regression results.

plot_reg()
Plot regression estimates
plot_reg_combine()
Plot crude and adjusted estimates side by side
forest_df()
Build a compatible data frame for forest plots
forest_reg()
Draw a forest table from regression outputs

Diagnostics and model choice

Convergence, collinearity, fit, and comparison of candidate models.

check_convergence()
Check regression model convergence
check_collinearity()
Check collinearity using VIF for fitted models
plot_model_fit()
Plot model-fit diagnostics
compare_models()
Compare prespecified regression models
select_models()
Stepwise model selection with fit metrics

Confounding, interaction and mediation

Support causal interpretation of an exposure-outcome association.

identify_confounder()
Identify confounders and effect modifiers
interaction_models()
Compare models with and without an interaction term
mediation_analysis()
Causal mediation analysis
plot_mediation()
Plot mediation paths

Customise, merge and export

Relabel tables, combine them, and save tables, plots and Word reports.

modify_table()
Modify table labels, headers, captions and notes
merge_tables()
Merge two or more tables side by side
save_table()
Save a single regression or summary table
save_docx()
Save multiple tables and plots to a Word document
save_plot()
Save a single plot
save_forest()
Save a forest_reg() output

Graphical interface

Run the same analyses from menus.

gtregression_app()
Launch the gtregression app
gtregression_addin()
Launch the gtregression app from the RStudio Addins menu

Working with results

Inspect and print the objects returned by gtregression functions.

`$`(<gtregression>)
Access fields on gtregression objects with `$`
print(<gtregression>)
Print gtregression objects

Example datasets

Datasets used in the examples and guides.

data_birthwt
Birth Weight Data
data_SynthDiabetes
Synthetic Diabetes Dataset
data_gt_quin
Student Absenteeism in Rural Schools
data_epilepsy
Epilepsy Treatment and Seizure Counts
data_endometrial
Endometrial Cancer Histology Grade Data
data_diabetes_mediation
Diabetes Mediation Teaching Dataset
data_competing_risk
Synthetic Competing-Risk Oncology Dataset
data_infertility
Infertility Matched Case-Control Study
data_lungcancer
Lung Cancer Trial Data