Package: WeightIt 2.1.0.9001

WeightIt: Weighting for Covariate Balance in Observational Studies

Generates balancing weights for causal effect estimation in observational studies with binary, multi-category, or continuous point or longitudinal treatments by easing and extending the functionality of several R packages and providing in-house estimation methods. Available methods include those that rely on parametric modeling, optimization, and machine learning. Also allows for assessment of weights and checking of covariate balance by interfacing directly with the 'cobalt' package. Methods for estimating weighted regression models that take into account uncertainty in the estimation of the weights via M-estimation or bootstrapping are available. See the vignette "Installing Supporting Packages" for instructions on how to install any optional package 'WeightIt' uses, including those that may not be on CRAN.

Authors:Noah Greifer [aut, cre, cph]

WeightIt_2.1.0.9001.tar.gz
WeightIt_2.1.0.9001.zip(r-4.7-any)WeightIt_2.1.0.9001.zip(r-4.6-any)WeightIt_2.1.0.9001.zip(r-4.5-any)
WeightIt_2.1.0.9001.tgz(r-4.6-any)WeightIt_2.1.0.9001.tgz(r-4.5-any)
WeightIt_2.1.0.9001.tar.gz(r-4.7-any)WeightIt_2.1.0.9001.tar.gz(r-4.6-any)
WeightIt_2.1.0.9001.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
WeightIt/json (API)

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

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

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

Datasets:
  • msmdata - Simulated data for a 3 time point sequential study

On CRAN:

Conda:

causal-inferenceinverse-probability-weightsobservational-studypropensity-scores

12.55 score 135 stars 5 packages 934 scripts 10k downloads 4 mentions 18 exports 24 dependencies

Last updated from:41e06c62b3. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK231
source / vignettesOK372
linux-releaseOK218
macos-releaseOK182
macos-oldrelOK215
windows-develOK211
windows-releaseOK185
windows-oldrelOK132
wasm-releaseOK148

Exports:.cens.weightit_methodsas.weightitas.weightitMSMcalibratecoxph_weightitESSget_w_from_psglm_weightitlm_weightitmake_full_rankmultinom_weightitordinal_weightitsbpstrimweightitweightit.fitweightitMSM

Dependencies:argclicobaltcpp11farvergenericsggplot2gluegridExtragtableisobandlabelinglatticelifecycleR6RColorBrewerrlangS7sandwichscalesvctrsviridisLitewithrzoo

Estimating Effects After Weighting
Introduction | Identifying the estimand | G-computation | Modeling the Outcome | Estimating Standard Errors and Confidence Intervals | Asymptotically Correct Standard Errors Using M-estimation | Robust Standard Errors | Bootstrapping | Estimating Treatment Effects and Standard Errors After Weighting | The Standard Case: Binary Treatment with Asymptotically Correct SEs | Adjustments to the Standard Case | Weighting for the ATT or ATC | Weighting for estimands other than the ATT, ATC, or ATE | Binary, count, and categorical outcomes | Survival outcomes | Using sampling weights with complex surveys | Multi-Category Treatments | Continuous Treatments | Longitudinal Treatments | Moderation Analysis | Reporting Results | References | Code to Generate Data used in Examples

Last update: 2026-10-09
Started: 2023-04-10

Longitudinal Treatments
Introduction | Marginal Structural Models for Longitudinal Treatments | The Estimand | Time-Varying Confounding | Assumptions | Inverse Probability Weights | Estimating Weights for a Longitudinal Treatment | The Data | Initial Imbalance | Estimating the Weights | Assessing Balance | Estimating the Treatment Effect | Accounting for Loss to Follow-Up | The Estimand with Censoring | Simulating Loss to Follow-Up | Other Considerations | References

Last update: 2026-10-09
Started: 2026-10-08

Installing Supporting Packages
Propensity score weighting using GLMs (method = "glm") | missing = "saem" | Binary and multi-category treatments with link = "br.logit" | Multi-category treatments with multi.method = "mclogit" | Multilevel treatment models with random effects | Multi-category treatments with multi.method = "mnp" | Propensity score weighting using GBM (method = "gbm") | Covariate Balancing Propensity Score weighting (method = "cbps") | Nonparametric Covariate Balancing Propensity Score weighting (method = "npcbps") | Entropy balancing (method = "ebal") | Inverse probability tilting (method = "ipt") | Stable Balancing Weights (method = "optweight") | Propensity score weighting using SuperLearner (method = "super") | Propensity score weighting using BART (method = "bart") | Energy balancing (method = "energy") | Characteristic function distance balancing (method = "cfd")

Last update: 2026-10-08
Started: 2022-06-22

Using WeightIt to Estimate Balancing Weights
Introduction | Balancing Weights for a Point Treatment | Balancing Weights for a Longitudinal Treatment | Accounting for censoring | References

Last update: 2026-10-08
Started: 2020-08-20

Weighting Methods
Introduction | Weighting | Balance and Effective Sample Size | Estimands and Target Populations | Treatment Types | Parametric Methods | Propensity Score Weighting Using Generalized Linear Models (method = "glm") | Covariate Balancing Propensity Score Weighting (method = "cbps") | Inverse Probability Tilting (method = "ipt") | Machine Learning Methods | Propensity Score Weighting Using Generalized Boosted Models (method = "gbm") | Propensity Score Weighting Using SuperLearner (method = "super") | Propensity Score Weighting Using BART (method = "bart") | Optimization-Based Methods | Entropy Balancing (method = "ebal") | Stable Balancing Weights (method = "optweight") | Nonparametric Covariate Balancing Propensity Score Weighting (method = "npcbps") | Energy Balancing (method = "energy") | Characteristic Function Distance Balancing (method = "cfd") | Additional Options | Balancing Higher Moments, Interactions, and Quantiles (moments, int, quantile) | Stabilizing Weights (stabilize) | Trimming Weights (trim()) | Calibrating Propensity Scores (calibrate()) | Marginal Mean Weighting Through Stratification (subclass) | Supplying Propensity Scores (ps) | Choosing a Weighting Method | Summary of the Weighting Methods | A Workflow for Selecting a Method | Reporting the Weighting Specification | References

Last update: 2026-10-08
Started: 2026-10-08

Readme and manuals

Help Manual

Help pageTopics
Mark a censoring indicator in a model formula.cens
Weighting methods.weightit_methods
Methods for 'glm_weightit' objectsanova.glm_weightit
Create a 'weightit' object manuallyas.weightit as.weightit.default as.weightit.weightit.fit as.weightitMSM as.weightitMSM.default
Calibrate Propensity Score Weightscalibrate calibrate.default calibrate.weightit
Fitting (Weighted) Cox Proportional Hazards Modelscoxph_weightit
Compute effective sample size of weighted sampleESS
Compute weights from propensity scoresget_w_from_ps
Fitting (Weighted) Generalized Linear Modelsglm_weightit lm_weightit
Methods for 'glm_weightit()' objectsestfun.glm_weightit glm_weightit-methods print.glm_weightit summary.coxph_weightit summary.glm_weightit summary.multinom_weightit summary.ordinal_weightit update.glm_weightit vcov.glm_weightit
Make a design matrix full rankmake_full_rank
Propensity Score Weighting Using BARTmethod_bart
Covariate Balancing Propensity Score Weightingmethod_cbps
Characteristic Function Distance Balancingmethod_cfd method_kernel
Entropy Balancingmethod_ebal method_entropy
Energy Balancingmethod_energy
Propensity Score Weighting Using Generalized Boosted Modelsmethod_gbm
Propensity Score Weighting Using Generalized Linear Modelsmethod_glm
Inverse Probability Tiltingmethod_ipt
Nonparametric Covariate Balancing Propensity Score Weightingmethod_npcbps
Stable Balancing Weightsmethod_optweight method_sbw
Weighting from Supplied Propensity Scoresmethod_ps
Propensity Score Weighting Using SuperLearnermethod_super
User-Defined Functions for Estimating Weightsmethod_user
Simulated data for a 3 time point sequential studymsmdata
Fitting (Weighted) Multinomial Regression Modelsmultinom_weightit
Fitting (Weighted) Ordinal Regression Modelsordinal_weightit
Plot information about the weight estimation processplot.weightit
Predictions for 'glm_weightit' objectspredict.glm_weightit predict.multinom_weightit predict.ordinal_weightit
Subgroup Balancing Propensity Scoresbps
Print and Summarize Outputplot.summary.weightit plot.summary.weightitMSM summary.weightit summary.weightitMSM
Trim (Winsorize) Large Weightstrim trim.default trim.weightit
Estimate Balancing Weightsweightit
Generate Balancing Weights with Minimal Input Processingweightit.fit
Generate Balancing Weights for Longitudinal TreatmentsweightitMSM