Skip to content
StatsOtter A workspace for causal thinking
Method library WORKFLOW / 048
Research workflow/4 steps

Propensity-score weighting (PSweight)

01
The method workspace

Follow the analysis.

Select a node to explore the method

Method mapInput → 4 steps → output
START WITHInput data
ARRIVE ATResults
Read step 01
Inside the methodReasoning, equations & implementation
Step 1 of 4
01
Data prep

Load data and specify the PS model

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

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.

Reads fromNot specified Feeds into#2
Key code
# 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

Reference / docs ↗

Discussion on this step (0)
StatsOtterDiscussion starter · Editorial note

Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.

Questions to explore
  1. Which assumption matters most here, and what evidence could challenge it?
  2. What would you check before passing this output to the next step?

Peer discussion

  • Bring your experience, a question, or a different perspective.
02
Data contract

Inputs & data

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
03
Read the evidence

Results & interpretation

1 figure Workflow discussion 0
01FigureCovariate balance under IPW vs overlap weights — overlap weights drive every standardized difference to zero.

Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.

The estimate

\hat\tau_{\mathrm{ATO}}=\frac{\sum_i w_i Z_i Y_i}{\sum_i w_i Z_i}-\frac{\sum_i w_i(1-Z_i)Y_i}{\sum_i w_i(1-Z_i)},\quad w_i=\begin{cases}1-e_i & Z_i=1\ e_i & Z_i=0\end{cases}

Context & interpretation

⚠️ 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

Links: package · paper

Peer notes

Discuss the workflow (0)

  • No comments yet — start the conversation.
IN THE MARGINS

Peer discussion