# DR-TMLE This entry says what applied problem the variant solves, how the algorithm is built, and what is special about validating it. The pages beneath it carry the production contract: the [supported estimands and refusals](supported-estimands.md), the [theorem](theorem.md), the [targeting and cross-fitting choices](targeting.md), the [nuisance conditions](nuisance-conditions.md) the interval is conditional on, the [diagnostics](diagnostics.md) to inspect, and [what the validation programme established](validation-programme.md). ## The release claim, in brief **Conditional validity.** The default univariate algorithm computes what Benkeser, Carone, van der Laan & Gilbert's Theorem 1 derives. `reduction="bivariate"` computes van der Laan (2014), Theorem 3's earlier binary construction. Benkeser et al. (2017), Section 3.1, gives that theorem number. Checks compare both constructions with their remainder derivations and with the parameter's Gateaux derivative. The exact finite-support laws and the remainder identities run at three arms as well as two, in the union-model cells where exactly one correction survives. The reported interval is valid **conditional on** Theorem 1's conditions. Those are rate conditions on estimated functions. They are not verifiable from a fit's own output, and **numerical score convergence does not verify them**. With one nuisance wrong, adequate fits are not enough: [the conditioning terms](theorem.md#the-conditioning-terms-are-linear-in-one-error) decide. Read [solved scores do not establish nuisance consistency](diagnostics.md#solved-scores-do-not-establish-nuisance-consistency), which is the single most important page in this section. The interval is valid when both nuisances are consistent at the product rates, under DR-TMLE's own reduced-regression and solve conditions. With one nuisance inconsistent, the two extra equations remove the part of the first-order remainder that is a function of the consistent nuisance. The rest can stay first order. The one-wrong interval is valid for a declared known mechanism and conservative for a correctly specified parametric mechanism. With the mechanism wrong, the interval is not established, even for a correctly specified parametric outcome regression. With a data-adaptive learner for the consistent nuisance it is not established ([the case table](theorem.md#the-conditioning-terms-are-linear-in-one-error)). On law L, one gradient-boosting mechanism with a wrong outcome regression gave a bias of +1.5 to +2.0 SD cross-fitted and −1.2 to −2.5 SD in sample ([a data-adaptive mechanism](theorem.md#a-data-adaptive-mechanism)). What this is *not*: a better point estimate. The extra fluctuations update the outcome regression, the mechanism, or both, so `Ψ̂` differs from the ordinary TMLE in finite samples. The design does not aim at a smaller error for `Ψ̂`. It removes the part of the first-order remainder that is a function of the consistent nuisance. The interval is established with one wrong nuisance only in the cases [the theorem](theorem.md#the-conditioning-terms-are-linear-in-one-error) lists. And it is *not* the efficient estimator. Under misspecification the canonical gradient at `P_0` is still `D*`. What the three equations leave is `D = D* − D*_Q − D*_g`, the estimator's asymptotic influence function at the nuisance limits, and it is generally not efficient there. When both nuisances are consistent, the corrections converge to zero and the curve approaches the ordinary efficient curve. At the true nuisance functions, the corrections vanish row by row. ## What this solves Ordinary TMLE is **doubly robust for consistency and singly robust for inference**. DR-TMLE narrows that gap. It closes it only in the cases the theorem lists. Without outcome missingness, the treatment-specific mean under a binary treatment has the exact signed remainder $$ R_{2,a}=\int \frac{\hat g_a-g_{0,a}}{\hat g_a} (\hat Q_a-Q_{0,a})\,dP_0. $$ Here $g_a(W)=P(A=a\mid W)$, and the norms below are $L^2(P_0)$. The ATE remainder is the difference between the two arm remainders. With outcome missingness, the complete treatment-and-observation mechanism replaces $g_a$. If $\hat g_a\geq\epsilon>0$, Cauchy-Schwarz gives the separate bound $$ |R_{2,a}|\leq\epsilon^{-1} \lVert\hat g_a-g_{0,a}\rVert_2\lVert\hat Q_a-Q_{0,a}\rVert_2. $$ That bound is what double robustness rests on. One error converges, the other stays bounded, and the product goes to zero. The point estimate needs $R_2 \to 0$. Influence-curve inference needs the stronger condition $\sqrt{n}R_2 \to 0$. Nuisance errors of order $o(n^{-1/4})$ satisfy it, and errors of exactly $n^{-1/4}$ leave $\sqrt{n}R_2$ bounded away from zero. If one error does not shrink, the remainder is first order in the other. The estimator's bias then dominates the $n^{-1/2}$ standard-error scale, and coverage decays as the sample grows. DR-TMLE solves two further score equations, built from reduced-dimension regressions. They remove the part of that first-order remainder that is a function of the consistent nuisance. The part that is not, `R_{3,n}` or `R̃_{5,n}`, can stay first order. | your situation | what this method buys | what it costs | | --- | --- | --- | | you doubt one nuisance and still want an interval | an interval that is valid for a known mechanism and conservative for a correctly specified parametric mechanism. With the mechanism wrong, or with a data-adaptive learner, it is not established. On one test law, a [gradient-boosting mechanism](theorem.md#a-data-adaptive-mechanism) gave an absolute bias of 1.2 to 2.5 SD | the reduced regressions are refitted inside the alternation, so a fit costs several rounds of several regressions | | both nuisances are consistent | nothing you need. The corrections converge to zero and the curve converges to the efficient curve | the extra cost. The corrections add cost and no asymptotic gain here | | you want a narrower interval | this is not that | the corrected curve is the estimator's own influence function and not the efficient one | | you want `retarget` to be cheap | it is not. A truncation curve on a `DRTMLE` fit costs about a fit per point | a plain `TMLE` handed these nuisances refuses rather than re-solving against arrays it cannot refresh | `DRTMLE` ships under **conditional validity**. Read [the release claim](#the-release-claim-in-brief) before you rely on it. No tutorial covers DR-TMLE. In every case that an analyst can name before a fit, the ordinary TMLE interval is valid or conservative whenever the DR-TMLE interval is. Compare the [point-treatment contract](../point-treatment-tmle.md#known-treatment-mechanism) with [the case table](theorem.md#the-conditioning-terms-are-linear-in-one-error). An inconsistent nuisance model is not unmeasured confounding. This variant still requires the recorded history to satisfy exchangeability. ## The algorithm as implemented Writing $1_a$ for $\mathbb{1}\{A=a\}$, the three reduced regressions are $$ \begin{aligned} Q_r(a, w) &= E[\,Y - \hat Q(a, W) \mid A = a,\ \hat g(a\mid W) = \hat g(a\mid w)\,] \\ g_{r1}(a \mid w) &= P(\,A = a \mid \hat Q(a, W) = \hat Q(a, w)\,) \\ g_{r2}(a \mid w) &= E\!\left[\left.\frac{1_a - \hat g(a\mid W)}{\hat g(a\mid W)} \;\right|\; \hat Q(a, W) = \hat Q(a, w)\right]. \end{aligned} $$ On the default construction each one is **univariate however many covariates the fit adjusted for**. That fixed dimension makes the reduced regressions estimable at a univariate rate. It does not control the conditioning term, which conditions on the true nuisance as well ([the theorem](theorem.md#the-conditioning-terms-are-linear-in-one-error)). The three equations, in the software paper's numbering, are | | equation | what it fluctuates | | --- | --- | --- | | (8) | $P_n[\,1_a / g^*(a\mid W) \cdot (Y - Q^*(a, W))\,] = 0$ | the outcome regression, along the ordinary covariate | | (9) | $P_n[\,Q_r(a, W) / g^*(a\mid W) \cdot (1_a - g^*(a\mid W))\,] = 0$ | **the mechanism** | | (10) | $P_n[\,1_a \cdot g_{r2}(a\mid W) / g_{r1}(a\mid W) \cdot (Y - Q^*(a, W))\,] = 0$ | the outcome regression, along a second covariate | The reported influence curve is $D = D^* - D^*_Q - D^*_g$, with the two corrections being the left-hand sides above, row by row. There is **one term per equation the guard asked for**, so a single-guard fit reports one of the two and a shorter curve. All three empirical means are zero after targeting, so the subtraction cannot move the point estimate. It moves only the variance. **`guard=` is crossed, and the crossing runs through to the curve.** `guard="Q"` guards against a misspecified *outcome regression* and adds equation (9), which fluctuates the mechanism. `guard="g"` guards against a misspecified *mechanism* and adds equation (10), which fluctuates the outcome regression. The keyword names the nuisance you are worried about, not the one that the equation it adds moves. An empty guard fits no reduced regression at all and is bit for bit a plain TMLE. **The three equations are solved at the arrays the curve is built from.** That is not automatic. The alternation on its own leaves both extra equations solved somewhere the curve is not built from, which is harmless on a converged fit and worth percents of a standard error on one that stops early. A closing pass re-solves all three at the reductions the fit reports, refitting nothing. **On a finite law whose consistent nuisance separates every cell, one guard removes the whole first-order remainder; two over-correct.** Each extra equation subtracts a projection of $R_2$. Where both projections are onto all of $\sigma(W)$, either one recovers the whole of it, so the pair leaves exactly $-R_2$. That is arithmetic on a finite-support law rather than a defect. On a continuous law one guard removes the projection on $\sigma(\hat g)$ only, and the conditioning term can remain. [The theorem](theorem.md#the-conditioning-terms-are-linear-in-one-error) lists when it vanishes. Both equations are solved by default, because a fit does not know which nuisance is wrong. With one nuisance consistent, the correction built from its residual tends to zero ([Appendix C](theorem.md#appendix-c-a-correction-that-is-not-needed-costs-nothing)), so the pair costs nothing asymptotically. Implementation: [`estimators/drtmle.py`](https://github.com/esbraun/cleverly-tmle/blob/main/src/cleverly/estimators/drtmle.py), [`estimators/reduced.py`](https://github.com/esbraun/cleverly-tmle/blob/main/src/cleverly/estimators/reduced.py), and [`validation/drtmle.py`](https://github.com/esbraun/cleverly-tmle/blob/main/src/cleverly/validation/drtmle.py). The source-to-equation map is in [the contract](theorem.md#the-objects). ## Variations | option | what it does | is it a different estimator? | | --- | --- | --- | | `guard=("Q", "g")` | which extra equations are posed. The default is both | **yes**. An empty guard is a plain TMLE, and each single guard is its own construction | | `reduction="univariate"` | the three regressions above, from Benkeser et al. (2017). The default, because its reduced regressions can achieve faster rates | | | `reduction="bivariate"` | van der Laan (2014), Theorem 3, as Benkeser et al. (2017), Section 3.1, cites it: one two-column probability $P(A=a \mid \hat Q(a,W), \hat g(a\mid W))$, and equation (10)'s covariate replaced by $1_a(g_r - g)/(g\,g_r)$ | **yes**. `gr2` is `NaN` on this path by design, so accidental use of the absent regression cannot silently return zero | | `update_order="drtmle"` | the canonical R sequence. The default. One equation-(8) step primes the outcome regression before the first round, and R does not take it. The round refits only the mechanism reductions after equation (9), and only the outcome reduction after equation (8) | no. A diagnostic keyword. Both source-specific solve orders are pinned | | `update_order="benkeser"` | the published six-step recursion. The same prime step precedes its first round | no | | `reduced_crossfit="pooled"` | out-of-fold reduced fits sharing the primary split. The default | no. A diagnostic keyword | | `reduced_crossfit="nested"` | measures the generated-regressor dependence rather than assuming it away | no. Refused below three folds, under `cross_fit=False`, and with `targeting="one_step"` at a non-empty `guard` | | `randomized=`, a declared known mechanism | with `delta=`, the Diaz and van der Laan (2017) randomized missing-outcome surface: five reductions, and three separate corrections for treatment, observation, and outcome. Above two arms, each arm indicator gets its own construction and the arm estimators are stacked | **yes**. It requires `cross_fit=False` and both guards. See [the contract](theorem.md#randomized-trials-with-missing-outcomes) and [the multi-arm contract](theorem.md#more-than-two-arms) | | `delta=` without `randomized=`, or `treatment_delta=` | the composite indicator $C_a = \Delta_A \Delta 1\{A = a\}$ with the mechanism $g_{c,a} = \pi_A(W)\,g(a \mid \Delta_A = 1, W)\,\pi(a, W)$, and the complete-data reductions on it. Each arm's column is tilted alone at every arm count | **yes**. It requires `cross_fit=False` and accepts every guard and reduction. See [the composite contract](theorem.md#observational-missing-data-the-composite-indicator) | | `evaluation=` | an independent-draw evaluation set carried through targeting | no. A remainder diagnostic | | multiple treatment levels | each reduction and correction is indexed by a free level, and equation (9) is solved by independent one-versus-rest fluctuations | this follows the published R workflow. The cited theorem is binary, so this is an implementation-backed armwise extension | The targeted margins deliberately do not renormalise, because a simplex projection would reopen the armwise equations. They are not inert either. Equation (8) divides by them, so the estimate does read a mechanism that no longer sums to one. Refusals by name are listed in [the contract](supported-estimands.md#refused-by-name) and summarised in [scope and refusals](../scope-and-refusals.md#not-written-yet). ## Validation issues special to this method **The exact-law instrument is blind here, and derivably so.** Under a law the sample realises exactly with a saturated learner, both nuisances are exact, so $Q_r$ and $g_{r2}$ have identically zero targets and vanish *row by row*. Both extra coefficients are then zero, and the estimator reproduces ordinary TMLE. The Gateaux modules therefore supply a degeneracy check, and they would pass against a wrong sign, an omitted term, or a wrong $g_{r1}$. That last one is a probability. It does not vanish, and it sits in a denominator whose numerator does. This is the reason the only **theorem** instrument in the tree belongs to this variant. `tests/unit/test_theorem_drtmle.py` checks against Benkeser et al.'s Theorem 1 *at values where the correction does not vanish*. The rest of the estimand catalogue does not need one, because its influence curves do not vanish at the truth. The argument for that empty column is written down in [the evidence manifest](../evidence.md#what-this-table-says-is-missing). **Four nonzero instruments carry the multi-arm extension**, because the exact multi-arm law makes every new term vanish and so cannot fail. They are an independent `brentq` solve of the canonical package's own mechanism score equation arm by arm, a misspecified fit where $Q_r$ is nonzero and the mechanism visibly leaves the simplex, a column-permutation witness on the exit state, and an armwise covariate formula check on a nonzero $Q_r$. They are tabulated in [estimator variants over registered targets](../evidence.md#estimator-variants-over-registered-targets). **Bounding the two mechanisms separately is what the scope label had to learn.** The contract once measured its truncation witnesses on the treatment mechanism alone, which is blind in exactly the regime this construction is for. A randomized trial's mechanism is flat by design and cannot clip, so a fit whose observation mechanism was pinned on a fifth of its rows was certified as theorem-backed. The fixture is now a pair of fits, and the second is asserted to leave every pre-existing column inactive, so a bound-active verdict there can come only from the two new witnesses. **Agreement with the canonical R package does not check the influence curve's form.** The influence curve's *provenance* is that its form was read off that package. Its *evidence* is that it has since been checked against Theorem 1's own appendices at a nonzero $Q_r$, and against a perturbation of the law where in each half of the union model the corrected curve is the efficient influence function row for row. These exact laws let the consistent nuisance separate every cell, so the conditioning term is zero on them. `tests/unit/test_conditioning_remainder_drtmle.py` adds a law where it is not. Agreement between two transcriptions of one source is evidence about the transcription. A changed term keeps its independent check, as the [validation invariant](../../architecture-invariants.md#validation-and-evidence) states. **Solved scores do not establish nuisance consistency.** `score_check` used to sign a doubly-robust fit off with one verdict over three rows, two of which are the corrections. It now branches on whether the fit is corrected, and says which equations it solved. See [the contract](diagnostics.md#solved-scores-do-not-establish-nuisance-consistency). The registered [canonical complete-outcome DR-TMLE study](../method-evidence/canonical-dr-tmle.md) reports rather than gates: it publishes failed cells instead of hiding them. The separate [randomized missing-outcome DR-TMLE study](../method-evidence/randomized-missing-outcome-dr-tmle.md) tests the MAR drift directions and the five-reduction score reduction; its R comparison is limited to the shared both-correct limit because R `drtmle` collapses treatment and response into one joint mechanism. The [observational missing-data study](../method-evidence/observational-missing-data-dr-tmle.md) tests the composite indicator. There R `drtmle` runs the same construction, so its pairing compares one estimator with another implementation of it. [What the validation programme established](validation-programme.md) is the full list of what is and is not settled. ```{toctree} :maxdepth: 2 supported-estimands theorem targeting nuisance-conditions diagnostics validation-programme ```