Tutorials › Marginal Structural Models › Continuous-Treatment Weights as Conditional Density Ratios

Inverse Probability of Treatment Weights · Tutorial 100 of 501

Continuous-Treatment Weights as Conditional Density Ratios

Learn how density-ratio weights reweight continuous treatment assignments, what support conditions they require, and how to interpret and diagnose them.

Advanced 11 min read

What You'll Learn

  • Define stabilized weights for continuous treatment using numerator and denominator densities
  • Distinguish a density value from the probability of an exact treatment value
  • Derive the reweighted treatment distribution and its expectation identity
  • Extend density-ratio weights to sequential treatment histories
  • Check support, weight tails, and weighted covariate balance
  • Compare density-ratio weighting with discrete weights and outcome modeling

Why Continuous Treatments Require Densities

For a binary treatment, an inverse probability weight uses the probability of the treatment actually received. For a continuous dose, such as a drug concentration or treatment intensity, the probability of receiving exactly the observed value is generally zero. The relevant quantity is instead the density of the observed dose, evaluated at that dose. A continuous-treatment weight is a ratio of two such densities.

The numerator describes the treatment distribution targeted by the analysis; the denominator describes how treatment was assigned given the observed history. Their ratio changes the relative contribution of observations so that the weighted treatment distribution follows the numerator distribution rather than the conditional assignment distribution.

Definition: Let \(A\) be a continuous treatment and \(L\) a set of measured covariates. Write \(g(a\mid l)\) for the conditional density of \(A\) given \(L=l\), with respect to Lebesgue measure. Let \(q(a)\) be a target treatment density. The density-ratio weight is $$ W=\frac{q(A)}{g(A\mid L)}. $$ The stabilized inverse probability weight commonly uses the marginal treatment density \(q(a)=f_A(a)\) in the numerator. More generally, \(q\) may specify another normalized treatment distribution, provided its support is covered by the assignment density.

Both densities must be defined with respect to the same measure and in the same treatment units. A density is not itself a probability: it can exceed one and has units inverse to those of \(A\). Provided the numerator and denominator are densities on the same scale, their ratio is dimensionless. The weight is evaluated at each person’s observed treatment value, not at a hypothetical value chosen after observing the outcome.

What the Density Ratio Does

Suppose the joint distribution of covariates and treatment has density \(f_L(l)g(a\mid l)\). If \(W=q(A)/g(A\mid L)\), then multiplying the joint density by the weight cancels the conditional treatment density:

$$ f_L(l)g(a\mid l)\frac{q(a)}{g(a\mid l)} =f_L(l)q(a). $$

Thus, in the weighted population, \(A\) has density \(q\) and is independent of \(L\). This cancellation is the central reason for using the ratio. The claim is about the population weighted distribution under the stated densities; in a finite sample, estimated weights will not generally produce exact independence.

Theorem: Suppose \(g(a\mid l)\) is a conditional density and \(q(a)\) is a density such that \(q(a)=0\) wherever \(g(a\mid l)=0\), for \(f_L\)-almost every \(l\). Assume the observed joint distribution has density \(f_L(l)g(a\mid l)\). For any measurable function \(h(L,A)\) with \(E_q[|h(L,A)|]<\infty\), $$ E\left[\frac{q(A)}{g(A\mid L)}h(L,A)\right] = \int f_L(l)\int q(a)h(l,a)\,da\,dl. $$ Here \(E_q\) denotes expectation under the distribution with density \(f_L(l)q(a)\).

Proof. The support condition makes the ratio defined wherever the target density is positive, up to sets of probability zero. Integrating with respect to the observed joint density gives

$$ \begin{aligned} E[Wh(L,A)] &=\int\int f_L(l)g(a\mid l) \frac{q(a)}{g(a\mid l)}h(l,a)\,da\,dl\\ &=\int\int f_L(l)q(a)h(l,a)\,da\,dl. \end{aligned} $$ The integrability assumption ensures the target expectation exists. The final expression is expectation under the density \(f_L(l)q(a)\), as claimed. \(\square\)

Taking \(h=1\) shows that \(E[W]=1\) when both \(q\) and \(g(\cdot\mid l)\) are normalized densities. Taking \(h\) to depend only on \(A\) shows that the weighted treatment distribution is \(q\). Taking \(h\) to depend only on \(L\) shows that weighting does not change the marginal distribution of \(L\) in this single-treatment setup. For a stabilized weight with \(q=f_A\), the weighted joint density is \(f_L(l)f_A(a)\), so treatment and measured covariates are independent in that weighted population.

Worked Example: Calculating a Stabilized Weight

Let \(L\) take values 0 and 1 with probability \(1/2\) each, and let \(A\) range from 0 to 2. Suppose its conditional densities are

$$ g(a\mid 0)=\frac14+\frac{a}{4}, \qquad g(a\mid 1)=\frac34-\frac{a}{4}, \qquad 0\leq a\leq 2. $$

Each is a valid density: integrating the first gives \(2/4+2/4=1\), and integrating the second gives \(6/4-2/4=1\). The marginal density is their equally weighted mixture:

$$ f_A(a)=\frac12g(a\mid0)+\frac12g(a\mid1) =\frac12,\qquad 0\leq a\leq2. $$

For an individual with \(L=0\) and observed dose \(A=0.5\), the numerator density is \(f_A(0.5)=0.5\), and the denominator density is \(g(0.5\mid0)=0.25+0.5/4=0.375\). Therefore

$$ W=\frac{0.5}{0.375}=\frac43. $$

For \(L=1\) at the same dose, the denominator is \(0.75-0.5/4=0.625\), so the weight is \(0.5/0.625=0.8\). At \(A=1\), both conditional densities equal \(0.5\), and both strata have weight 1. The example verifies that the numerator is the marginal density and that the ratio depends on both the observed dose and covariate stratum.

Density Evaluation Is Not Probability Evaluation

For a continuously distributed \(A\), \(P(A=a\mid L=l)=0\) at every single value \(a\). The weight does not divide the probability of observing that exact value by another probability. It divides two density values. For a short interval around \(a\), probabilities are approximately density times interval width:

$$ P(a\leq A\leq a+\Delta\mid L=l) \approx g(a\mid l)\Delta $$

when the density is sufficiently smooth and \(\Delta\) is small. The common interval width approximately cancels in a ratio, which helps explain the density ratio, but an interval probability ratio is not generally identical to the ratio of densities at a particular point.

Worked Example: Comparing a Density With an Interval Probability

Use the preceding example for \(L=0\). At \(A=0.5\), the density ratio is \(0.5/0.375=4/3\). But the probability of the exact value \(A=0.5\) is zero under the target distribution and also zero under the conditional distribution; dividing these point probabilities gives \(0/0\), not \(4/3\).

Consider instead the interval \(0\leq A\leq1\). Under the target marginal density, its probability is

$$ \int_0^1\frac12\,da=\frac12. $$

Under \(L=0\), the interval probability is

$$ \int_0^1\left(\frac14+\frac{a}{4}\right)da =\frac14+\frac18=\frac38. $$

The ratio of these interval probabilities is \((1/2)/(3/8)=4/3\), which happens to equal the density ratio at \(a=0.5\) in this example. That agreement follows from the linear density and this interval’s symmetry; in general the interval ratio averages density ratios over the interval and need not equal the ratio at any particular point.

Extending the Ratio Across Treatment Times

For repeated continuous treatments, form a density ratio at each time and multiply the ratios. Let \(A_t\) be the treatment at time \(t\), \(H_t\) the measured history available just before that treatment, and \(\bar A_{t-1}=(A_1,\ldots,A_{t-1})\). Write \(g_t(a_t\mid H_t)\) for the treatment assignment density. A stabilized numerator can be a density \(q_t(a_t\mid\bar A_{t-1},L_0)\), where \(L_0\) denotes baseline covariates. The resulting weight through time \(K\) is

$$ W_K=\prod_{t=1}^{K} \frac{q_t(A_t\mid\bar A_{t-1},L_0)} {g_t(A_t\mid H_t)}. $$

At each time, \(q_t\) must be a normalized conditional density. The required support condition is sequential: whenever a treatment value has positive density under the numerator for a history that can arise under the target law, the denominator density must be positive there as well. If a target treatment path is possible under \(q_t\) but impossible under the observed assignment mechanism, no finite density ratio can create information about that path.

Result: Under the sequential factorization of the observed data law into treatment densities \(g_t\) and covariate-transition distributions, and under the sequential support condition, multiplying by \(W_K\) replaces each treatment density \(g_t\) by \(q_t\) in the joint law. The covariate-transition distributions remain as specified in that factorization.

To verify the result, write the joint law as the baseline distribution, followed by each treatment density and the subsequent covariate-transition distribution. Multiplication by \(W_K\) gives one factor \(q_t/g_t\) for each treatment time. Each \(g_t\) cancels its corresponding denominator, leaving the product of \(q_t\) factors and the original covariate-transition factors. The support and normalization conditions ensure these replacements define a valid target law. \(\square\)

Worked Example: Multiplying Two Sequential Density Ratios

Suppose both numerator densities are uniform on \([0,2]\), so \(q_1(a_1)=q_2(a_2\mid a_1,L_0)=1/2\). Let the first denominator density for a person with \(L_0=0\) be \(g_1(a_1\mid L_0=0)=1/4+a_1/4\), and let the second be \(g_2(a_2\mid H_2)=1/4+a_2/4\), regardless of the earlier history. These denominator densities integrate to 1 on \([0,2]\).

For observed values \(A_1=2\) and \(A_2=1\), the first denominator is \(1/4+2/4=3/4\), so the first ratio is \((1/2)/(3/4)=2/3\). The second denominator is \(1/4+1/4=1/2\), so the second ratio is \((1/2)/(1/2)=1\). The cumulative weight is

$$ W_2=\frac23\times1=\frac23. $$

This calculation is a product of two conditional density ratios, not a single ratio of point probabilities for the treatment path. Each time-specific ratio corrects the corresponding treatment assignment density.

Assumptions, Diagnostics, and Alternatives

The density-ratio identity is a mathematical statement about distributions. A causal interpretation additionally requires the usual causal assumptions for the estimand, including consistency and conditional exchangeability given the measured treatment history. Weighting does not establish those assumptions. For the weighting calculation itself, the essential conditions are correctly specified or consistently estimated densities, a common reference measure, normalized numerator densities, and support of the target density within the assignment density. For stable estimation, it is also important that weights not be dominated by a few extreme observations; finite target means alone do not guarantee a finite-variance estimator.

Useful diagnostics include inspecting the distribution and upper tail of the estimated weights, checking that treatment values in the target distribution are represented across relevant covariate histories, and comparing covariate distributions across treatment levels after weighting. For continuous treatment, balance should be assessed across the dose range or with appropriate summaries of dose and covariate relationships, not only by comparing one overall mean. The weighted treatment distribution should also be compared with the intended numerator distribution. Large or unstable weights can indicate near-violations of positivity, poor density-model fit, or both.

A discrete treatment uses probability mass ratios; a continuous treatment uses density ratios. Replacing densities with probabilities of exact dose values is invalid. Outcome regression or standardization is an alternative way to estimate causal contrasts: it models the outcome rather than reweighting the treatment assignment. These approaches target related causal questions but rely on different modeling choices, and neither makes support problems disappear. A density-ratio weight cannot recover a comparison where the observed data contain essentially no treatment variation for a relevant history.

A common mistake is to treat \(g(A\mid L)\) as the probability of receiving the exact observed dose and then invert that “probability.” The correction is to evaluate the conditional density at \(A\), then divide the target density evaluated at the same \(A\) by it. Another warning sign is using \(1/g(A\mid L)\) alone while interpreting it as a stabilized density ratio: without a numerator density it is not the ratio of two normalized treatment distributions, and it has units determined by the dose scale.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. Why is \(P(A=a\mid L=l)\) not the denominator used for a continuously distributed treatment?
  2. If \(q(a)=0.4\) and \(g(a\mid l)=0.2\) at the observed dose, what is the weight? What does the calculation mean?
  3. State the support condition needed for a target density \(q\) and assignment density \(g\).
  4. In a two-time treatment setting, why is the cumulative weight a product of two density ratios?
  5. Name two diagnostics that can reveal a problem with estimated continuous-treatment weights.

Solutions. (1) The probability of any exact value is zero for a continuous treatment, so the ratio of point probabilities is undefined; use the ratio of densities evaluated at that value. (2) The weight is \(0.4/0.2=2\); at that dose, the target density is twice the conditional assignment density, so that observation receives twice its unweighted contribution. (3) Wherever \(q(a)>0\), the assignment density must be positive for the relevant covariate histories, except on sets of probability zero. (4) Each time has its own conditional assignment density and target density; multiplying the ratios replaces all assignment densities in the sequential law. (5) Examples include inspecting the upper tail of the weights and checking treatment support or covariate balance across the dose range.

Clinical Biostats