Package: cobalt 4.6.3

cobalt: Covariate Balance Tables and Plots

Generate balance tables and plots for covariates of groups preprocessed through matching, weighting or subclassification, for example, using propensity scores. Includes integration with 'MatchIt', 'WeightIt', 'MatchThem', 'twang', 'Matching', 'optmatch', 'CBPS', 'ebal', 'cem', 'sbw', and 'designmatch' for assessing balance on the output of their preprocessing functions. Users can also specify data for balance assessment not generated through the above packages. Also included are methods for assessing balance in clustered or multiply imputed data sets or data sets with multi-category, continuous, or longitudinal treatments.

Authors:Noah Greifer [aut, cre]

cobalt_4.6.3.tar.gz
cobalt_4.6.3.zip(r-4.7)cobalt_4.6.3.zip(r-4.6)cobalt_4.6.3.zip(r-4.5)
cobalt_4.6.3.tgz(r-4.6-any)cobalt_4.6.3.tgz(r-4.5-any)
cobalt_4.6.3.tar.gz(r-4.7-any)cobalt_4.6.3.tar.gz(r-4.6-any)
cobalt_4.6.3.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
cobalt/json (API)

# Install 'cobalt' in R:
install.packages('cobalt', repos = c('https://ngreifer.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/ngreifer/cobalt/issues

Pkgdown/docs site:https://ngreifer.github.io

Datasets:
  • lalonde - Data from National Supported Work Demonstration and PSID, as analyzed by Dehejia and Wahba (1999).
  • lalonde_mis - Data from National Supported Work Demonstration and PSID, as analyzed by Dehejia and Wahba (1999).

On CRAN:

Conda:

causal-inferencepropensity-scores

13.87 score 85 stars 11 packages 1.7k scripts 20k downloads 9 mentions 23 exports 19 dependencies

Last updated from:d955e34778. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK225
source / vignettesOK416
linux-release-x86_64OK226
macos-release-arm64OK137
macos-oldrel-arm64OK164
windows-develOK162
windows-releaseOK135
windows-oldrelOK153
wasm-releaseOK145

Exports:available.statsbal.computebal.initbal.plotbal.tabcol_w_corrcol_w_covcol_w_dcorrcol_w_dcovcol_w_kscol_w_meancol_w_ovlcol_w_sdcol_w_smdcol_w_vrf.buildget.cobalt.optionsget.wlove.plotset.cobalt.optionssplitfactorunsplitfactorvar.names

Dependencies:argclicpp11farverggplot2gluegridExtragtableisobandlabelinglifecycleR6RColorBrewerrlangS7scalesvctrsviridisLitewithr

Covariate Balance Tables and Plots: A Guide to the cobalt Package
Introduction | Citing cobalt | Why cobalt? | Visual clarity | Useful summaries | One tool to rule them all | Flexibility | Pretty plots | Unique features | How To Use cobalt | Utilities | bal.tab() | Using bal.tab() on its own | Using bal.tab() with MatchIt | Using bal.tab() with WeightIt | bal.plot() | love.plot() | Additional Features | Using cobalt with continuous treatments | Using cobalt with multi-category treatments | Comparing balancing methods | Using the prognostic score for balance assessment | Details on Calculations | Variance in Standardized Mean Differences and Correlations | Weighted Variance | Effective Sample Size for Weighting | What's Missing in cobalt | Test Statistics and P-values | Q-Q Plots and Summaries | What's Added in cobalt | Density Plots | Variance Ratios | Distinguishing Continuous and Binary Covariates | Interactions and Polynomials | Clusters | Missing Data | For Programmers: Integrating cobalt with Your Package | Acknowledgments | References

Last update: 2026-05-29
Started: 2016-07-18

Optimizing Tuning Parameters for Balance
bal.compute() and bal.init() | Balance statistics | smd.mean, smd.max, smd.rms | ks.mean, ks.max, ks.rms | ovl.mean, ovl.max, ovl.rms | mahalanobis | energy.dist | kernel.dist | l1.med | r2, r2.2, r2.3 | p.mean, p.max, p.rms | s.mean, s.max, s.rms | distance.cov, distance.cor | Choosing a balance statistic | Example | Tuning GBM for balance | References

Last update: 2026-05-28
Started: 2023-03-16

Using love.plot() To Generate Love Plots
References

Last update: 2026-05-28
Started: 2023-03-16

Using cobalt with Clustered, Multiply Imputed, and Other Segmented Data
cobalt and Segmented Data | Clustered Data | bal.tab() | bal.plot() | love.plot() | Multiply Imputed Data | Multi-Category Treatments with Multiply Imputed Data | Concluding Remarks

Last update: 2026-05-28
Started: 2023-03-16

Using cobalt with Longitudinal Treatments
Setup | bal.tab() | bal.plot() | love.plot() | Other Packages | References

Last update: 2026-05-28
Started: 2023-03-16

Using cobalt with Other Preprocessing Packages
Utilities | splitfactor() and unsplitfactor() | get.w() | bal.tab() | Using bal.tab() with twang | Using bal.tab() with Matching | Using bal.tab() with optmatch | Using bal.tab() with CBPS | Using bal.tab() with ebal | Using bal.tab() with designmatch | Using bal.tab() with sbw | Using bal.tab() with MatchThem | Using bal.tab() with cem | Using bal.tab() with other packages

Last update: 2026-01-23
Started: 2023-03-16

Frequently Asked Questions
How are standardized mean differences computed in cobalt? | Why are mean differences not standardized for binary covariates? | Why do you use the same standardization factor before and after adjustment? | How do I extract the balance tables from the bal.tab() object? | How are balance statistics computed when using subclassification? | Why don't I get the same balance statistics when using cobalt as I do when using tableone? | Why doesn't thresholds work with bal.tab() with multiply imputed or clustered data? | References

Last update: 2026-01-23
Started: 2024-02-26

Readme and manuals

Help Manual

Help pageTopics
Efficiently compute scalar balance statisticsavailable.stats bal.compute bal.compute.bal.init bal.compute.default bal.init
Visualize Distributional Balancebal.plot
Display Balance Statistics in a Tablebal.tab
Balance Statistics for 'CBPS' Objectsbal.tab.CBPS
Balance Statistics for 'cem' Objectsbal.tab.cem.match
Balance Statistics for Other Objectsbal.tab.default
Balance Statistics for 'designmatch' Objectsbal.tab.designmatch
Balance Statistics for 'ebalance' Objectsbal.tab.ebalance
Balance Statistics for Data Setsbal.tab.data.frame bal.tab.formula bal.tab.matrix
Balance Statistics for 'Matching' Objectsbal.tab.Match
Balance Statistics for 'MatchIt' Objectsbal.tab.matchit
Balance Statistics for 'MatchThem' Objectsbal.tab.mimids
Balance Statistics for 'optmatch' Objectsbal.tab.optmatch
Balance Statistics for 'twang' Objectsbal.tab.ps
Balance Statistics for 'sbw' Objectsbal.tab.sbwcau
Balance Statistics for Longitudinal Datasetsbal.tab.data.frame.list bal.tab.formula.list bal.tab.time.list
Balance Statistics for 'WeightIt' Objectsbal.tab.weightit
Balance Statistics in 'bal.tab' and 'love.plot'balance-statistics
Compute Balance and Summary Statistics for Covariatesbalance-summary col_w_corr col_w_cov col_w_dcorr col_w_dcov col_w_ks col_w_mean col_w_ovl col_w_sd col_w_smd col_w_vr
Using 'bal.tab()' with Clustered Dataclass-bal.tab.cluster
Using 'bal.tab()' with Multiply Imputed Dataclass-bal.tab.imp
Using 'bal.tab()' with Longitudinal Treatmentsclass-bal.tab.msm
Using 'bal.tab()' with Multi-Category Treatmentsclass-bal.tab.multi
Using 'bal.tab()' with Subclassified Dataclass-bal.tab.subclass
Options for Displaying 'bal.tab()' Outputdisplay-options
Convenient Formula Generationf.build
Extract Weights from Preprocessing Objectsget.w get.w.CBMSM get.w.CBPS get.w.cem.match get.w.designmatch get.w.ebalance get.w.iptw get.w.Match get.w.matchit get.w.mimids get.w.mnps get.w.optmatch get.w.ps get.w.ps.cont get.w.sbwcau get.w.weightit get.w.wimids
Data from National Supported Work Demonstration and PSID, as analyzed by Dehejia and Wahba (1999).lalonde lalonde_mis
Display Balance Statistics in a Love Plotlove.plot
Print Results of a Call to 'bal.tab()'print.bal.tab
Set and Get Options in 'cobalt'get.cobalt.options set.cobalt.options
Split and Unsplit Factors into Dummy Variablessplitfactor unsplitfactor
Extract Variable Names from 'bal.tab' Objectsvar.names