A full design-and-analysis platform for causal effects via balancing weights (overlap, IPW, ATT, matching, entropy) for binary and multiple treatments.
Input · what goes in
One row per unit: covariates X, a (binary or multi-level) treatment Z, and an outcome Y.
Show data format & exampleHide example
| trt | cov1 | cov2 | cov3 | Y |
|---|---|---|---|---|
| 1 | 0.42 | 1 | -0.7 | 8.1 |
| 2 | -1.1 | 0 | 0.3 | 5.6 |
| 1 | 0.05 | 1 | 1.2 | 9.4 |
| 3 | 1.30 | 0 | -0.2 | 4.2 |
Pipeline · the recipe
↑ Click any step in the diagram to read its logic, code, assumptions & discussion.
Load data and specify the PS model
Data preparation — shapes the raw inputs into what the estimator expects.
Load the bundled psdata (3-level treatment trt with covariates cov1-cov6 and outcome Y) and write the propensity-score formula that all later steps reuse.
# Install: install.packages("PSweight")
library(PSweight)
data("psdata")
head(psdata)
ps.formula <- trt ~ cov1 + cov2 + cov3 + cov4 + cov5 + cov6
out.formula <- Y ~ cov1 + cov2 + cov3 + cov4 + cov5 + cov6
- No comments on this step yet — be the first.
Log in to comment on this step.
Design stage: SumStat() balance check
A pre-flight check — run this before trusting any estimate downstream.
Fit the PS model and compute weighted covariate balance under several weighting schemes before touching the outcome, so the design is finalized blind to Y.
bal <- SumStat(ps.formula, trtgrp = "2", data = psdata,
weight = c("IPW", "overlap", "treated", "entropy", "matching"))
summary(bal)
plot(bal, type = "balance", metric = "ASD")
- No comments on this step yet — be the first.
Log in to comment on this step.
Estimate the ATO with overlap weights
The core estimate — where the causal quantity itself is computed.
Call PSweight with weight='overlap' to estimate the average treatment effect among the overlap population using closed-form sandwich variance.
ato1 <- PSweight(ps.formula = ps.formula, yname = "Y",
data = psdata, weight = "overlap")
- No comments on this step yet — be the first.
Log in to comment on this step.
Summarize pairwise contrasts
Uncertainty quantification — standard errors, intervals, and aggregation.
summary() forms the default pairwise contrasts across the three treatment levels and reports point estimates, sandwich SEs, Wald CIs, and p-values.
summary(ato1)
- No comments on this step yet — be the first.
Log in to comment on this step.
Output · what you get
Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.
Result · the numbers
⚠️ Unofficial community showcase of PSweight (docs). Not affiliated with the authors — all credit to Fan Li & coauthors; this summarizes public documentation.
What it does. PSweight estimates average causal effects from observational studies and trials using propensity-score balancing weights. It supports the overlap weight (ATO), IPW (ATE), treated weight (ATT), matching and entropy weights, for binary and multi-category treatments, with additive and ratio (risk ratio, odds ratio) estimands.
How it works. A SumStat design step fits the propensity model and reports weighted covariate balance and PS-overlap diagnostics. The PSweight analysis step computes weighted average potential outcomes and contrasts, optionally augmented (doubly robust) with an outcome model, using nuisance-adjusted sandwich (or bootstrap) standard errors. Overlap weights uniquely yield exact mean balance on covariates included in a logistic PS and minimize asymptotic variance.
Assumptions. Unconfoundedness, positivity/overlap (relaxed by ATO down-weighting extremes), correct PS model (or outcome model under augmentation), SUTVA.
What you get — Point estimate of the chosen contrast (e.g. ATO), sandwich SE, confidence interval, plus weighted balance tables and PS-overlap plots.
Example output
Closed-form inference:
Original group value: 1, 2, 3
Contrast:
1 2 3
Contrast 1 -1 1 0
Contrast 2 -1 0 1
Contrast 3 0 -1 1
Estimate Std.Error lwr upr Pr(>|z|)
Contrast 1 -1.24161 0.16734 -1.56960 -0.91362 1.177e-13 ***
Contrast 2 1.12482 0.17099 0.78968 1.45996 4.764e-11 ***
Contrast 3 2.36643 0.25854 1.85970 2.87315 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Discussion (0)
Log in to join the discussion.