Tutorials › Marginal Structural Models › A Longitudinal Clipping Threshold Worked Example

Weight Stabilization and Truncation · Tutorial 160 of 501

A Longitudinal Clipping Threshold Worked Example

Work through cumulative stabilized weights and compare treatment-effect estimates under cumulative and period-specific clipping.

Advanced 11 min read

What You'll Learn

  • Calculate two-period stabilized weights from numerator and denominator probabilities.
  • Apply upper-cap and two-sided clipping rules to cumulative weights.
  • Compute Hájek treatment-arm means and their contrast from weighted outcome totals.
  • Distinguish clipping cumulative weights from clipping each period-specific factor.
  • Check weighted estimates for sensitivity to threshold choice and arithmetic rounding.

From Longitudinal Weights to a Treatment Contrast

With longitudinal treatment, a participant’s cumulative stabilized weight is the product of the period-specific numerator-to-denominator probability ratios for their observed treatment history. A clipping rule then transforms that cumulative weight before the weighted outcome analysis. The arithmetic can be simple while the analysis choice is consequential: clipping each period’s factor is not generally the same as clipping the cumulative product.

Consider a two-period study with binary treatment \(A_{it}\), time-varying covariates \(L_{it}\), and a final outcome \(Y_i\). For an observed treatment history, let the numerator probability at time \(t\) be the probability of the observed treatment given prior treatment, and let the denominator probability additionally condition on the measured covariate history. The stabilized cumulative weight through period 2 is

$$ SW_i=\prod_{t=1}^{2} \frac{P(A_{it}\mid \bar A_{i,t-1})} {P(A_{it}\mid \bar A_{i,t-1},\bar L_{it})}. $$

This weight is used to reduce the measured treatment-confounder associations in the weighted data. A causal interpretation of a weighted contrast requires, among other conditions, consistency, sequential exchangeability given the measured histories, and positivity: each treatment choice relevant to the comparison must have positive probability within the histories being compared. Correctly specified probability models are also needed when the probabilities are estimated. Clipping does not repair violations of these conditions.

Definition: For lower and upper thresholds \(L\) and \(U\), with \(0<L\leq U<\infty\), two-sided clipping of a cumulative weight is \(SW_i^{(L,U)}=\min\{U,\max(L,SW_i)\}\). Upper clipping alone at \(U\) is \(SW_i^{(U)}=\min(U,SW_i)\). These are transformations of the weight, not changes to the treatment history or outcome.

For a binary treatment regime indicator \(G_i\), define the weighted Hájek mean within group \(g\) by dividing the weighted outcome total by the total weight in that group. The estimated contrast compares the two group-specific means. In a longitudinal analysis, \(G_i\) could identify participants following the all-treated or all-untreated history in a small illustration; a full marginal structural model can instead use all observed histories and model treatment history.

$$ \hat\mu_g^w= \frac{\sum_{i:G_i=g}w_iY_i}{\sum_{i:G_i=g}w_i}, \qquad \hat\Delta^w=\hat\mu_1^w-\hat\mu_0^w. $$

Worked Example: Calculating and Capping Cumulative Weights

Worked Example: Calculating and Capping Cumulative Weights

Suppose three participants follow the all-treated history and three follow the all-untreated history. For each participant, the numerator probability of their observed action is \(0.5\) at both periods. The table gives the two denominator probabilities of that observed action, the resulting period-specific ratios, and the final outcome.

GroupDenominator probabilities, periods 1 and 2Ratio factors\(Y_i\)
All-treated0.50, 0.501, 12
All-treated0.50, 0.251, 25
All-treated0.25, 0.252, 28
All-untreated0.50, 0.501, 11
All-untreated0.50, 0.251, 22
All-untreated0.25, 0.252, 23

For example, the second participant’s period-1 ratio is \(0.5/0.5=1\), and the period-2 ratio is \(0.5/0.25=2\). Their cumulative weight is \(1\times2=2\). The three cumulative weights in each group are therefore \(1,2,4\).

With no clipping, the all-treated weighted outcome total is \(1(2)+2(5)+4(8)=44\), and its total weight is \(1+2+4=7\). Thus \(\hat\mu_1^w=44/7\approx6.286\). For the all-untreated group, the outcome total is \(1(1)+2(2)+4(3)=17\), so \(\hat\mu_0^w=17/7\approx2.429\). The contrast is \(44/7-17/7=27/7\approx3.857\).

Now cap cumulative weights at \(U=2\). Each group’s weights become \(1,2,2\). The treated mean is \(\{1(2)+2(5)+2(8)\}/5=28/5=5.6\); the untreated mean is \(\{1(1)+2(2)+2(3)\}/5=11/5=2.2\). The clipped contrast is \(5.6-2.2=3.4\). This is a different weighted estimate, not merely a more numerically stable calculation of the original estimate.

What a Clipped Hájek Mean Guarantees

Two elementary properties help check calculations and clarify what clipping does—and does not—guarantee.

Result: If all weights in a group are positive and the group contains at least one participant, its Hájek mean is unchanged when all its weights are multiplied by the same positive constant.

Proof. Let the original weights be \(w_i>0\) and let \(c>0\). The mean computed with weights \(cw_i\) is

$$ \frac{\sum_i cw_iY_i}{\sum_i cw_i} = \frac{c\sum_i w_iY_i}{c\sum_i w_i} = \frac{\sum_i w_iY_i}{\sum_i w_i}. $$

The denominator is positive because the group is nonempty and its weights are positive. Thus a common rescaling within an arm changes neither its mean nor the contrast if each arm is rescaled separately. It does not follow that changing the relative weights within an arm leaves the estimate unchanged. Clipping usually changes those relative weights. \(\square\)

Result: For positive weights, the Hájek mean lies between the smallest and largest observed outcomes in its group.

Proof. Write \(W=\sum_i w_i>0\) and \(\alpha_i=w_i/W\). Then each \(\alpha_i\geq0\), \(\sum_i\alpha_i=1\), and \(\hat\mu^w=\sum_i\alpha_iY_i\). If \(m=\min_iY_i\) and \(M=\max_iY_i\), then \(m\leq Y_i\leq M\) for every \(i\). Multiplying each inequality by \(\alpha_i\) and summing gives \(m\sum_i\alpha_i\leq\hat\mu^w\leq M\sum_i\alpha_i\), hence \(m\leq\hat\mu^w\leq M\). The argument applies to clipped weights too, provided the resulting weights remain positive. \(\square\)

Worked Example: Two Threshold Choices

Worked Example: Two Threshold Choices

Return to the six participants and use two-sided clipping with \(L=1.5\) and \(U=3\). Each group’s cumulative weights \(1,2,4\) become \(1.5,2,3\). The treated total weight is \(1.5+2+3=6.5\), and its weighted outcome total is \(1.5(2)+2(5)+3(8)=37\). The untreated total weight is also \(6.5\); its outcome total is \(1.5(1)+2(2)+3(3)=14.5\).

The means are \(37/6.5\approx5.6923\) and \(14.5/6.5\approx2.2308\). The contrast, calculated before rounding the means, is \((37-14.5)/6.5=22.5/6.5\approx3.4615\). Compared with the upper-cap contrast of \(3.4\), this two-sided rule produces a different result: it raises the smallest weights as well as lowering the largest one.

This example also shows why a clipping rule must be stated precisely. “Clip at 2” could mean an upper cap at 2, a lower-and-upper interval with one endpoint at 2, or a rule applied at each period. Those choices need not yield the same weights or estimate.

Worked Example: Cumulative Versus Period-Specific Clipping

Worked Example: Cumulative Versus Period-Specific Clipping

In the table, the period-specific ratio factors are \(1,1\), \(1,2\), and \(2,2\). Suppose each factor is capped at \(1.5\) before multiplication. The cumulative weights then become \(1\times1=1\), \(1\times1.5=1.5\), and \(1.5\times1.5=2.25\). In contrast, capping the cumulative weights at 2 gives \(1,2,2\).

Under period-specific clipping, each group’s total weight is \(1+1.5+2.25=4.75\). The treated outcome total is \(1(2)+1.5(5)+2.25(8)=27.5\), and the untreated outcome total is \(1(1)+1.5(2)+2.25(3)=10.75\). Thus the means are \(27.5/4.75\approx5.7895\) and \(10.75/4.75\approx2.2632\), and the contrast is \((27.5-10.75)/4.75=16.75/4.75\approx3.5263\).

The two clipping procedures differ because multiplying capped period-specific factors can still produce a cumulative weight above the period-specific cap. In general, clipping and multiplication do not commute: \(\prod_t\min(U,r_{it})\) need not equal \(\min(U,\prod_t r_{it})\). A reproducible analysis must say which quantity is clipped and at what stage.

Worked Example: Checking Rounded Weighted Contrasts

Worked Example: Checking Rounded Weighted Contrasts

Suppose two analyses report weighted totals as sufficient summaries: the first has treated outcome total \(37.6\) and treated weight total \(4.9\), with corresponding untreated totals \(13.7\) and \(3.3\). The unrounded arm means are \(37.6/4.9\approx7.673469\) and \(13.7/3.3\approx4.151515\). The contrast from these unrounded quantities is

$$ \frac{37.6}{4.9}-\frac{13.7}{3.3} \approx 3.52195 \approx 3.522. $$

If instead one subtracts the displayed rounded means, \(7.673-4.152=3.521\). The one-thousandth difference is due to rounding the means before subtraction; it is not the contrast calculated from the unrounded totals.

For a second set of reported totals, the treated quantities are \(47\) and \(6\), and the untreated quantities are \(16.8\) and \(4.1\). The unrounded contrast is

$$ \frac{47}{6}-\frac{16.8}{4.1} \approx 7.833333-4.097561 \approx 3.73577 \approx 3.736. $$

But subtracting the rounded means gives \(7.833-4.098=3.735\). For reporting, calculate the contrast from unrounded arm estimates and round only the final contrast. These totals illustrate the arithmetic check; interpreting an estimate still requires knowing which weights and clipping rule produced them.

Diagnostics, Alternatives, and Limitations

A threshold comparison should be treated as a diagnostic, not as a search for the most favorable estimate. At minimum, inspect the distribution of cumulative weights before and after clipping, the number and fraction of observations affected, the total weight in each treatment group, and the weighted covariate balance after the transformation. Large changes in group means or contrasts across plausible thresholds indicate sensitivity to the rule. A small contrast change alone is not proof that the causal assumptions hold.

The main alternative to clipping is to retain the estimated weights as they are, accepting potentially high variance when a few observations carry substantial weight. Weight stabilization can reduce variability and improve scale, but it does not guarantee bounded weights. Trimming observations is another distinct choice: it removes participants rather than retaining them with modified weights, and therefore can change the population represented by the analysis. A model-based outcome analysis uses different modeling assumptions and is not equivalent to clipping inverse-probability weights.

Fixed clipping can introduce bias because it changes the relative contribution of participants. A threshold that bounds influence may reduce variance, but the resulting estimate need not target exactly the same weighted estimating equation as the unclipped analysis. Nor does any threshold automatically solve poor positivity: if certain histories have near-zero treatment probability, clipping may conceal the resulting instability without supplying information about the unsupported histories. Compare prespecified, substantively plausible rules and report the sensitivity rather than presenting one threshold as universally correct.

Common Mistakes

  • Clipping the wrong quantity. Capping each period’s ratio and then multiplying is not generally the same as multiplying first and capping the cumulative weight.
  • Assuming that a smaller maximum weight guarantees a better estimate. Clipping can lower variance while changing the relative weights and introducing bias.
  • Subtracting already-rounded means. This can give a contrast that differs in the last reported digit from the estimate computed from unrounded quantities.
  • Interpreting stabilization as protection against positivity failure. Stabilization changes the numerator of the weight; it does not create observations in histories with little or no treatment support.

Check Your Understanding

Try each question, then check the worked solutions below.

  1. If a participant’s two period-specific stabilized ratios are \(1.2\) and \(2.5\), what is the cumulative weight before clipping? What is the cumulative weight after an upper cap of 2?
  2. In one treatment group, outcomes are \(2\) and \(8\), with positive weights \(3\) and \(1\). Calculate the Hájek mean and verify that it lies between the two outcomes.
  3. Why can multiplying every weight in one treatment group by 10 leave its Hájek mean unchanged, while clipping its weights can change that mean?
  4. Using the totals \(47/6\) and \(16.8/4.1\), give the contrast rounded to three decimal places, and explain why subtracting the separately rounded means gives a different last digit.

Solutions. (1) The cumulative weight is \(1.2(2.5)=3\); after the upper cap it is \(\min(2,3)=2\). (2) The mean is \(\{3(2)+1(8)\}/(3+1)=14/4=3.5\), which is between 2 and 8. (3) Multiplication by 10 cancels between numerator and denominator of the ratio defining the mean. Clipping generally changes some weights by different amounts, so their relative shares in that ratio change. (4) The contrast is \(47/6-16.8/4.1\approx3.73577\), which rounds to \(3.736\). The separately rounded means are \(7.833\) and \(4.098\), whose difference is \(3.735\); rounding before subtraction accounts for the discrepancy.

Clinical Biostats