Why Treatment Weights Accumulate
In longitudinal studies, treatment may be assigned repeatedly. At each decision time, the probability of the treatment actually received can depend on the subject’s observed history up to that time. The contribution from one decision is therefore only one part of the subject’s treatment weight; the contributions across all eligible decisions must be accumulated.
The calculation is simple in principle but easy to misapply. One must use the conditional probability corresponding to the treatment that was actually observed, use the correct probability at each time, and keep enough numerical precision while multiplying. This tutorial focuses on those calculations and their checks. Computing a weight does not, by itself, establish that a causal effect is identified or that a treatment-probability model is adequate.
For binary treatment, if a subject received treatment, the relevant probability is the model probability of treatment; if the subject did not receive treatment, it is the probability of no treatment. For a treatment with more than two categories, use the probability assigned to the category actually received. In every case the denominator is a probability, not an odds, a risk ratio, or the probability of a different treatment category.
The calculation presumes that every included decision has an observed treatment and a corresponding conditional probability in the table or fitted model. For a finite weight, each used probability must satisfy \(0<p_{it}\leq 1\). A probability of zero makes the reciprocal undefined; it cannot be repaired by multiplying the other time-specific probabilities. These are calculation conditions, not a guarantee that the causal assumptions required for an analysis hold.
Three Equivalent Ways to Calculate the Product
A probability table typically has one row per subject and one column per decision time. Its entries for the weight calculation should be the conditional probabilities of each subject’s observed treatment at those times. If a table instead gives probabilities for every possible treatment category, select the observed category in each column before multiplying.
The direct product is the definition. A recursive calculation keeps a running weight, and a log calculation turns the product into a sum. The two latter approaches are useful checks and can be more convenient when there are many decisions.
Proof. By the definition of the product, \(W_i(t)=\left(\prod_{s=1}^{t-1}1/p_{is}\right)(1/p_{it})\). The product over \(s=1,\ldots,t-1\) is \(W_i(t-1)\), which gives the recursive identity. Since each \(p_{it}>0\), logarithms are defined, and the logarithm of a finite product is the sum of the logarithms of its factors: \(\log W_i(K_i)=\sum_{t=1}^{K_i}\log(1/p_{it})=-\sum_{t=1}^{K_i}\log p_{it}\). \(\square\)
Because each probability is at most one, each reciprocal is at least one. Thus the running unstabilized weight cannot decrease as additional eligible decisions are included. It stays unchanged at a decision only if the observed-treatment probability is one. This property is a useful arithmetic check, but it does not imply that weights will be similar across subjects.
Worked Example: Four Decisions for Three Subjects
Suppose the entries below are the fitted conditional probabilities of the treatment actually received by each subject at each of four eligible decisions. Calculate each subject’s cumulative weight.
| Subject | \(p_{i1}\) | \(p_{i2}\) | \(p_{i3}\) | \(p_{i4}\) |
|---|---|---|---|---|
| A | 0.80 | 0.60 | 0.75 | 0.50 |
| B | 0.70 | 0.80 | 0.40 | 0.90 |
| C | 0.50 | 0.50 | 0.50 | 0.50 |
For subject A, the probability product is \(0.80(0.60)(0.75)(0.50)=0.18\), so the exact cumulative weight is \(1/0.18=5.555555\ldots\), or 5.5556 to four decimal places. The recursive values, calculated from unrounded values and then displayed to four decimal places, are \(W_A(1)=1/0.80=1.25\), \(W_A(2)=1/(0.80\cdot0.60)=2.0833\), \(W_A(3)=1/(0.80\cdot0.60\cdot0.75)=2.7778\), and \(W_A(4)=1/(0.80\cdot0.60\cdot0.75\cdot0.50)=5.5556\). Each update divides the unrounded preceding value by the next probability; rounding is only for display.
For subject B, \(0.70(0.80)=0.56\), \(0.56(0.40)=0.224\), and \(0.224(0.90)=0.2016\). Therefore \(W_B(4)=1/0.2016=4.960317\ldots\), or 4.9603 to four decimal places.
For subject C, \(0.50^4=0.0625\), so \(W_C(4)=1/0.0625=16\). In all three rows the weights are at least one, as expected because each probability is at most one.
Checks That Become Useful Over Many Decisions
With many decisions, direct multiplication can be awkward, particularly when the product is small. The log identity gives an independent way to check the calculation. It is essential to distinguish the sum of rounded log terms from the sum computed using full precision: rounding each term can make the displayed sum differ slightly from the unrounded sum.
Worked Example: A Six-Decision Log-Scale Check
A subject’s six observed-treatment probabilities are \(0.80, 0.75, 0.50, 0.90, 0.40,\) and \(0.60\). First calculate the direct product: \(0.80(0.75)=0.60\), \(0.60(0.50)=0.30\), \(0.30(0.90)=0.27\), \(0.27(0.40)=0.108\), and \(0.108(0.60)=0.0648\). Hence the cumulative weight is \(1/0.0648=15.432098\ldots\), or 15.4321 to four decimal places.
For the log check, the negative log terms, rounded individually to six decimal places, are \(0.223144, 0.287682, 0.693147, 0.105361, 0.916291,\) and \(0.510826\). Their displayed rounded sum is \(2.736451\). Using full precision instead, the sum is \(-\log(0.0648)=2.7364496758\ldots\), or 2.736450 to six decimal places. Exponentiating the unrounded sum gives \(e^{2.7364496758\ldots}=15.432098\ldots\), agreeing with the direct calculation. The small difference between the two displayed sums comes from rounding the separate terms.
For routine checking, compare the direct product with the log result or with the recursive updates. The methods should agree up to the displayed precision. If they do not, recheck the selected treatment category, the time order, the number of included decisions, and whether a rounded intermediate value was mistakenly reused.
Worked Example: Updating a Weight One Decision at a Time
A subject has observed-treatment probabilities \(0.90, 0.80, 0.50, 0.75,\) and \(0.40\) at five eligible decisions. Show the running calculation and the final product check.
Start with \(W(0)=1\). At the first decision, \(W(1)=1/0.90=1.111111\ldots\). At the second, \(W(2)=W(1)/0.80=1/(0.90\cdot0.80)=1.388888\ldots\). At the third, \(W(3)=W(2)/0.50=1/(0.90\cdot0.80\cdot0.50)=2.777777\ldots\).
At the fourth decision, \(W(4)=W(3)/0.75=1/(0.90\cdot0.80\cdot0.50\cdot0.75)=3.703703\ldots\). At the fifth, \(W(5)=W(4)/0.40=1/(0.90\cdot0.80\cdot0.50\cdot0.75\cdot0.40)\). The probability product is \(0.90(0.80)=0.72\), \(0.72(0.50)=0.36\), \(0.36(0.75)=0.27\), and \(0.27(0.40)=0.108\). Thus \(W(5)=1/0.108=9.259259\ldots\). The recursive and direct calculations agree when the recursion uses unrounded values.
What the Product Represents—and What It Does Not
At each decision, the treatment-probability model contributes the conditional probability of the observed treatment given the history available at that decision. Multiplying these contributions gives the treatment-mechanism likelihood contribution along the observed sequence of histories. The cumulative weight is its reciprocal. This is a sequential calculation: it does not mean that one should replace the time-specific probabilities with a single marginal probability of the entire treatment history.
In a causal analysis, inverse probability weighting uses these contributions to reweight observations. The calculation above is specifically for the unstabilized treatment weight. Later topics distinguish other weight constructions and their roles; they should not be silently substituted into this product. Nor does a large or small weight alone prove that the treatment-probability model is correct or incorrect.
Common Calculation Errors and Diagnostics
- Using the wrong treatment probability. A table may show probabilities for every treatment category. Select the probability for the treatment actually received at that time, not automatically the probability of treatment or the largest entry.
- Multiplying probabilities instead of taking the reciprocal. The cumulative weight is the reciprocal of the product. Since \(0<p_{it}\leq1\), a finite unstabilized weight cannot be below one.
- Dropping or duplicating a decision. Confirm that every eligible decision appears exactly once and in the correct order. A missing table entry is not a probability of one.
- Rounding at each update. Early rounding can alter later displayed values. Keep full precision in computation and round only the reported results; if hand-calculating with rounded values, state that convention and expect a small discrepancy from the full-precision product.
- Ignoring a very small probability. A small positive probability has a large reciprocal contribution, so it can make the cumulative weight large. Verify the entry and the model output rather than treating the large value as an arithmetic error by default.
- Treating a zero probability as an ordinary input. Its reciprocal is undefined. The product cannot be calculated as a finite weight for that observed treatment path, and the underlying probability-model or support issue needs investigation.
A practical diagnostic is to inspect the time-specific probabilities before looking only at the final weights. Check that they are probabilities, that they refer to the correct observed treatments and eligible times, and that none is zero or missing. Then compare a few subject-level products with recursive or log calculations. A mismatch often reveals a table-alignment or rounding error; an unusually large value may instead be the mathematically correct consequence of a small conditional probability.
Check Your Understanding
Work each problem first, then compare your result with the solutions below.
- A subject’s observed-treatment probabilities at three decisions are \(0.50, 0.80,\) and \(0.40\). Find the probability product and cumulative weight.
- For four decisions, the observed-treatment probabilities are \(0.90, 0.70, 0.25,\) and \(0.80\). Calculate the final cumulative weight.
- Explain why a treatment-probability table must be read using the observed treatment category at each time rather than using the same category’s probability at every time.
- If \(W_i(t-1)=4\) and the next observed-treatment probability is \(0.50\), calculate \(W_i(t)\). State whether this update can decrease the running weight when probabilities are valid.
Solutions. (1) The product is \(0.50(0.80)(0.40)=0.16\), so the weight is \(1/0.16=6.25\). (2) The product is \(0.90(0.70)=0.63\), \(0.63(0.25)=0.1575\), and \(0.1575(0.80)=0.126\); the weight is \(1/0.126=7.936507\ldots\), or 7.9365 to four decimal places. (3) The weight uses the probability assigned to the treatment actually received at each decision; the observed category can differ over time, and the conditional probabilities can depend on the history at each time. (4) The update is \(4/0.50=8\). For a valid probability \(p\leq1\), division by \(p\) cannot decrease the running weight.