pharmacoepidemiology
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePharmacoepidemiology Study Design
药物流行病学研究设计
Overview
概述
This skill teaches the agent how to think about pharmacoepidemiologic study design — the discipline of estimating causal drug effects from non-randomized real-world data (claims, EHR, registries). The core challenge is confounding: patients who receive Drug A differ systematically from those who receive Drug B, and naive comparisons conflate treatment effects with selection effects.
A well-designed pharmacoepidemiology study addresses this through three pillars: (1) a new-user active comparator design that aligns time zero and reduces confounding by indication, (2) propensity score methods or target trial emulation to balance measured confounders, and (3) sensitivity analyses to probe the impact of unmeasured confounding.
Use this skill to interrogate study designs, identify bias sources, and guide the user toward defensible causal inference before analysis code is written.
该 skill 教 Agent 如何思考药物流行病学研究设计——这是一门从非随机真实世界数据(claims、EHR、registries)中估计药物因果效应的学科。核心挑战是混杂:接受 Drug A 的患者与接受 Drug B 的患者在系统特征上存在差异,而朴素的比较会把治疗效应与选择效应混为一谈。
设计良好的药物流行病学研究建立在三大支柱之上:(1) 统一 time zero 并减少适应证混杂的 new-user active comparator design;(2) 用于平衡已测量混杂因素的 propensity score methods 或 target trial emulation;以及 (3) 用于检验未测量混杂影响的 sensitivity analyses。
使用此 skill 来审查研究设计、识别偏倚来源,并在编写分析代码之前引导用户形成可辩护的因果推断。
Usage
用法
Invoke this skill when the user:
- Wants to estimate the effect of a drug on a clinical outcome using observational data.
- Asks how to choose a comparator group for a drug safety or effectiveness study.
- Needs to decide between propensity score matching, weighting, or stratification.
- Describes a cohort design that may contain immortal time bias.
- Asks about target trial emulation or how to map observational data to a hypothetical RCT.
- Has time-varying treatments or confounders and needs marginal structural models.
- Wants to assess sensitivity to unmeasured confounding (E-value, negative controls).
- Is reviewing or critiquing a published pharmacoepidemiology study.
The agent should respond by:
- Clarifying the causal question — what treatment, what comparator, what outcome, what population, what time horizon.
- Checking the design — is it new-user? Is the comparator active? Is time zero aligned?
- Identifying bias threats — immortal time, confounding by indication, prevalent user bias, time-varying confounding.
- Recommending a propensity score approach — matching, IPTW, or stratification based on the study context.
- Specifying sensitivity analyses — E-value, negative controls, quantitative bias analysis.
当用户出现以下情况时调用此 skill:
- 希望使用观察性数据估计某种药物对临床结局的影响。
- 询问如何为药物安全性或有效性研究选择对照组。
- 需要决定采用 propensity score matching、weighting 还是 stratification。
- 描述的队列设计可能存在 immortal time bias。
- 询问 target trial emulation,或如何将观察性数据映射到一项假想 RCT。
- 存在时变治疗或混杂因素,需要使用 marginal structural models。
- 希望评估结果对未测量混杂的敏感性(E-value、negative controls)。
- 正在审查或批评一项已发表的药物流行病学研究。
Agent 应按以下方式回应:
- 明确因果问题——确定治疗、对照、结局、人群和时间范围。
- 检查设计——是否采用 new-user design?对照是否为 active comparator?time zero 是否统一?
- 识别偏倚威胁——immortal time、confounding by indication、prevalent user bias、time-varying confounding。
- 推荐 propensity score 方法——根据研究背景在 matching、IPTW 或 stratification 之间选择。
- 指定敏感性分析——E-value、negative controls、quantitative bias analysis。
Response Format
回应格式
- Lead with the direct recommendation or classification (≤3 sentences)
- Structure as: recommendation → justification (citing specific criteria/thresholds) → caveats
- Use tables for comparisons; bullet points for criteria lists
- Omit background the user already knows — they asked the question
- Target: 200-400 words unless the user requests exhaustive detail The decision trees and frameworks in this skill are for internal reasoning only. Apply them to reach your conclusion, but do not reproduce them in your response. Present only the final recommendation with supporting evidence.
- 先给出直接建议或分类结论(≤3 句)
- 结构为:建议 → 理由(引用具体标准或阈值)→ 注意事项
- 使用表格进行比较;使用项目符号列出标准
- 省略用户已经了解的背景——用户是在提出问题
- 目标长度为 200–400 字,除非用户要求详尽说明
此 skill 中的决策树和框架仅供内部推理使用。应用这些框架得出结论,但不要在回应中复现。只需呈现最终建议及其支持证据。
Core Concepts
核心概念
1. The New-User (Incident User) Design
1. New-User(Incident User)设计
The foundation of modern pharmacoepidemiology. Every study should start here.
Rules:
- Index date = first dispensing (or first prescription) of the study drug after a clean washout period.
- Washout period: require 180–365 days of continuous enrollment with no dispensing of the study drug. This excludes prevalent users who may have already experienced early events or side effects.
- Exclude prevalent users. Patients already on the drug at cohort entry are a biased survivor population — they tolerated the drug long enough to still be on it. Including them introduces depletion-of-susceptibles bias.
- Baseline covariates are measured before the index date. Nothing after index date enters the propensity model.
- Follow-up starts at the index date. Time zero is the moment of treatment initiation, not some earlier eligibility date.
这是现代药物流行病学的基础。每项研究都应从这里开始。
规则:
- Index date = 研究药物在充分洗脱期后的首次配药(或首次处方)日期。
- **Washout period:**要求连续参保 180–365 天,且期间无处方研究药物。这样可以排除可能已经发生早期事件或不良反应的 prevalent users。
- **排除 prevalent users。**队列纳入时已经在使用该药物的患者属于有偏的幸存人群——他们耐受该药物足够久,因而仍在使用。纳入他们会引入 depletion-of-susceptibles bias。
- **基线协变量必须在 index date 之前测量。**index date 之后的任何变量都不得进入 propensity score 模型。
- **随访从 index date 开始。**time zero 是治疗启动的时刻,而不是更早的某个资格判定日期。
Why prevalent users are dangerous
为什么 prevalent users 危险性极高
| Problem | Mechanism |
|---|---|
| Depletion of susceptibles | Patients who had early adverse events already stopped the drug and are absent from the prevalent-user pool |
| Undefined baseline | Covariates measured "at baseline" are actually post-treatment for prevalent users |
| Adjusted prevalence | Duration of prior use varies, making the cohort a mixture of different exposure histories |
| 问题 | 机制 |
|---|---|
| Depletion of susceptibles | 已经发生早期不良事件的患者会停止用药,因此不会出现在 prevalent-user 人群中 |
| Undefined baseline | 对 prevalent users 而言,在「基线」测量的协变量实际上发生在治疗之后 |
| Adjusted prevalence | 既往使用时长各不相同,使队列成为不同暴露史的混合人群 |
2. Active Comparator Design
2. Active Comparator 设计
Rule: Compare Drug A vs Drug B, not Drug A vs no drug.
Comparing treated patients to untreated patients introduces massive confounding by indication — the reason a patient receives a drug is correlated with their outcome risk. An active comparator (another drug for the same indication) ensures both groups have the indication, reducing this bias.
规则:比较 Drug A 与 Drug B,而不是 Drug A 与不用药者。
将接受治疗的患者与未接受治疗的患者进行比较,会引入严重的 confounding by indication——患者接受某种药物的原因与其结局风险相关。Active comparator(用于相同适应证的另一种药物)可确保两组均具有该适应证,从而减少此类偏倚。
Decision tree: choosing a comparator
决策树:选择对照
Start
│
├── Is there another drug for the same indication?
│ ├── Yes → Use it as the active comparator.
│ │ Prefer a drug with similar:
│ │ - Indication (same disease stage/severity)
│ │ - Channeling (similar patient profile)
│ │ - Time trends (used in the same era)
│ └── No → Consider:
│ - Non-pharmacologic standard of care
│ - Delayed/deferred treatment (with careful time-zero alignment)
│ - Document residual confounding by indication as a limitation.
│
├── Multiple candidate comparators available?
│ └── Prefer the one with the most clinical overlap.
│ Run the primary analysis with the best comparator;
│ use others in sensitivity analyses.
│
└── Is the comparator a drug from the same class?
├── Within-class comparison → smaller confounding, but smaller effect sizes.
└── Between-class comparison → larger confounding, but more clinically relevant contrast.Start
│
├── Is there another drug for the same indication?
│ ├── Yes → Use it as the active comparator.
│ │ Prefer a drug with similar:
│ │ - Indication (same disease stage/severity)
│ │ - Channeling (similar patient profile)
│ │ - Time trends (used in the same era)
│ └── No → Consider:
│ - Non-pharmacologic standard of care
│ - Delayed/deferred treatment (with careful time-zero alignment)
│ - Document residual confounding by indication as a limitation.
│
├── Multiple candidate comparators available?
│ └── Prefer the one with the most clinical overlap.
│ Run the primary analysis with the best comparator;
│ use others in sensitivity analyses.
│
└── Is the comparator a drug from the same class?
├── Within-class comparison → smaller confounding, but smaller effect sizes.
└── Between-class comparison → larger confounding, but more clinically relevant contrast.3. Target Trial Emulation
3. Target Trial Emulation
Map every observational study to a hypothetical randomized trial. This framework forces explicit specification of each design element and reveals hidden assumptions.
| Target trial component | Specification in observational data |
|---|---|
| Eligibility criteria | Inclusion/exclusion applied at time zero (index date) using pre-index data only |
| Treatment strategies | Initiate Drug A vs initiate Drug B (new-user design) |
| Treatment assignment | Observational — handled by propensity scores or IP weighting |
| Follow-up start | Index date (= treatment initiation). Must be identical for both arms |
| Outcome | Same definition as the target trial; ascertained after time zero |
| Causal contrast | Intention-to-treat (follow regardless of adherence) or per-protocol (censor/weight at discontinuation) |
| Analysis plan | Pre-specified; registered if possible |
Critical rule: If any component cannot be mapped cleanly, the study has a structural bias that no statistical method can fix. The most common failure is misaligned time zero (see immortal time bias below).
将每项观察性研究映射到一项假想 RCT。这一框架要求明确说明每个设计要素,并揭示隐藏的假设。
| Target trial 要素 | 观察性数据中的说明方式 |
|---|---|
| Eligibility criteria | 在 time zero(index date)应用纳入和排除标准,仅使用 index date 之前的数据 |
| Treatment strategies | 启动 Drug A 与启动 Drug B(new-user design) |
| Treatment assignment | 观察性分配——通过 propensity scores 或 IP weighting 处理 |
| Follow-up start | Index date(= 治疗启动时间)。两个组必须完全一致 |
| Outcome | 与 target trial 相同的定义;在 time zero 之后判定 |
| Causal contrast | Intention-to-treat(无论是否依从均继续随访)或 per-protocol(停药时删失/加权) |
| Analysis plan | 预先指定;可行时进行注册 |
**关键规则:**如果任何要素都无法清晰映射,该研究就存在任何统计方法都无法修复的结构性偏倚。最常见的失败是 time zero 未对齐(参见下文 immortal time bias)。
4. Immortal Time Bias
4. Immortal Time Bias
Immortal time is the period between cohort entry and treatment start during which the outcome cannot occur (because occurrence of the outcome would prevent the patient from being classified as treated). Misclassifying this time inflates survival in the treated group.
How it arises:
- Cohort entry is defined by diagnosis, but treatment starts later. The gap is "immortal" for the treated group — they had to survive long enough to receive treatment.
- Comparing "ever-treated" vs "never-treated" without aligning time zero.
Solutions:
| Method | How it works | When to use |
|---|---|---|
| New-user design | Time zero = treatment initiation; no gap exists | Default — prevents the problem entirely |
| Landmark analysis | Define a fixed time point (e.g., 90 days post-diagnosis); classify exposure status at the landmark; start follow-up there | When treatment timing varies and you want a common time origin |
| Time-varying exposure | Model treatment as a time-dependent covariate in a Cox model; person-time before treatment counts as unexposed | When treatment can start at any time and you want to use all person-time |
Rule: If the study compares "ever-users" vs "never-users" with follow-up starting at a time point before treatment initiation, immortal time bias is present. The new-user design eliminates it by construction.
Immortal time 是从队列纳入到治疗开始之间的一段时间,在此期间结局不可能发生,因为一旦结局发生,患者就不会被归类为已治疗。错误归类这段时间会人为提高治疗组的生存率。
产生方式:
- 队列纳入依据诊断确定,但治疗在此后才开始。对治疗组而言,这段间隔属于「永生时间」——患者必须存活足够久才能接受治疗。
- 比较「ever-treated」与「never-treated」,但未对齐 time zero。
解决方案:
| 方法 | 工作方式 | 使用场景 |
|---|---|---|
| New-user design | Time zero = 治疗启动时间;不存在间隔 | 默认选择——彻底防止该问题 |
| Landmark analysis | 定义一个固定时间点(例如诊断后 90 天);在该时间点判定暴露状态,并从此开始随访 | 治疗时间存在差异,且需要一个统一时间原点时 |
| Time-varying exposure | 在 Cox model 中将治疗建模为时间依赖协变量;治疗前的人时计为未暴露 | 治疗可在任意时间开始,且希望利用全部人时时 |
**规则:**如果研究比较「ever-users」与「never-users」,且随访从治疗启动前的某个时间点开始,就存在 immortal time bias。New-user design 从设计上消除这一问题。
5. Propensity Score Methods
5. Propensity Score 方法
The propensity score (PS) is the probability of receiving treatment A (vs B) conditional on measured baseline covariates. It reduces a high-dimensional covariate space to a single balancing score.
Propensity score(PS)是在给定已测量基线协变量的情况下,接受治疗 A 而非 B 的概率。它将高维协变量空间简化为单一平衡评分。
Estimation
估计
- Fit a logistic regression:
treatment ~ age + sex + comorbidities + prior_meds + ... - Include all pre-index covariates that predict treatment, outcome, or both. Do NOT include instruments (variables that predict treatment but not outcome) — they increase variance without reducing bias.
- Check overlap: both groups should have PS distributions that substantially overlap. Trim or truncate extreme weights if needed.
- 拟合 logistic regression:
treatment ~ age + sex + comorbidities + prior_meds + ... - 纳入所有能够预测 treatment、outcome 或二者的 index date 前协变量。不要纳入 instruments(只预测 treatment 而不预测 outcome 的变量)——它们会增加方差,却不能减少偏倚。
- 检查 overlap:两组的 PS 分布应具有充分重叠。如有需要,应剔除或截断极端权重。
Three approaches
三种方法
| Method | Mechanism | Strengths | Limitations |
|---|---|---|---|
| Matching (1:1, caliper) | Pair each treated patient with the nearest untreated patient within a caliper (typically 0.2 × SD of logit-PS) | Intuitive; easy to check balance; mimics an RCT | Discards unmatched patients → reduced sample size and generalizability |
| IPTW (inverse probability of treatment weighting) | Weight each patient by 1/PS (treated) or 1/(1−PS) (comparator) to create a pseudo-population | Uses all patients; estimates ATE; flexible | Extreme weights destabilize estimates; requires truncation or stabilized weights |
| Stratification | Divide PS into quantiles (typically 5–10); estimate treatment effect within each stratum; pool | Simple; transparent | Residual confounding within strata; less precise than IPTW |
| 方法 | 机制 | 优势 | 局限 |
|---|---|---|---|
| Matching(1:1、caliper) | 在 caliper 范围内,为每位治疗患者匹配最近的未治疗患者,通常为 | 直观;易于检查平衡性;模拟 RCT | 丢弃未匹配患者,导致样本量及泛化能力下降 |
| IPTW(inverse probability of treatment weighting) | 以 1/PS(治疗组)或 1/(1−PS)(对照组)对每位患者加权,形成伪人群 | 使用全部患者;估计 ATE;灵活性高 | 极端权重会破坏估计稳定性;需要截断或使用稳定化权重 |
| Stratification | 将 PS 划分为分位数(通常 5–10 层);在每层内估计治疗效应,再合并 | 简单;透明 | 层内仍可能存在残余混杂;精度低于 IPTW |
Decision tree: which PS method?
决策树:选择哪种 PS 方法?
Start
│
├── Is sample size limited or matching feasible?
│ ├── Yes → 1:1 PS matching with caliper = 0.2 × SD(logit-PS).
│ │ Report number matched and unmatched.
│ └── No → Continue.
│
├── Do you need the full sample (e.g., rare outcome)?
│ ├── Yes → IPTW. Use stabilized weights. Truncate at 1st/99th percentile
│ │ if max weight > 10.
│ └── No → Continue.
│
├── Is the goal transparency and simplicity?
│ └── PS stratification (5–10 strata). Report stratum-specific effects.
│
└── Multiple analyses?
└── Use matching as primary, IPTW as sensitivity (or vice versa).
Concordant results strengthen the conclusion.Start
│
├── Is sample size limited or matching feasible?
│ ├── Yes → 1:1 PS matching with caliper = 0.2 × SD(logit-PS).
│ │ Report number matched and unmatched.
│ └── No → Continue.
│
├── Do you need the full sample (e.g., rare outcome)?
│ ├── Yes → IPTW. Use stabilized weights. Truncate at 1st/99th percentile
│ │ if max weight > 10.
│ └── No → Continue.
│
├── Is the goal transparency and simplicity?
│ └── PS stratification (5–10 strata). Report stratum-specific effects.
│
└── Multiple analyses?
└── Use matching as primary, IPTW as sensitivity (or vice versa).
Concordant results strengthen the conclusion.Balance diagnostics
平衡性诊断
After PS adjustment, verify covariate balance:
- Standardized mean difference (SMD): target < 0.1 for all covariates. SMD = |mean_treated − mean_comparator| / √((s²_treated + s²_comparator)/2).
- Variance ratios: should be between 0.5 and 2.0.
- Visual: Love plot (dot plot of SMDs before and after adjustment).
- Do NOT use p-values for balance assessment — they conflate balance with sample size.
Rule: If any covariate has SMD > 0.1 after adjustment, the PS model is inadequate. Add interactions, non-linear terms, or additional covariates and re-estimate.
完成 PS 调整后,应验证协变量平衡:
- **Standardized mean difference(SMD):**所有协变量均应以 < 0.1 为目标。SMD = |mean_treated − mean_comparator| / √((s²_treated + s²_comparator)/2)。
- **方差比:**应介于 0.5 和 2.0 之间。
- **可视化:**使用 Love plot(展示调整前后 SMD 的点图)。
- 不要使用 p 值评估平衡性——它会将平衡性与样本量混为一谈。
**规则:**如果调整后任何协变量的 SMD > 0.1,则 PS 模型不充分。应加入交互项、非线性项或其他协变量,然后重新估计。
6. Covariate Selection for Confounding Adjustment
6. 混杂调整中的协变量选择
Which variables to include in the propensity score or outcome model is a design decision, not a data-driven one. Get it wrong and the estimate is biased or inefficient.
哪些变量应纳入 propensity score 或 outcome model,是一个设计决策,而不是由数据驱动的决策。处理不当会使估计产生偏倚或效率下降。
Rules for covariate inclusion
规则
- Include confounders — variables that cause both treatment and outcome. These are the primary targets.
- Include outcome risk factors — variables that predict the outcome but not treatment. They reduce variance (increase precision) without introducing bias.
- Exclude instruments — variables that predict treatment but NOT outcome. Including them amplifies bias from unmeasured confounding and inflates variance.
- Exclude mediators — variables on the causal pathway between treatment and outcome. Adjusting for them blocks part of the effect you are trying to estimate.
- Exclude colliders — variables caused by both treatment and outcome (or their descendants). Conditioning on a collider opens a non-causal path and introduces bias.
- 纳入 confounders——同时导致 treatment 和 outcome 的变量。这是主要调整目标。
- 纳入 outcome risk factors——预测 outcome 但不预测 treatment 的变量。它们可以降低方差、提高精度,而不会引入偏倚。
- 排除 instruments——预测 treatment 但不预测 outcome 的变量。纳入它们会放大未测量混杂造成的偏倚,并增加方差。
- 排除 mediators——位于 treatment 与 outcome 之间因果路径上的变量。对它们进行调整会阻断部分正在估计的治疗效应。
- 排除 colliders——同时由 treatment 和 outcome 导致的变量及其后代。对 collider 进行条件化会打开非因果路径并引入偏倚。
Typical covariate categories in claims data
Claims data 中的典型协变量类别
| Category | Examples | Measurement window |
|---|---|---|
| Demographics | Age, sex, race, region | At index date |
| Comorbidities | Charlson/Elixhauser score, specific ICD-10 codes | 365 days pre-index |
| Comedications | Concurrent drug classes (statins, antihypertensives) | 180 days pre-index |
| Healthcare utilization | Hospitalizations, ED visits, outpatient visits, distinct prescribers | 365 days pre-index |
| Disease severity proxies | Number of specialist visits, prior procedures, lab orders | 365 days pre-index |
| Frailty indicators | Skilled nursing facility use, home oxygen, wheelchair claims | 365 days pre-index |
| Calendar time | Year/quarter of index date | At index date |
Rule: Always include a measure of healthcare utilization intensity. Patients who interact more with the healthcare system are more likely to receive new drugs and to have outcomes detected — this is a major confounder in claims data.
| 类别 | 示例 | 测量窗口 |
|---|---|---|
| 人口统计学特征 | 年龄、性别、种族、地区 | Index date 时 |
| 合并症 | Charlson/Elixhauser score、特定 ICD-10 编码 | Index date 前 365 天 |
| 合并用药 | 同时使用的药物类别(statin、antihypertensive) | Index date 前 180 天 |
| 医疗服务利用 | 住院、急诊就诊、门诊就诊、不同处方医生数 | Index date 前 365 天 |
| 疾病严重程度代理指标 | 专科就诊次数、既往操作、检验医嘱 | Index date 前 365 天 |
| 衰弱指标 | 专业护理机构使用、家庭氧疗、wheelchair claims | Index date 前 365 天 |
| 日历时间 | Index date 所在年份/季度 | Index date 时 |
**规则:**始终纳入某种医疗服务利用强度指标。与医疗系统互动更多的患者更可能开始使用新药,也更可能被识别出结局——这是 claims data 中的主要混杂因素。
Proxy variables and the healthy-user bias
代理变量与健康使用者偏倚
Claims data lack direct measures of lifestyle (smoking, BMI, exercise, diet). Patients who initiate preventive medications (e.g., statins, vaccines) tend to be healthier and more health-conscious. This healthy-user/healthy-adherer bias can make new drugs appear protective simply because their users are healthier. Mitigate by:
- Including preventive care markers (flu vaccination, cancer screening) as covariates.
- Using negative control outcomes to detect residual healthy-user bias.
- Reporting the E-value to quantify how strong unmeasured healthy-user confounding would need to be.
Claims data 缺少对生活方式(吸烟、BMI、运动、饮食)的直接测量。开始使用预防性药物(例如 statin、疫苗)的患者往往更健康、也更注重健康。这种 healthy-user/healthy-adherer bias 可能使新药看起来具有保护作用,仅仅因为其使用者更健康。可通过以下方式缓解:
- 将预防性保健指标(流感疫苗接种、癌症筛查)纳入协变量。
- 使用 negative control outcomes detect 残余健康使用者偏倚。
- 报告 E-value,以量化未测量的健康使用者混杂需要达到多大强度。
7. Time-Varying Confounding and Marginal Structural Models
7. 时变混杂与 Marginal Structural Models
Standard regression fails when a confounder is both:
- Affected by prior treatment (e.g., lab values change because of the drug), AND
- A predictor of future treatment and outcome.
Adjusting for such a confounder blocks part of the treatment effect (over-adjustment); not adjusting leaves confounding. This is the treatment-confounder feedback problem.
Solution: Marginal Structural Models (MSMs) with stabilized IPTW.
Steps:
- At each time point, estimate the probability of receiving the observed treatment given past treatment and covariate history (denominator of the weight).
- Estimate the probability of receiving the observed treatment given past treatment only (numerator — stabilized weight).
- Stabilized weight = cumulative product of (numerator / denominator) over time.
- Fit a weighted outcome model (e.g., weighted pooled logistic regression or weighted Cox model) using these weights.
Rules for MSMs:
- Stabilized weights should have a mean near 1.0. If not, the model is misspecified.
- Truncate extreme weights (e.g., at 1st and 99th percentiles) and report sensitivity to truncation thresholds.
- The denominator model must include all time-varying confounders; the numerator model includes only baseline covariates and past treatment.
- MSMs estimate a marginal (population-average) causal effect, not a conditional one.
当某个混杂因素同时满足以下条件时,标准回归会失效:
- 受既往治疗影响(例如,药物改变了化验值),并且
- 预测未来 treatment 和 outcome。
调整此类混杂因素会阻断部分治疗效应(过度调整);不作调整则会留下混杂。这就是 treatment-confounder feedback 问题。
解决方案:使用带稳定化 IPTW 的 Marginal Structural Models(MSMs)。
步骤:
- 在每个时间点,根据既往 treatment 和协变量历史估计接受实际 treatment 的概率(权重的分母)。
- 估计仅根据既往 treatment 接受实际 treatment 的概率(分子——稳定化权重)。
- 稳定化权重 = 各时间点(分子 / 分母)的累积乘积。
- 使用这些权重拟合加权 outcome model,例如加权 pooled logistic regression 或加权 Cox model。
MSMs 的规则:
- 稳定化权重的均值应接近 1.0。否则说明模型设定有误。
- 截断极端权重,例如截断至第 1 和第 99 百分位,并报告截断阈值的敏感性。
- 分母模型必须包含所有时变混杂因素;分子模型仅包含基线协变量和既往 treatment。
- MSMs 估计的是边际(人群平均)因果效应,而不是条件效应。
8. Sensitivity Analyses for Unmeasured Confounding
8. 未测量混杂的敏感性分析
No observational study can rule out unmeasured confounding. Quantify its potential impact.
| Method | What it does | When to use |
|---|---|---|
| E-value | Reports the minimum strength of association (on the risk ratio scale) that an unmeasured confounder would need with both treatment and outcome to explain away the observed effect | Always — report alongside primary results |
| Negative control outcomes | Outcomes known to be unaffected by the treatment; a non-null association signals residual bias | Include 3–5 negative controls; if they show associations, the primary result is suspect |
| Negative control exposures | Exposures known to be unrelated to the outcome; test whether the analytic pipeline produces null results for them | Useful for validating the study design |
| Quantitative bias analysis (QBA) | Formally models the impact of a hypothesized unmeasured confounder with specified prevalence and effect sizes | When a specific unmeasured confounder is suspected (e.g., smoking, BMI in claims data) |
Rule: Every pharmacoepidemiology study should report at minimum the E-value and include at least one negative control analysis.
任何观察性研究都无法排除未测量混杂。应量化其潜在影响。
| 方法 | 作用 | 使用场景 |
|---|---|---|
| E-value | 报告在 risk ratio 尺度上,未测量混杂因素需要与 treatment 和 outcome 均达到多强的关联,才能解释观察到的效应 | 始终使用——与主要结果一并报告 |
| Negative control outcomes | 已知不受 treatment 影响的结局;出现非零关联意味着存在残余偏倚 | 纳入 3–5 个 negative controls;如果出现关联,主要结果值得怀疑 |
| Negative control exposures | 已知与 outcome 无关的暴露;用于检验分析流程是否产生零结果 | 用于验证研究设计 |
| Quantitative bias analysis(QBA) | 根据假设的未测量混杂因素及其患病率和效应大小,正式建模其影响 | 当怀疑存在特定未测量混杂因素时,例如 claims data 中的吸烟或 BMI |
**规则:**每项药物流行病学研究至少应报告 E-value,并至少开展一项 negative control 分析。
9. Key Design Decisions Summary Table
9. 关键设计决策汇总表
| Design element | Recommended approach | Red flag |
|---|---|---|
| User type | New (incident) users only | Prevalent users included without justification |
| Comparator | Active comparator (same indication) | Non-users or general population as comparator |
| Time zero | Treatment initiation date | Diagnosis date with treatment starting later |
| Washout | 180–365 days | No washout or < 90 days |
| Covariates | Pre-index only | Post-index covariates in PS model |
| PS balance | SMD < 0.1 for all covariates | Balance not reported or p-values used instead of SMD |
| Follow-up | Starts at index date | Starts before treatment (immortal time) |
| Causal contrast | ITT or per-protocol (explicit) | Undefined or as-treated without censoring weights |
| Sensitivity | E-value + negative controls | No sensitivity analysis for unmeasured confounding |
| 设计要素 | 推荐方法 | 危险信号 |
|---|---|---|
| 用户类型 | 仅纳入 new(incident)users | 未经合理论证即纳入 prevalent users |
| 对照 | Active comparator(相同适应证) | 使用非用药者或普通人群作为对照 |
| Time zero | 治疗启动日期 | 使用诊断日期,但治疗在此后才开始 |
| Washout | 180–365 天 | 没有 washout,或少于 90 天 |
| 协变量 | 仅使用 index date 之前的数据 | PS model 中包含 index date 后的协变量 |
| PS 平衡性 | 所有协变量 SMD < 0.1 | 未报告平衡性,或使用 p 值代替 SMD |
| 随访 | 从 index date 开始 | 在 treatment 前开始随访(immortal time) |
| Causal contrast | 明确定义 ITT 或 per-protocol | 未定义,或使用 as-treated 但未应用 censoring weights |
| 敏感性分析 | E-value + negative controls | 未针对未测量混杂开展敏感性分析 |
10. Intention-to-Treat vs Per-Protocol in Observational Data
10. 观察性数据中的 Intention-to-Treat 与 Per-Protocol
| Contrast | Implementation | Bias concern |
|---|---|---|
| ITT analog | Follow from index date regardless of adherence or switching | Diluted effect if many patients switch or discontinue |
| Per-protocol analog | Censor at treatment discontinuation or switching; use IPCW (inverse probability of censoring weights) to adjust for informative censoring | Informative censoring if sicker patients stop treatment |
Rule: The ITT analog is the default because it avoids informative censoring. Use the per-protocol analog only when the clinical question specifically concerns sustained treatment, and always apply IPCW.
| 对比 | 实施方式 | 偏倚隐患 |
|---|---|---|
| ITT analog | 从 index date 开始随访,无论是否依从或是否换药 | 如果大量患者换药或停药,效应会被稀释 |
| Per-protocol analog | 在停药或换药时进行删失;使用 IPCW(inverse probability of censoring weights)调整信息性删失 | 如果病情较重的患者更常停药,则会产生信息性删失 |
**规则:**ITT analog 是默认选择,因为它可以避免信息性删失。只有当临床问题明确关注持续治疗时才使用 per-protocol analog,并且始终应用 IPCW。
When NOT to Use This Skill
不应使用此 skill 的情况
- Replacing pre-specified statistical analysis plans (needs biostatistician sign-off)
- When unmeasured confounding is the primary concern and no negative controls exist
- Individual patient risk-benefit decisions (clinical medicine, not epidemiology)
- 替代预先指定的统计分析计划(需要生物统计学家审核签字)
- 未测量混杂是主要问题,且不存在 negative controls
- 个体患者的风险收益决策(属于临床医学,而非流行病学)
When to Escalate to a Human Expert
需要升级给人类专家的情况
- When study results will be submitted to regulatory agencies as RWE
- When E-value suggests unmeasured confounding could explain the entire effect
- When the target trial protocol requires clinical input on eligibility criteria
- 研究结果将作为 RWE 提交给监管机构
- E-value 表明未测量混杂可能解释整个效应
- Target trial protocol 的 eligibility criteria 需要临床专业意见
Common Mistakes
常见错误
-
Wrong: Including prevalent users in the study cohort Right: Always require a 180–365 day washout period and restrict to new initiators Why: Depletion of susceptibles biases toward a protective effect
-
Wrong: Comparing drug users to non-users Right: Use an active comparator with the same indication Why: Confounding by indication is nearly impossible to fully adjust for without an active comparator
-
Wrong: Starting follow-up before treatment initiation (immortal time) Right: Use the new-user design (time zero = treatment start) or a landmark analysis Why: The treated group gets "free" survival time, inflating apparent benefit
-
Wrong: Including post-index covariates in the propensity score model Right: Only include covariates measured before the index date in the PS model Why: Post-index variables may be mediators or colliders, introducing bias
-
Wrong: Using p-values to assess covariate balance after PS adjustment Right: Use standardized mean differences (SMD) with a threshold of < 0.1 Why: P-values depend on sample size and can show "balance" in large samples despite meaningful differences
-
Wrong: Ignoring extreme propensity score weights Right: Truncate weights at the 1st/99th percentile and report sensitivity to truncation Why: A single patient with weight 500 can dominate the entire analysis
-
Wrong: Adjusting for time-varying confounders in a standard Cox model Right: Use marginal structural models with stabilized IPTW when confounders are affected by prior treatment Why: Standard adjustment blocks part of the causal pathway when treatment-confounder feedback exists
-
Wrong: Omitting sensitivity analyses for unmeasured confounding Right: Always report the E-value and run at least one negative control analysis Why: Claims data lack BMI, smoking, lab values, and socioeconomic detail that may confound results
-
Wrong: Running "as-treated" analyses without defining the causal contrast Right: Explicitly specify ITT or per-protocol estimand and apply censoring weights for per-protocol Why: Ambiguous estimands produce uninterpretable results
-
Wrong: Defining exposure based on cumulative dose over follow-up or "ever-use" Right: Define exposure at time zero; do not condition on future behavior or survival Why: Conditioning on the future introduces selection bias
-
Wrong: Ignoring the positivity assumption Right: Check PS overlap and trim non-overlapping regions where one treatment has near-zero probability Why: PS methods break down in strata with no treatment variation
-
Wrong: Using a single PS method without sensitivity analysis Right: Run at least two approaches (e.g., matching + IPTW) and compare results Why: Discordant results signal model sensitivity and fragile conclusions
-
Wrong: Failing to pre-specify the analysis plan Right: Register the protocol or document outcome definitions, subgroups, and model choices before data analysis Why: Post-hoc choices inflate false-positive rates
-
Wrong: Reporting observational associations as causal without the target trial framework Right: Explicitly map every study to a hypothetical target trial to reveal hidden assumptions Why: Unmapped assumptions lead to structural biases that no statistical method can fix
-
**错误:**将 prevalent users 纳入研究队列 **正确:**始终要求 180–365 天的 washout period,并将研究对象限制为新起始用药者 **原因:**Depletion of susceptibles 会使结果偏向保护性效应
-
**错误:**将药物使用者与非使用者进行比较 **正确:**使用具有相同适应证的 active comparator **原因:**如果没有 active comparator,几乎无法完全调整 confounding by indication
-
**错误:**在治疗启动前开始随访(immortal time) **正确:**使用 new-user design(time zero = 治疗开始时间)或 landmark analysis **原因:**治疗组会获得「免费」的生存时间,从而夸大表面获益
-
**错误:**在 propensity score 模型中纳入 index date 后的协变量 **正确:**PS model 中仅纳入 index date 前测量的协变量 **原因:**Index date 后的变量可能是 mediator 或 collider,从而引入偏倚
-
**错误:**使用 p 值评估 PS 调整后的协变量平衡性 **正确:**使用 standardized mean differences(SMD),阈值为 < 0.1 **原因:**p 值取决于样本量,即使大样本中存在有意义的差异,也可能显示「平衡」
-
**错误:**忽略极端 propensity score 权重 **正确:**将权重截断至第 1/99 百分位,并报告截断的敏感性 **原因:**单个权重为 500 的患者就可能主导整个分析
-
**错误:**在标准 Cox model 中调整时变混杂因素 **正确:**当混杂因素受既往治疗影响时,使用带稳定化 IPTW 的 marginal structural models **原因:**在存在 treatment-confounder feedback 时,标准调整会阻断部分因果路径
-
**错误:**省略针对未测量混杂的敏感性分析 **正确:**始终报告 E-value,并至少开展一项 negative control 分析 **原因:**Claims data 缺少 BMI、吸烟、化验值和社会经济特征等潜在混杂信息
-
**错误:**在未定义 causal contrast 的情况下开展 as-treated 分析 **正确:**明确指定 ITT 或 per-protocol estimand,并在 per-protocol 分析中应用 censoring weights **原因:**模糊的 estimand 会产生无法解释的结果
-
**错误:**根据随访期间的累积剂量或「ever-use」定义暴露 **正确:**在 time zero 定义暴露;不要以未来行为或生存为条件 **原因:**以未来信息为条件会引入选择偏倚
-
**错误:**忽略 positivity assumption **正确:**检查 PS overlap,并剔除某一 treatment 概率接近零的非重叠区域 **原因:**在 treatment 无变异的分层中,PS 方法会失效
-
**错误:**只使用一种 PS 方法而不开展敏感性分析 **正确:**至少采用两种方法(例如 matching + IPTW)并比较结果 **原因:**结果不一致意味着模型敏感,结论较为脆弱
-
**错误:**未预先指定分析计划 **正确:**注册 protocol,或在数据分析前记录结局定义亚组及模型选择 **原因:**事后选择会提高假阳性率
-
**错误:**未使用 target trial 框架就将观察性关联报告为因果关系 **正确:**明确将每项研究映射到一项假想 target trial,以揭示隐藏的假设 **原因:**未映射的假设会导致结构性偏倚,而任何统计方法都无法修复
References
参考文献
- Hernán MA, Robins JM. Causal Inference: What If. Chapman & Hall/CRC 2020, https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/
- Hernán MA, Alonso A, Logan R et al. Observational studies analyzed like randomized experiments: an application to postmenopausal hormone therapy and coronary heart disease. Epidemiology 2008, https://doi.org/10.1097/EDE.0b013e3181875e61
- Lund JL, Richardson DB, Stürmer T. The active comparator, new user study design in pharmacoepidemiology. Epidemiology 2015, https://doi.org/10.1097/EDE.0000000000000231
- Suissa S. Immortal time bias in pharmacoepidemiology. Am J Epidemiol 2008, https://doi.org/10.1093/aje/kwn138
- Robins JM, Hernán MA, Brumback B. Marginal structural models and causal inference in epidemiology. Epidemiology 2000, https://doi.org/10.1097/00001648-200009000-00011
- VanderWeele TJ, Ding P. Sensitivity analysis in observational research: introducing the E-value. Ann Intern Med 2017, https://doi.org/10.7326/M16-2607
- Austin PC. An introduction to propensity score methods for reducing the effects of confounding in observational studies. Multivariate Behav Res 2011, https://doi.org/10.1080/00273171.2011.568786
- Lipsitch M, Tchetgen Tchetgen E, Cohen T. Negative controls: a tool for detecting confounding and bias in observational studies. Epidemiology 2010, https://doi.org/10.1097/EDE.0b013e3181d61eeb
- Hernán MA, Robins JM. Causal Inference: What If. Chapman & Hall/CRC 2020, https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/
- Hernán MA, Alonso A, Logan R et al. Observational studies analyzed like randomized experiments: an application to postmenopausal hormone therapy and coronary heart disease. Epidemiology 2008, https://doi.org/10.1097/EDE.0b013e3181875e61
- Lund JL, Richardson DB, Stürmer T. The active comparator, new user study design in pharmacoepidemiology. Epidemiology 2015, https://doi.org/10.1097/EDE.0000000000000231
- Suissa S. Immortal time bias in pharmacoepidemiology. Am J Epidemiol 2008, https://doi.org/10.1093/aje/kwn138
- Robins JM, Hernán MA, Brumback B. Marginal structural models and causal inference in epidemiology. Epidemiology 2000, https://doi.org/10.1097/00001648-200009000-00011
- VanderWeele TJ, Ding P. Sensitivity analysis in observational research: introducing the E-value. Ann Intern Med 2017, https://doi.org/10.7326/M16-2607
- Austin PC. An introduction to propensity score methods for reducing the effects of confounding in observational studies. Multivariate Behav Res 2011, https://doi.org/10.1080/00273171.2011.568786
- Lipsitch M, Tchetgen Tchetgen E, Cohen T. Negative controls: a tool for detecting confounding and bias in observational studies. Epidemiology 2010, https://doi.org/10.1097/EDE.0b013e3181d61eeb