← Methods repository
CONCEPTINTERMEDIATEPYTHON · R · SASlast reviewed 2026-10-31 · updated 2026-08-25 · 4 citations

Missing Data, Trimming, and Winsorization in RWE

An overview of distinct operations: handling incomplete observations, restricting an analysis population, capping estimated weights, and capping outcome values. They have different consequences for identification, estimation, and interpretation and must be specified separately.

Causal Inference Methodmissing-dataMCARMARMNARweight-trimmingwinsorizationpositivityoverlap
On this page
Methods reference only. Use primary source citations and local policy before applying this in a study protocol, regulatory submission, payer dossier, or clinical decision.
In plain language

Missing records, poorly supported treatment comparisons, extreme analysis weights, and very high costs are different problems. Removing patients changes who the study describes. Capping weights keeps patients but changes their contribution and can bias the original target estimate. Capping costs changes the measured outcome. None of these operations automatically fixes missing information or confounding.

When to use it
—Only as a justified prespecified stabilization/sensitivity choice after diagnosing support and model specification.
—When the expensive events are valid and part of the target rather than transaction or unit errors.
Watch out for
—It can introduce bias for the original target and does not automatically identify a named alternative population.
—A heavy tail may require an appropriate model and careful uncertainty estimation.

Distinct problems and operations

This entry is an overview, not a single combined method. Missingness concerns what was observed and the assumptions under which incomplete data identify the intended target. Population trimming removes records under an explicit eligibility or support rule. Weight truncation or Winsorization caps estimated analysis weights while retaining records. Outcome Winsorization caps observed outcomes such as costs. These operations must not be described as interchangeable or as automatically identifying the same newly defined target population.

Population restriction versus estimator modification

Restricting the analysis to a defined overlap region changes the population and may change the estimand to an effect in that restricted population. Re-estimate the relevant nuisance models when the method requires it and describe who was excluded. Capping inverse-probability weights generally changes the estimator's weighting and can introduce bias for the original population effect; it does not automatically identify a coherent alternative population effect. An explicit weighting scheme, such as overlap weighting, defines a different target under its own assumptions. A truncated estimator should be described in relation to its intended estimand, not relabeled as a restricted-population causal effect without justification.

Missing-data mechanisms

Missing completely at random, missing at random conditional on specified observed information, and missing not at random are assumptions about a data-generating process, not diagnoses established from a missingness table. Complete-case analysis can be valid under conditions weaker than MCAR for particular models and targets. Multiple imputation requires a compatible, adequately specified imputation/analysis strategy; departures from MAR require sensitivity analysis. Including an outcome or later observed information in a properly constructed imputation model is not automatically the same as adjusting a causal outcome model for a post-treatment variable. Respect longitudinal ordering, the substantive model, and what would be available for the actual analysis or prediction task.

Death, censoring, and observability

A clinical outcome after death may be undefined rather than an unrecorded value awaiting imputation. Choose a composite, while-alive, survivor, or other explicitly justified estimand as appropriate. In a cumulative healthcare-cost target, death can end cost accrual; it is not the same as incomplete capture after disenrollment. Disenrollment can produce dependent observation loss, but it is not inherently MNAR in every data structure. Define what is structurally impossible, what is outside the observation system, and what is missing among otherwise defined measurements. Use censoring adjustment or an explicit observation model only when the required assumptions and support are defensible.

Pros, cons, and trade-offs

Restriction can make a supported comparison more credible but reduces generalizability. Weight capping can reduce instability at the cost of bias; it cannot restore structural positivity. Outcome capping may improve numerical stability but changes the cost distribution being summarized and can discard the clinically important high-cost tail. A two-part or appropriate skewed-cost model addresses a modeling problem; it does not turn a real extreme claim into an error. Missing-data methods can use partial records but depend on assumptions not established by model convergence.

When NOT to use

Do not apply a universal maximum-weight cutoff, treat a particular effective sample size as proof of identification, or choose a cap by the most favorable treatment effect. Do not claim that trimming removes unmeasured confounding. Do not replace absent benefit coverage with zero utilization, impute undefined post-death clinical measurements as ordinary missing data, or equate absence of an EHR encounter with event-free follow-up. Do not present a capped-cost mean as the uncapped population mean. Sensitivity to an analysis choice is evidence about robustness, not by itself proof that every estimate is an artifact.

Data-source implementation

Claims require medical/pharmacy benefit observability, transaction reconciliation, and an explicit treatment of death and enrollment end. EHRs require encounter and measurement availability, dates, and outside-system-care caveats. Registries may have scheduled assessments and informative missed visits. Linked data require a linkage-selection assessment. Keep records of these decisions separate from numerical stabilization choices; a well-behaved estimator does not certify the source data.

Decision diagram

flowchart TD
  P["Identify the actual problem"] --> M["Incomplete observations:<br/>missingness and censoring assumptions"]
  P --> S["Population restriction:<br/>state new eligibility and target"]
  P --> W["Weight capping:<br/>bias and stability sensitivity"]
  P --> C["Outcome capping:<br/>state the transformed outcome"]
Missingness, population restriction, weight capping, and outcome transformation have different methodological consequences.
flowchart TD
  P["Identify the actual problem"] --> M["Incomplete observations:<br/>missingness and censoring assumptions"]
  P --> S["Population restriction:<br/>state new eligibility and target"]
  P --> W["Weight capping:<br/>bias and stability sensitivity"]
  P --> C["Outcome capping:<br/>state the transformed outcome"]
Missingness, population restriction, weight capping, and outcome transformation have different methodological consequences.

Worked example

Scenario

A pharmacoepidemiology team is estimating the average difference in one-year total cost between patients on a specialty drug (treated, T=1) and an active comparator (T=0). They fit a logistic model to get a propensity score for each patient, then compute stabilized inverse-probability weights. The marginal probability of being treated is 3/6 = 0.50, so the stabilized weight for each treated patient is 0.50 divided by their propensity score, and for each comparator patient is 0.50 divided by (1 minus their propensity score). Inspecting the weights reveals two patients — one in each arm — with a propensity score near the boundary of their group, producing a weight of 10.0. Those two patients together hold most of the total weight in the analysis. The team pre-specified a rule: compare trimming (drop patients with weight above 5.0) versus winsorizing (cap weights above 5.0 at 5.0), and report both alongside the raw result.

Dataset

Analysis-ready table: one row per patient with propensity score, stabilized weight, and one-year total cost in thousands of dollars.

patient_idarmpropensity_scorestabilized_weighttotal_cost_k
P01treated0.80.62518
P02treated0.41.2522
P03treated0.0510.045
P04comparator0.20.62512
P05comparator0.61.2510
P06comparator0.9510.08

Steps

1Compute each stabilized weight: for treated patients, divide 0.50 by the propensity score; for comparator patients, divide 0.50 by (1 minus the propensity score). P03 has propensity score 0.05, meaning the model thought it very unlikely this patient would be treated — yet they were, so the weight is 0.50 / 0.05 = 10.0. P06 has propensity score 0.95, meaning the model expected them to be treated but they were not, so 0.50 / (1 - 0.95) = 10.0.
2RAW weighted mean for the treated arm: multiply each patient's cost by their weight, sum across treated patients, then divide by the sum of treated weights. Numerator = (0.625 x 18) + (1.25 x 22) + (10.0 x 45) = 11.25 + 27.50 + 450.00 = 488.75. Denominator = 0.625 + 1.25 + 10.0 = 11.875. Weighted mean treated = 488.75 / 11.875 = 41.16 ($41,160).
3RAW weighted mean for the comparator arm: numerator = (0.625 x 12) + (1.25 x 10) + (10.0 x 8) = 7.50 + 12.50 + 80.00 = 100.00. Denominator = 0.625 + 1.25 + 10.0 = 11.875. Weighted mean comparator = 100.00 / 11.875 = 8.42 ($8,420). Raw weighted cost difference = 41.16 - 8.42 = 32.74 ($32,740). Notice that P03 and P06 each contribute roughly 84 percent of their arm's total weight, so P03's cost of $45k is essentially driving the treated-arm estimate on its own.
4TRIMMING: drop P03 and P06 (both have weight 10.0, which exceeds the 5.0 threshold). The marginal treatment probability in the retained four patients is still 2/4 = 0.50, so stabilized weights are recomputed identically: P01 = 0.625, P02 = 1.25, P04 = 0.625, P05 = 1.25. Weighted mean treated: numerator = (0.625 x 18) + (1.25 x 22) = 11.25 + 27.50 = 38.75; denominator = 0.625 + 1.25 = 1.875; result = 38.75 / 1.875 ≈ 20.67 ($20,670). Weighted mean comparator: numerator = (0.625 x 12) + (1.25 x 10) = 7.50 + 12.50 = 20.00; denominator = 1.875; result = 20.00 / 1.875 ≈ 10.67 ($10,670). Trimmed weighted cost difference = 20.67 - 10.67 = 10.00 ($10,000).
5WINSORIZING: keep all six patients but cap any weight above 5.0 at exactly 5.0. P03 weight becomes 5.0 (was 10.0); P06 weight becomes 5.0 (was 10.0). Weighted mean treated: numerator = (0.625 x 18) + (1.25 x 22) + (5.0 x 45) = 11.25 + 27.50 + 225.00 = 263.75; denominator = 0.625 + 1.25 + 5.0 = 6.875; result = 263.75 / 6.875 ≈ 38.36 ($38,360). Weighted mean comparator: numerator = (0.625 x 12) + (1.25 x 10) + (5.0 x 8) = 7.50 + 12.50 + 40.00 = 60.00; denominator = 6.875; result = 60.00 / 6.875 ≈ 8.73 ($8,730). Winsorized weighted cost difference = 38.36 - 8.73 = 29.64 ($29,640).

Result

Raw weighted cost difference is approximately $32,740; dropping records with estimated weight above 5 gives approximately $10,000 in the remaining four records; capping weights at 5 gives approximately $29,640 while retaining six records. These are sensitivity analyses. Dropping on estimated weight changes the analyzed sample but does not by itself identify a prespecified overlap-population causal effect. A primary restricted-population estimand needs its own justified eligibility/support rule. Capping modifies the estimator and can bias the original target. None of these synthetic descriptive calculations establishes a causal cost effect.

Trade-offs

vs. Population trimming
Pros of this
—Weight truncation can retain all observed records while limiting individual weighted contributions.
vs. Capping outcome costs
Pros of this
—Uncapped analysis preserves valid high-cost events relevant to total economic burden.

Code example

Execution not verified · inspect inputs and dependencies before use

Operationalize stabilized IPTW with diagnostics, then apply (a) symmetric PS trimming and (b) percentile Winsorization, reporting effective sample size for each rule. Required input (one row per person, already cleaned): df : person_id, treat (1/0 study vs comparator), ps (estimated propensity, 0<ps<1), y (outcome,...

requires: pandas · numpy
import numpy as np
import pandas as pd

def stabilized_iptw(df: pd.DataFrame) -> pd.Series:
    """Stabilized inverse-probability-of-treatment weights (Austin & Stuart 2015)."""
    p_treat = df["treat"].mean()
    w = np.where(df["treat"] == 1, p_treat / df["ps"], (1 - p_treat) / (1 - df["ps"]))
    return pd.Series(w, index=df.index)

def effective_sample_size(w: pd.Series) -> float:
    """Kish ESS: collapses as a few weights dominate."""
    return (w.sum() ** 2) / (w ** 2).sum()

def symmetric_ps_trim(df: pd.DataFrame, lo: float = 0.01, hi: float = 0.99) -> pd.DataFrame:
    """Stürmer-style trim on percentiles of the TREATED-arm PS, then keep the overlap region."""
    ps_t = df.loc[df["treat"] == 1, "ps"]
    lo_cut, hi_cut = ps_t.quantile(lo), ps_t.quantile(hi)
    return df[(df["ps"] >= lo_cut) & (df["ps"] <= hi_cut)].copy()

def winsorize(s: pd.Series, lo: float = 0.01, hi: float = 0.99) -> pd.Series:
    return s.clip(lower=s.quantile(lo), upper=s.quantile(hi))

def weighted_mean_diff(df: pd.DataFrame, w: pd.Series) -> float:
    """Weighted ATE-style contrast of y between arms (e.g., cost difference)."""
    t = df["treat"] == 1
    m1 = np.average(df.loc[t, "y"], weights=w[t])
    m0 = np.average(df.loc[~t, "y"], weights=w[~t])
    return m1 - m0

# --- Sensitivity grid: no-trim vs symmetric trim, crossed with no-Winsor vs 99th-pct Winsor ---
rows = []
for trim_name, d in [("no_trim", df), ("trim_1_99", symmetric_ps_trim(df))]:
    w = stabilized_iptw(d)                       # recompute weights AFTER trimming
    for win_name, yy in [("no_winsor", d["y"]), ("winsor_99", winsorize(d["y"]))]:
        dd = d.assign(y=yy.values)
        rows.append({
            "trim": trim_name, "winsor": win_name,
            "n": len(dd), "ess": round(effective_sample_size(w), 1),
            "pct_trimmed": round(100 * (1 - len(dd) / len(df)), 2),
            "max_weight": round(float(w.max()), 1),
            "effect": round(weighted_mean_diff(dd, w), 2),
        })
print(pd.DataFrame(rows))

Citations

FOUNDATIONAL / METHODS
  1. [1]Stürmer T, Rothman KJ, Avorn J, Glynn RJ. Treatment effects in the presence of unmeasured confounding: dealing with observations in the tails of the propensity score distribution--a simulation study. American Journal of Epidemiology. 2010;172(7):843-854.
  2. [2]Crump RK, Hotz VJ, Imbens GW, Mitnik OA. Dealing with limited overlap in estimation of average treatment effects. Biometrika. 2009;96(1):187-199.
APPLIED EXAMPLES
  1. [3]Austin PC, Stuart EA. Moving towards best practice when using inverse probability of treatment weighting (IPTW) using the propensity score to estimate causal treatment effects in observational studies. Statistics in Medicine. 2015;34(28):3661-3679.
REPORTING & GUIDANCE
  1. [4]Sterne JAC, White IR, Carlin JB, et al. Multiple imputation for missing data in epidemiological and clinical research: potential and pitfalls. BMJ. 2009;338:b2393.