Posts

Showing posts from September, 2025

Analysis of Repeated Measures Data using SAS (1)

Image
  SAS code 1:  proc mixed data=yy method=reml;    where param="xxx"; class USUBJID treatment AVISITN timepoint;       model CHG =          BASE         treatment          AVISITN          timepoint          treatment*AVISITN         treatment*timepoint         AVISITN*timepoint         treatment*AVISITN*timepoint         / solution ddfm=kr;      repeated Timepoint / subject=USUBJID*AVISITN  type=un;     lsmeans treatment*AVISITN*timepoint / cl; run; SAS code 2: proc mixed data=yy method=reml; where param="xxx";  class USUBJID treatment AVISITN timepoint;       model CHG =          BASE         treatment          AVISITN    ...

Making Apples-to-Apples Comparisons Between Internal and External Studies Using Propensity Scores (3)

Image
  Introduction to Causal Inference: Causal methods: aim to manipulate data so that it mimics (emulates) data from randomized trials. Reference: 1. https://share.google/FDCYnFXhuE8PtHxE1 2. https://support.sas.com/documentation/onlinedoc/stat/142/psmatch.pdf

Making Apples-to-Apples Comparisons Between Internal and External Studies Using Propensity Scores (3)

Image
  Examples using SAS: SAS code 1: title 'PSMATCH: ATT Weighting'; proc psmatch data=t1 region=treated; class trt genotype; psmodel trt(Treated='study treatment')= b_age genotype b_var; where vsn=0; assess lps var=(b_age genotype b_var)/ weight=attwgt; output out(OBS=region)=Outex; run; SAS code 2: title 'PSMATCH: ATT Weighting'; proc psmatch data=t1 region=allobs(psmin=0.05 psmax=0.95); class trt genotype; psmodel trt(Treated='study treatment')= b_age genotype b_var; where vsn=0; assess lps var=(b_age genotype b_var)/ weight=attwgt; output out(OBS=region)=Outex1; Aspect region=treated region=allobs(psmin=0.05 psmax=0.95) Who gets dropped Controls outside treated PS range Both groups outside [0.05,0.95] Treated retention All treated kept Some treated may be dropped Target estimand ATT in full treated population ATT in trimmed treated population Weight stability / ESS Potentially lower ESS (more extreme weights) Typically highe...

Making Apples-to-Apples Comparisons Between Internal and External Studies Using Propensity Scores (2)

Image
  Propensity Score Weighting Method 1. What Is Propensity Score Weighting? Propensity score weighting  is a method used to  adjust for confounding  in observational studies or non-randomized comparisons (like  external control arms ) to create a "pseudo-population" in which treatment groups are  comparable  on baseline covariates. 🔑 The  propensity score (PS)  is defined as: e ( x ) = P ( T = 1 ∣ X = x ),  which is the probability of the treatment assignment conditional   on the set of confounding  variables X         where: T  is the treatment indicator (1 = treated, 0 = control) X  is a vector of observed baseline covariates 2. Why Use Weighting Instead of Matching or Stratification? Method Goal Use Case Matching       Select similar individuals                         Small sample studies, causal inference Stra...

Making Apples-to-Apples Comparisons Between Internal and External Studies Using Propensity Scores (1)

Image
  Propensity score analysis attempts to replicate the properties of a randomized trial with respect to the observed variables X . The following three methods are commonly used in propensity score analysis:  weighting, which creates weights that are appropriate for estimating the ATE and ATT  stratification, which creates strata based on propensity scores  matching, which matches treated units with control units. A propensity score analysis usually involves the following steps (Guo and Fraser 2015, p. 131): 1. You specify a set of confounding variables that might be related to both the treatment assignment and the outcome. 2. You use this set of variables to fit a logistic regression model and compute propensity scores. The response is the probability of assignment to the treated group. 3. You choose a propensity method (weighting, stratification, or matching) to compute observation weights (weighting), to construct strata of observations (stratification), or to ...

Covariate Selection in Clinical Trials: A Guide to Best Practices

Image
 When selecting covariates for analysis in a clinical trial, it's important to follow established guidelines to ensure the validity and reliability of your results. The process involves both clinical and statistical considerations, with a strong emphasis on pre-specification to avoid bias. Key Principles for Selecting Covariates Prior Knowledge and Prognostic Value : Select covariates that are known or expected to be strongly associated with the primary outcome based on existing scientific literature, data from previous trials (e.g., Phase 2), or strong clinical rationale. These are known as prognostic covariates. A classic example is using a patient's baseline blood pressure as a covariate when studying a new blood pressure medication. Pre-specification is Essential : The most critical rule is to prospectively specify the covariates and the adjustment method in the study protocol before any comparative data is unblinded. This prevents the biased "data-dependent" sel...