Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
The modelsummary package in R is an open-source statistical toolkit designed to create publication-ready regression tables, coefficient plots, and descriptive data summaries. Developed and maintained by Vincent Arel-Bundock, modelsummary provides empirical researchers with a unified, modular framework for presenting statistical models side-by-side. Rather than manually copying point estimates and standard errors from statistical console sessions into word processors—a practice that introduces severe transcription errors and degrades research integrity—modelsummary enables fully automated, reproducible table pipelines. The package natively supports over 100 statistical model types and exports seamlessly across HTML, LaTeX, Microsoft Word, Markdown, Typst, and PDF formats.
What it is used for in research
In empirical scientific research across disciplines such as economics, political science, biostatistics, and psychology, researchers routinely present multiple model specifications side-by-side to demonstrate the stability of treatment effects across covariate sets. Communicating these results according to computational reproducibility standards, such as those highlighted in the Harvard Data Science Review, requires direct programmatic links between data analysis scripts and published tables.
Software documentation and archiving standards like CodeMeta underscore the necessity of capturing exact analytical pipelines. In typical research projects, modelsummary performs several foundational tasks:
- Multi-Model Regression Tables: Presenting baseline regressions, nested covariate controls, fixed-effects models, and instrumental variable estimations in aligned, standardized columns.
- On-the-Fly Variance-Covariance Adjustments: Computing heteroskedasticity-consistent (HC) standard errors, clustered standard errors, or bootstrap intervals directly at table generation time without altering the underlying fitted model objects.
- Descriptive Data Summaries: Generating baseline balance tables (commonly referred to as “Table 1” in clinical and observational research), correlation matrices, and distribution skims using the integrated
datasummaryfamily. - Direct Export to Academic Typesetting Systems: Producing publication-compliant LaTeX code, Word documents, and web-ready HTML tables that integrate into dynamic document workflows such as Quarto and R Markdown.
How to install or access it
The official, peer-reviewed release of modelsummary is distributed through the Comprehensive R Archive Network (CRAN). The package requires an active R installation (version 3.6.0 or higher).
To install the stable release of modelsummary from CRAN along with its default lightweight table rendering engine, tinytable, run the following commands in your R console:
install.packages("modelsummary")
install.packages("tinytable")
If your research requires clustered or robust standard error estimators, install the sandwich package from CRAN:
install.packages("sandwich")
To access the development version containing the latest features and bug fixes directly from the source repository, you can install modelsummary from GitHub or R-universe using pak or remotes:
# Using pak (recommended for development installations)
install.packages("pak")
pak::pak("vincentarelbundock/modelsummary")
In addition to tinytable, modelsummary supports modular rendering backends including gt, kableExtra, flextable, and huxtable, which can be installed independently from CRAN as needed for specific journal formatting guidelines.
Step-by-step task
Follow these numbered steps to fit multiple regression models, apply robust standard errors, customize variable labels, and export a publication-ready comparative table.
Step 1: Load packages and prepare data
Open R or RStudio and load the required libraries. For this demonstration, we use the standard built-in mtcars dataset to examine vehicle fuel efficiency (mpg) as a function of horsepower (hp), weight (wt), and transmission type (am):
library(modelsummary)
library(sandwich)
data(mtcars)
Step 2: Estimate multiple model specifications
Fit a sequence of nested ordinary least squares (OLS) regression models using the lm() function. Storing models in a named R list automatically assigns clear, readable column headers in the resulting table:
m1 <- lm(mpg ~ hp, data = mtcars)
m2 <- lm(mpg ~ hp + wt, data = mtcars)
m3 <- lm(mpg ~ hp + wt + am, data = mtcars)
models <- list(
"Bivariate OLS" = m1,
"Covariate Model" = m2,
"Full Spec" = m3
)
Step 3: Define clean coefficient labels and omit unwanted terms
Raw variable names in statistical software frequently contain technical shorthand that should not appear in final journal manuscripts. Create a named character vector for the coef_map argument to rename variables and establish their vertical display order:
cm <- c(
"hp" = "Gross Horsepower",
"wt" = "Weight (1,000 lbs)",
"am" = "Manual Transmission (0/1)",
"(Intercept)" = "Constant"
)
Step 4: Generate the comparative regression table with robust standard errors
Call the modelsummary() function, passing the list of models, the coefficient map, and a specification for heteroskedasticity-robust standard errors via the vcov parameter:
modelsummary(
models,
vcov = "robust",
coef_map = cm,
stars = c("*" = 0.1, "**" = 0.05, "***" = 0.01),
gof_map = c("nobs", "r.squared", "adj.r.squared", "aic", "bic"),
title = "Regression Models Explaining Fuel Economy"
)
Step 5: Export to Word, LaTeX, or HTML
To save the table directly into an external manuscript file, supply a filename with the appropriate extension to the output argument:
# Export directly to Microsoft Word
modelsummary(models, vcov = "robust", coef_map = cm, output = "table_regression.docx")
# Export directly to LaTeX code
modelsummary(models, vcov = "robust", coef_map = cm, output = "table_regression.tex")
# Export to standalone HTML file
modelsummary(models, vcov = "robust", coef_map = cm, output = "table_regression.html")
When incorporating the resulting LaTeX table into your manuscript, align and format tables using structural techniques detailed in guides like LaTeX table vertical alignment.
Output and how to read it
A standard table produced by modelsummary() is structured into three primary horizontal sections that conform to academic journal standards:
- Header Row: Displays the names assigned to the models in your input list (e.g., “Bivariate OLS”, “Covariate Model”, “Full Spec”). If an unnamed list is supplied, models are numbered sequentially as (1), (2), and (3).
- Parameter Estimates and Uncertainty: For each variable, the point estimate (e.g., OLS slope coefficient β) appears on the top row, followed immediately by its measure of statistical uncertainty enclosed in parentheses on the row below. By default, this measure is the standard error, but it can be configured to display confidence intervals (such as [95% CI]) or t-statistics. Significance stars (*, **, ***) are appended to point estimates based on user-defined p-value thresholds.
- Goodness-of-Fit (GOF) Block: The bottom section reports model-level diagnostic statistics. Key metrics include the number of observations (Num.Obs.), R-squared (R²), Adjusted R-squared, Akaike Information Criterion (AIC), and Bayesian Information Criterion (BIC). Custom rows such as fixed-effects indicators or F-statistics can be injected dynamically.
For graphical presentation, modelsummary provides the companion function modelplot(), which converts the model list into a ggplot2 point-and-whisker plot showing point estimates and 95% confidence intervals across all specifications.
Troubleshooting
Common issues encountered when using modelsummary and their verified solutions include:
- Missing backend error when exporting: If an export command fails with a message indicating that a formatting engine is missing, install the required rendering package for that file format (for example, run
install.packages("tinytable")for LaTeX/HTML orinstall.packages("flextable")for Word docx export). - Unexpected omission of variables when using
coef_map: Thecoef_mapparameter functions as both a renaming dictionary and a strict inclusion filter. Any variable present in the model but omitted from thecoef_mapvector is excluded from the table. If you want to rename specific terms without dropping unmapped variables, use thecoef_renameargument instead. - Custom model class not recognized: When summarizing models from specialized packages that do not provide native broom tidiers, modelsummary may return an error indicating that no tidying method exists. Install and load the
parameterspackage from theeasystatsecosystem, which extends extraction support to over 100 additional statistical model classes. - Cluster variable formula error in
vcov: When specifying clustered standard errors using formula syntax (e.g.,vcov = ~cluster_var), ensure thatcluster_varis an actual column in the original data frame and that no rows with missing values were silently dropped during estimation without matching indices.
Free alternatives
Several free and open-source packages in the R ecosystem generate regression tables and statistical summaries. While proprietary software suites like Stata and IBM SPSS Statistics require expensive institutional subscriptions, the open-source tools below provide flexible, zero-cost alternatives for academic researchers:
| Package / Tool | Primary Focus | Default Rendering Engine | Multi-Model Comparison | Active Maintenance | Open Source License |
|---|---|---|---|---|---|
| modelsummary | Regression tables, coefficient plots, and data summaries | tinytable (modular support for gt, kableExtra, flextable) |
Yes | Active (CRAN v2.6.0, 2026) | GPL-3 |
| stargazer | Classical regression tables and summary statistics | Built-in ASCII, LaTeX, and HTML formatters | Yes | Dormant (no CRAN update since 2018; lacks support for modern model objects) | GPL (>= 2) |
| gtsummary | Clinical trials, epidemiology summaries, and regression tables | gt table engine |
Yes (via tbl_merge) |
Active (CRAN release, 2026) | MIT |
| broom | Extracting model coefficients and diagnostics into tidy data frames | Tidyverse tibbles (raw data, not styled display tables) | No (requires manual binding or downstream table tools) | Active (CRAN release, 2026) | MIT |
| sjPlot | Social science regression tables and GLMM diagnostic plots | HTML and knitr rendering | Yes (via tab_model) |
Active (CRAN release, 2026) | GPL-3 |
FAQ
How do I output a modelsummary table directly to Microsoft Word?
To output a modelsummary table to Microsoft Word, pass a filename with the .docx extension to the output parameter, such as modelsummary(models, output = "table.docx"). The package automatically utilizes an installed document engine (such as flextable or tinytable) to compile a cleanly formatted, editable table in Word format.
Can modelsummary display confidence intervals instead of standard errors?
Yes. You can display confidence intervals instead of standard errors by setting the statistic argument to "conf.int". You can also specify custom confidence interval formatting using glue syntax, such as statistic = "[{conf.low}, {conf.high}]", or report both standard errors and confidence intervals simultaneously.
How do I calculate robust standard errors without re-estimating models?
You can calculate robust standard errors on the fly by passing a variance-covariance specification directly to the vcov argument in modelsummary(), such as vcov = "robust", vcov = "HC3", or vcov = ~cluster_variable. The package utilizes the underlying sandwich package to recompute standard errors without modifying or re-estimating the original model objects.
What is the difference between modelsummary and datasummary?
The modelsummary() function is specifically designed to summarize and compare fitted statistical models (such as linear regressions, generalized linear models, and survival models). In contrast, the datasummary() family (including datasummary_skim, datasummary_balance, and datasummary_correlation) summarizes raw data frames, generating cross-tabulations, correlation matrices, and balance tables for observational or experimental data.
Does modelsummary support mixed-effects and Bayesian models?
Yes. modelsummary supports mixed-effects models from packages such as lme4 and glmmTMB, as well as Bayesian models estimated via brms, rstanarm, and MCMCglmm. Model extraction is handled transparently through the broom and easystats (parameters) ecosystems.
Sources
The syntax, commands, and architectural details in this guide are verified against official documentation and peer-reviewed software publications:
- CRAN Package Repository: Package
modelsummary(“Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready”), version 2.6.0, maintained by Vincent Arel-Bundock. Available at: cran.r-project.org/package=modelsummary (Checked: 2026-11-11). - modelsummary Official Documentation: Reference manual, vignettes, and table customization guides by Vincent Arel-Bundock. Available at: modelsummary.com (Checked: 2026-11-11).
- Journal of Statistical Software (JSS): Arel-Bundock, V. (2022). “modelsummary: Data and Model Summaries in R.” Journal of Statistical Software, 103(1), 1–23. DOI: 10.18637/jss.v103.i01 (Checked: 2026-11-11).







