PSDiag: Evaluate how well a propensity score model performs

View source: R/PSDiag.R

PSDiagR Documentation

Evaluate how well a propensity score model performs

Description

Calculates the standardized mean difference (SMD) for each covariate before and after propensity score weighting.

Usage

PSDiag(data, ps_fo)

Arguments

data

Data prepared by DataStandard().

ps_fo

propensity score model formula

Details

PSDiag() fits the propensity score model using baseline observations and uses inverse-probability-of-treatment weighting to make the treatment groups more comparable. It limits estimated probabilities to ⁠[0.01, 0.99]⁠ to avoid extremely large weights. A smaller absolute SMD after weighting indicates better balance for that covariate.

Value

A PSDiag object containing SMDs before and after weighting, the estimated propensity scores and weights, and a balance plot. SMDs are rounded to three decimal places.

Examples


data("BiSample", package = "PDRobust")
map <- Mapping(
  id = "id", time = "time", treatment = "A",
  survival = "S", outcome = "Y",
  baseline_time = 0, cutoff_time = 2,
  covariates = c("X1", "X2", "X4"),
  interest_vars = c("X1", "X2"), y_type = "B"
)
pd_dat <- DataStandard(BiSample, map)
result <- PSDiag(pd_dat, A ~ X1 + X2 + X4)
result$smd_after


PDRobust documentation built on Oct. 2, 2026, 5:09 p.m.