WorksMathematics
Where the Data End and the Mechanism Begins: Doubly Robust Causal Digital Twins for Treatment Strategies
Abstract
Digital twins are increasingly used to ask how a patient's health would evolve under alternative treatment strategies. When a twin couples a mechanistic model with learned components and is fitted to observational records, its answer mixes information from the data with assumptions from the mechanism. For sustained strategies that begin at a clinical landmark, we split the counterfactual mean into a part the data support, where patients follow the strategy with probability bounded away from zero, and a part they do not. On the supported part, a cross-fitted sequential doubly robust estimator that uses the twin as its outcome model is consistent whenever the decision model is, so twins that fit equally well but disagree as plug-in estimators agree after correction. On the unsupported part, we characterize the values compatible with the data and with a residual of size at most epsilon around the mechanism. This set is nested in epsilon, reduces to a point when the mechanism is exact and identifiable, and recovers assumption-free bounds as epsilon grows, so the penalty weight of a physics-informed loss becomes a sensitivity parameter. Knowledge constraints on how covariates enter the mechanism shrink the set, and when support grows over time, back-testing gives a data-based lower bound on epsilon. In simulations based on an energy-balance model of weight change under glucagon-like peptide-1 receptor agonist therapy, the correction reduced the spread of estimates across four twins from 0.66 to 0.03 percentage points of weight loss with conservative coverage; on unsupported patients, the exact mechanism was rejected in every replicate, the bounds covered the truth at every residual size not rejected, and a mechanism-free extrapolation was biased by 0.5 points.
Corresponding author: Cong Cao
Introduction
About half of patients who start a glucagon-like peptide-1 receptor agonist (GLP-1RA) for obesity stop within the first year [37, 4]. In randomized withdrawal trials, most of the weight lost is regained within a year of stopping [34, 39] (Aronne et al. 2024), and a nonlinear meta-regression of six trials estimated that 60% of lost weight returns at one year, with regain approaching a plateau at roughly three quarters of the loss [4]. In routine care, the average regain after discontinuation is much smaller, in part because many patients restart the drug or switch to another treatment [13]. A clinician who reviews a patient six months after initiation therefore faces a question that neither source answers directly: for this patient, what would happen to body weight under continuation, under discontinuation, and under a switch, and how much of that answer can be trusted?
Digital twins are designed to answer such questions by simulating a patient’s trajectory under alternative interventions [3] (National Academies of Sciences, Engineering, and Medicine 2024). In physiology, the most credible twins combine a mechanistic model with learned components, for example an energy-balance model of weight change [16, 15] augmented by a neural network that captures what the equations miss [32, 41]. Fitted to observational records, such a twin can be run forward under any strategy. The difficulty is that it returns an answer whether or not the data contain patients who followed that strategy. Where they do, the answer can be checked against what happened to comparable patients; where they do not, it is an extrapolation carried entirely by the mechanism and by the inductive biases of the learned component. The two kinds of answer look identical in the output.
Recent results show why this matters. Hybrid models that fit the data well can lose the causal validity of their mechanistic core as their learned components become more flexible [42]. Learned transport models with nearly identical predictive accuracy induced exposure mappings that implied different spillover effects [5], and low prediction error of nuisance functions did not identify the better causal estimator [6]. Observational data alone cannot certify that a twin is causally correct without assumptions such as no unmeasured confounding [10]. Hybrid mechanistic models improve counterfactual prediction out of distribution [28, 20], and partial mechanistic knowledge can support what-if predictions without controlled experiments under explicit structural assumptions [40], but these approaches target prediction accuracy and do not separate what the data identify from what the mechanism supplies. Neural methods for counterfactual outcomes over time handle time-varying confounding [35, 24, 12] and quantify predictive uncertainty [18], but they contain no mechanism and therefore no principled basis for extrapolation. Debiased estimation has been extended to functionals of neural-operator trajectories [19], without treatment strategies or confounding. In the literature on limited overlap, effects in regions without support are either excluded by trimming [11], extrapolated by flexible regression [31], or bounded under smoothness assumptions on the outcome function [27]; none use a mechanism as the basis for extrapolation.
This paper makes four contributions. First, for sustained strategies that begin at a landmark, we decompose the counterfactual mean into a supported part, which is nonparametrically identified, and an unsupported part, which is not (§ 2.3). Second, we show that a cross-fitted sequential doubly robust estimator that uses the twin as its outcome model is consistent for the supported part whenever the decision model is, and we derive its exact second-order remainder; as a consequence, twins that are observationally equivalent but disagree as plug-in estimators agree after correction (§ 4). Third, for the unsupported part we characterize the set of values compatible with the data and with a residual of size at most around the mechanism, establish its monotonicity, validity, and limiting behaviour, and show that knowledge constraints on the parameter encoder shrink it (§ 5); because a physics-informed penalty weight controls the residual size, it becomes a sensitivity parameter with a causal interpretation. Fourth, when the set of supported histories grows over calendar time, we show that back-testing yields a lower bound on the residual size required by the data and falsifies smaller values (§ 6). Section 7 specifies and reports a simulation study based on published physiology and trial results.
We do not address the choice of adjustment set. Throughout, the adjustment set is the observed history itself. When the history is compressed into a learned representation, the requirements of Cao [7] apply in addition to those developed here; in particular, representation bias is first order and is not removed by the corrections below. The mechanism enters this paper only through the model for outcome dynamics.
Setup and estimands
Data structure
Time zero is treatment initiation. At a landmark , for example six months, and at subsequent decision times , a treatment status is recorded, where in the running example denotes continuing the current GLP-1RA, stopping, or switching to a different agent. We observe independent copies of
where is the landmark history, consisting of baseline covariates , the weight trajectory before and after initiation up to , dose changes, and symptoms; collects the information recorded in , including weights measured at irregular visits and symptoms; and is the outcome at , for example the percentage of total weight loss relative to the weight at initiation. Write for the history available at , with .
Strategies and estimands
A sustained strategy assigns treatment status at every decision time from the landmark onwards; for it means stopping at and not restarting before . Let denote the potential outcome under . The target is the counterfactual mean and contrasts such as . Strategies are defined at the landmark, as in target trial emulation (Hernán and Robins, [17]); a patient who stops and later restarts has deviated from , and the restart is part of the decision process rather than of the strategy. This distinction is what separates the strategy estimand from the natural course after discontinuation reported in routine-care studies (Gasoyan et al., [13]).
For fixed , define the decision probabilities and the iterated conditional expectations
for , where is evaluated at with . Each is a functional of the observed-data law wherever .
Identification and partial positivity
Assumption 1 (Sequential identification). (i) Consistency: and when . (ii) Sequential exchangeability: for .
We do not assume positivity everywhere. Call a history reachable from under if it has positive density under the law obtained by setting for .
Assumption 2 (Overlap gap). There is such that, for every and every history reachable under , . Let be the set of landmark histories from which holds for every reachable continuation and every , and let .
The gap is a simplification. In practice takes small positive values, and a threshold is chosen so that histories with smaller probabilities are treated as unsupported, trading the variance of weighting against reliance on the mechanism (Remark 3). Histories fail to be supported for clinical reasons: a patient with a large early weight loss and no side effects may essentially never stop at six months, so that the strategy is unsupported for that patient type even though such patients are common.
Define the supported and unsupported counterfactual means
Proposition 1 (Decomposition and identification). Under Assumptions 1 and 2:
(a) .
(b) , so the supported part is identified.
(c) If for every and , the sharp identified set for under Assumptions 1 and 2 is .
Part (b) is the g-formula restricted to supported histories [33]. Part (c) states that the observed data place no constraint on beyond the outcome range when the strategy is never initiated from the unsupported landmark histories, which is the situation in the running example and in the simulation. When positivity fails only at later decision times, the data carry information up to that time and the identified set is narrower; we do not characterize it here. Any informative statement about must therefore come from assumptions, and the question is how to state them so that their strength is explicit.
Mechanism-informed causal digital twins
Mechanistic core
Let denote weight change from initiation and the drug exposure implied by strategy after the landmark: ; for , with washout time constant ; and the exposure to the new agent. We use the linearized energy-balance model of Hall et al. [16] with the feedback control of intake described by Hall [15]. Changes in energy intake and expenditure are
where is the persistent drug-induced reduction in intake, is the strength of the feedback that raises appetite as weight falls, and is the change in expenditure per unit weight change. With energy density , the mechanistic drift is
with drug-specific values of when contains more than one agent. Group-level fits of this model indicate that GLP-1RAs and bariatric surgery weaken the appetite feedback by roughly 40–70% relative to its baseline strength [15].
Twin
Definition 1 (Twin). A twin consists of an encoder that maps baseline covariates to mechanistic parameters, , and a residual , where collects features of the landmark history. Under strategy , a twin generates post-landmark weight change for patient by
started from the state at , with weights observed with measurement error at visit times. Under the decision process observed in the data, the same equation with given by the observed treatment path defines the twin’s law of the observed trajectories. A twin implies functions , obtained by conditioning the latent state on the weights observed up to and simulating forward under .
The same twin also describes the pre-treatment window with , where the feedback strength is . This is one route by which the mechanism carries information across strategies (Remark 2).
Knowledge constraints. Prior knowledge can restrict which covariates may affect which parameter. A mask requires the th component of to depend on only through ; for example, the drug effect may depend on glycaemic status and genetic risk for type 2 diabetes, whereas the off-drug feedback may depend on demographic characteristics and the pre-treatment weight trajectory. Let denote encoders that respect .
Residual size. For a reference measure on , let and for a function class . The measure must cover the states, exposures, and history features at which extrapolation is required, not only those seen in the data; otherwise the residual is unconstrained exactly where the answer depends on it. In the simulation, acts only off treatment and is linear in features, , where is the observed weight change at the landmark, and is the product of the empirical law of over all patients, supported or not, and the uniform law of on ; then with .
Remark 1 (Physics-informed penalties and residual size). Physics-informed training minimizes a penalized loss , where measures fit to the observed trajectories [32, 8]; APHYNITY penalizes the norm of the learned component for a related purpose [41]. When the problem is convex in , Lagrangian duality gives a decreasing map under which the penalized and constrained problems share solutions. For neural residuals the correspondence holds only locally, so we index all results by the realized residual size rather than by . Either way, the penalty weight sets how far the twin may depart from the mechanism, which § 5 turns into a statement about counterfactuals.
Definition 2 (Observationally equivalent twins). A twin is compatible with the observed-data law if, for every and every action with positive probability given the history, the twin reproduces the conditional law of given and of given , and reproduces the pre-treatment trajectories. Let
Compatibility uses all observed treatment paths, not only those consistent with . Because the mechanistic parameters are shared across strategies, patients who continued treatment constrain and , and the pre-treatment window constrains , even for patient types who never stop.
Remark 2 (Where the information for extrapolation comes from). Under (1), the trajectory after stopping is governed by the decay of and by the return of the feedback from to . For a patient who never stops, and are informed by the on-treatment trajectory and by the pre-treatment trajectory and by the encoder, which is learned from patients with similar covariates who did stop. Strategy positivity fails because the decision depends on early response, a post-baseline quantity, while the covariates that enter the encoder may overlap well between supported and unsupported patients. The mechanism is what links the two.
The supported part: doubly robust twins
Fix ; in practice it is estimated by thresholding estimated decision probabilities on a split of the data that is not used for estimation. Divide the estimation sample into folds. For observations in fold , let and a twin be fitted on the other folds, set and , and define the weights and . The estimator of the supported part is
This is the sequential augmented inverse-probability-weighted estimator ([2, 36, 25]) with the iterated regressions supplied by the twin rather than by separate regression fits. The corresponding influence function is
with the weights at the true decision probabilities.
Lemma 1 (Exact remainder). For fixed bounded below on supported histories and fixed ,
Each term is the product of the error in one decision model and the error in the twin’s regression at the same time point, so the bias vanishes if, at every , either the decision model or the twin is correct.
Theorem 1 (Doubly robust twins on the supported part). Suppose Assumptions 1 and 2 hold, on supported histories with probability tending to one, and and in on supported histories for some limits and .
(a) If, for each , either or , then in probability.
(b) If and for all and , with norms over supported histories, then .
(c) Let and be two twin-fitting procedures. If both satisfy the conditions of (b), then . If both are misspecified, with limits , but the deci-
sion models are consistent, both estimators converge to , whereas the plug-in estimators converge to , , which differ in general.
Part (c) is the formal version of an empirical phenomenon: twins that fit the observed trajectories equally well, and that would pass any check based on prediction error [6], can imply different counterfactuals, as learned transport models did in Cao [5]. On supported histories the correction removes this disagreement to first order. Under misspecification of the twin, consistency of rests on the decision models, and the rate is that of ; with correctly specified parametric decision models it is .
Remark 3 (Choice of threshold). A larger shrinks , stabilizes the weights, and moves more of into the part carried by the mechanism. Reporting , the bounds of § 5, and over a grid of makes this trade-off visible. We do not study asymptotics with .
The unsupported part: mechanism-indexed bounds
For a twin , let be the value it implies on unsupported histories, and define
Assumption 3 (Mechanism adequacy at level ). The potential trajectories under every strategy are generated, given the landmark history, by a twin with and .
The level is unknown. Assumption 3 with a small is a strong statement about physiology; with a large it is weak.
Proposition 2 (Properties of the bounds). Suppose Assumptions 1 and 2 hold.
(a) Monotonicity. If then ; if then .
(b) Validity. Under Assumption 3, for every and every with .
(c) Exact mechanism. Suppose the parameters are identified at : any two twins in have encoders that agree almost surely on the support of X among supported patients and in the pre-treatment window, and the support of X among unsupported patients is contained in that set. Then is a single point if is non-empty. If is empty, the exact mechanism with mask is refuted by the observed data.
(d) No mechanism. Let \psi_{\mathrm{out}}(a)$ under Assumptions 1 and 2 alone. Suppose the residual class is rich: for every and every there is a twin, compatible with and with finite residual size, whose out-of-support value lies within of . Then is dense in , and for every .
Part (a) says that a stronger trust in the mechanism (smaller ) and stronger knowledge about how covariates enter it (a smaller mask) both narrow the bounds. Part (b) says that the narrowing is valid only if the trust is warranted. Parts (c) and (d) give the two ends of the scale: point identification by the mechanism, and the assumption-free set of Proposition 1(c). Reporting as a function of shows how strongly a conclusion about unsupported patients depends on the mechanism; this is the role that sensitivity parameters play in analyses of unmeasured confounding, here attached to the physics-informed penalty. Part (c) also supplies a falsification test: if no twin with small residual is compatible with the data, the mechanism with that residual size is rejected, in the spirit of Cornish et al. [10].
Combining with Proposition 1(a), the counterfactual mean satisfies
Computation and inference
The endpoints of are values of optimization problems over twins, as identified sets for counterfactuals in structural dynamic models are Kalouptsidi et al. [22]. We approximate them with extremal twins (Algorithm 1): for each sign, the twin’s out-of-support value is pushed up or down subject to a fit constraint that admits near-minimizers of the empirical loss, in the spirit of set estimation with near-minimizers Chernozhukov et al. [9]. The fit threshold is set once, by the best fit in the richest residual class considered, so that the estimated sets are nested in as in Proposition 2(a); if no twin with residual size attains the threshold, the estimated set is empty and the mechanism with that residual size is rejected, the sample counterpart of Proposition 2(c). Confidence intervals for the endpoints can be obtained by the bootstrap and combined into an interval for the partially identified parameter Imbens and Manski [21].
In implementation, compatibility is imposed through the mean trajectory: a twin is compatible if it minimizes the population loss , the expected squared error of predicted weights along the observed treatment paths, over the class of twin parameters with residual size at most . Write and .
Proposition 3 (Consistency of extremal twins). Suppose that is compact, that with , that is continuous on and its sample analogue converges to it uniformly in probability, and that with . Then converges to in Hausdorff distance in probability, and the endpoints of converge in probability to min and max of over .
Under Assumption 3, the true twin minimizes whenever , so is the set of compatible twins in this mean sense, and the limits are the endpoints of . In the simulation, is of order and we use the relative slack , with the number of weight measurements.
Algorithm 1 Extremal twins for
Require: increasing grid , mask , relative slack
Fit the richest twin and set the threshold
for do
if then
report and continue
end if
for do
, started at
end for
Record the endpoints, taking the envelope with those at
end for
Calibrating the residual size over time
The size is a sensitivity parameter, but data can sometimes say which values are too small. Treatment practice changes over calendar time, for example through drug shortages or changes in insurance coverage, and patient types for whom a strategy was unsupported in an early era may follow it in a later one.
Let index two eras with observed-data laws and and supported sets , and let be the back-test region, unsupported in era 1 and supported in era 2.
Assumption 4 (Invariant dynamics). The law of the potential trajectories under each strategy, given the landmark history, is the same in both eras. The eras may differ in the distribution of histories, in the decision process, and in the visit process.
Let be the bounds computed from twins compatible with , with the out-of-support value averaged over the era-2 distribution of histories in , and let , which is identified in era 2. Define
Proposition 4 (Back-testing). Suppose Assumptions 1 and 2 hold in both eras and Assumptions 3 and 4 hold, with .
(a) .
(b) Every is inconsistent with Assumption 3 at level .
(c) If, in addition, extrapolation to the remaining unsupported set requires no larger residual than extrapolation to , in the sense that , then for every , and also at if the infimum is attained.
Back-testing therefore gives a lower bound on the residual size that the data require, not an upper bound. Parts (a) and (b) need only invariance; part (c) needs an additional assumption that the back-test region is at least as hard to extrapolate to as the target region, which cannot be checked. In the simulation design below it holds by construction.
In practice is estimated by (2) in era 2 and the bounds by Algorithm 1 in era 1. For each in a grid , consider the null hypothesis , rejected when the Wald interval does not intersect the estimated bounds, and let be the smallest grid value at which is not rejected.
Corollary 1 (Lower confidence bound). Under the conditions of Proposition 4, Theorem 1(b) applied in era 2, and Proposition 3 applied in era 1, let be the smallest grid value with , and suppose lies in the interior of . Then .
Combined with Proposition 4(a), is an asymptotic lower confidence bound for the grid level just above , and hence for nothing larger than rounded up to the grid.
Simulation study {#sec:7}
The study follows the ADEMP structure ([29]); the code is a single script described in Appendix § 13. All results below use , the setting in which the mechanism omits part of the dynamics.
Aims. (i) To verify that, on supported histories, twins that disagree as plug-in estimators agree after correction (Theorem 1); (ii) to evaluate the validity and width of on unsupported histories as functions of and of the mask, and the rejection of too small (Proposition 2); (iii) to evaluate back-testing (Proposition 4 and Corollary 1); and (iv) to compare with plug-in twins, the mechanistic core alone, and a mechanism-free g-computation estimator.
Data-generating mechanism. Baseline covariates are age, sex (60% female), body mass index, glycated haemoglobin, and a genetic risk score for type 2 diabetes, standardized except sex; weight at initiation is kg. Gastrointestinal symptoms at the landmark are binary with probability , and a cost shock , recorded in the landmark history, has probability 0.10 in era 1 and 0.35 in era 2. Weight change follows the energy-balance model of § 3 on a weekly grid. The energy density and the expenditure slope are sex-specific values of the linearized NIH Body Weight Planner model, and 9,916 kcal/kg and and 24 kcal/day per kg for men and women ([14]). Individual parameters are
so that the baseline feedback strength matches the value estimated by Hall [15] and treatment weakens it by 40–70%. These coefficients define the true mask : depends on sex, BMI,
HbA1c, genetic risk, and symptoms; on sex and HbA1c; and on age and sex. Drug exposure is on treatment and decays with time constant after stopping. Variation in the parameters is explained by the covariates, so that the encoder can represent it; unexplained variation enters through the intake noise below. The design does not include random effects in the parameters, which would require updating individual parameters from early weights. We set kcal/day, which gives mean total weight loss of 10.3% at 26 weeks and 14.4% at 78 weeks under continuation, close to the 15% reported at 68 weeks in STEP 1 ([38]), and weeks, which, together with the residual described next, gives a median regain of 59% of the lost weight 52 weeks after stopping, close to the 60% estimated by [4]. Intake fluctuates weekly with standard deviation 100 kcal/day, and weights are recorded at weeks 4, 8, 12, 16, 20, and 26 and every 8 weeks thereafter up to week 78, with measurement error of standard deviation 1 kg.
The true dynamics include a residual that the mechanistic core omits: after a patient first stops, intake stays lower by an amount proportional to the weight lost by the landmark, with kcal/day per kg, a stand-in for behavioural changes learned during treatment. Without it, the core predicts that all lost weight is eventually regained; with it, regain levels off below the pre-treatment weight, as in the meta-regression of [4]. This residual lies in the twin’s residual class, so Assumption 3 holds with , about 250 kcal/day and computed in each replicate. The dial makes the mechanism exact () or not ().
At the landmark weeks, the probability of stopping is , with early loss the observed percentage weight loss. In era 1 it is zero for patients with early loss of at least 12% and no symptoms, who make up 10% of the cohort and form the unsupported set for the stopping strategy. In era 2, a cost shock triggers stopping with probability 0.5 among these patients, so that those with a cost shock form the back-test region and those without one remain unsupported. Because the cost shock is independent of the dynamics, the condition of Proposition 4(c) holds in this design. Every 8 weeks after the landmark, patients on treatment stop with probability , and patients off treatment restart with probability , where regain is the weight regained in kilograms since stopping. Restarting in response to regain creates time-varying confounding, and its frequency is comparable to the roughly 20% of patients who restarted within a year in routine care ([13]). Each era has patients and each setting uses 200 replicates.
Estimands. The counterfactual means of the percentage of total weight loss at 78 weeks under continuation, , and under stopping at the landmark without restarting, , with the supported and unsupported parts of . True values are computed by simulating 60,000 patients under each strategy.
Methods. The twin has log-linear and logit-linear encoders for , , and , an estimated recovery time constant, and the residual of § 3, with the five covariates and . Decision models are logistic regressions. The methods are: (M1) the mechanistic core without residual, as a plug-in estimator and with the correction (2); (M2) hybrid twins with penalty weights and an unrestricted encoder, and (M3) a hybrid twin with the true mask, each as a plug-in estimator and with the correction; (M4) iterated linear regressions among strategy followers, a mechanism-free g-computation estimator that extrapolates linearly to unsupported patients; and (M5) the bounds of Algorithm 1 on unsupported histories, with unrestricted and true masks, over . Corrections use two-fold cross-fitting with the same folds for all twins. Back-testing compares the era-2 corrected estimate on with era-1 bounds evaluated on the era-2 histories in , and reports of Corollary 1 with .
Performance measures. On supported histories: bias, mean estimated standard error, and coverage of 95% intervals for each twin, with and without correction, and the standard deviation across twins within a replicate before and after correction. On unsupported histories: coverage of by , its width, and the share of replicates in which the set is empty. For back-testing: the distribution of and the share of replicates with . Monte Carlo standard errors are given in the table notes.
Results
All results are based on 200 replicates with patients per era. On average, 10.6% of patients were unsupported for the stopping strategy, and the true residual size was kcal/day.
Supported histories. Table 1 shows that the four twins, all fitted to the same data, gave plug-in estimates whose biases ranged from to percentage points of total weight loss. The mechanistic core and the strongly penalized hybrid were most biased because they cannot represent the intake reduction retained after stopping and therefore predict too much regain. After the correction (2), all biases were at most 0.04 points and the within-replicate standard deviation across twins fell from 0.656 to 0.029, the behaviour described in Theorem 1(c). The two misspecified twins kept a small bias (0.042 and 0.030, about a third of their standard errors), as expected when consistency rests on the decision models alone (Theorem 1(a)). Coverage of nominal 95% intervals was 0.975 to 0.995, so the variance estimator was conservative; in the first 50 replicates, the empirical standard deviations of the corrected estimates were 10–20% below the mean estimated standard errors. This is consistent with the known effect of treating estimated weights as known in inverse-probability-weighted estimators (Lunceford and Davidian, [26]). For continuation, which is supported for every patient, the corrected estimate had bias and coverage 0.950. The mechanism-free iterated regression estimator was also nearly unbiased on supported histories (bias ): where the data support a strategy, the mechanism is not needed.
Table 1: Supported histories, strategy “stop at the landmark”: bias of plug-in and corrected estimates of (true value 4.03 percentage points of total weight loss at 78 weeks), , 200 replicates.
| Twin | Plug-in bias | Corrected bias | Mean SE | Coverage |
| Mechanistic core, no residual | −1.369 | 0.042 | 0.116 | 0.995 |
| Hybrid, | −0.076 | 0.005 | 0.075 | 0.975 |
| Hybrid, | −0.969 | 0.030 | 0.099 | 0.990 |
| Hybrid with true mask, | −0.064 | 0.006 | 0.075 | 0.980 |
| SD across the four twins | 0.656 | 0.029 |
SE, estimated standard error; SD, mean within-replicate standard deviation of the four estimates. Monte Carlo standard errors are about 0.005–0.008 for the corrected biases and 0.005–0.011 for the coverages.
Table 1.
Unsupported histories. The true value on unsupported histories was 5.67 points, and the mechanism-free estimator, which extrapolates linearly, was biased by points while reporting a single number. Table 2 shows the bounds. For , no twin met the fit threshold in any replicate, so the estimated set was empty: the data rejected the exact mechanism and every residual smaller than a quarter of the true one, the sample counterpart of Proposition 2(c). For every residual size that was not rejected, the bounds covered the true value in at least 99.5% of replicates. Their width increased with , from 2.23 to 3.02 points with an unrestricted encoder, as Proposition 2(a) requires, and the true mask narrowed them by 25% at and by about 10% at larger values.
Table 2: Unsupported histories, strategy “stop at the landmark”: mechanism-indexed bounds for (true value 5.67), , 200 replicates.
| Unrestricted encoder | True mask | |||||
| Coverage | Width | Empty | Coverage | Width | Empty | |
| 0 | 0.000 | – | 1.000 | 0.000 | – | 1.000 |
| 0.10 | 0.000 | – | 1.000 | 0.000 | – | 1.000 |
| 0.25 | 0.000 | – | 1.000 | 0.000 | – | 1.000 |
| 0.50 | 1.000 | 2.234 | 0.000 | 0.995 | 1.683 | 0.000 |
| 1.00 | 1.000 | 2.849 | 0.000 | 1.000 | 2.551 | 0.000 |
| 2.00 | 1.000 | 3.016 | 0.000 | 1.000 | 2.740 | 0.000 |
Coverage, share of replicates in which the estimated set contains the true value (an empty set does not); width in percentage points, averaged over non-empty sets; empty, share of replicates in which no twin met the fit threshold. Mechanism-free iterated regression: bias −0.49.
Table 2.
Back-testing. The calibrated level was in every replicate, so it never exceeded , as Proposition 4(a) requires. In this design, however, back-testing added nothing to the fit-based rejection: because the retained intake reduction acts on all patients who stop, the era-1 data already determine its size, and coincides with the smallest residual size that the era-1 data do not reject. Back-testing is informative when the omitted mechanism acts mainly on patients for whom the strategy is unsupported, so that a small residual fits the era-1 data but extrapolates wrongly. The present design does not include this case.
Discussion
A digital twin that combines a mechanism with learned components returns an answer for every strategy, and this paper separates the parts of that answer by their source. Where patients followed the strategy, the twin serves as an outcome model inside a doubly robust estimator, and the conclusion does not depend on which of several equally well-fitting twins is used. Where they did not, the twin’s answer is reported as a set indexed by how far the twin may depart from the mechanism, and the physics-informed penalty that controls this departure becomes an explicit sensitivity parameter. When practice changes over time, back-testing tells which departures are too small to be consistent with the data.
The simulation illustrates both parts of this division. Four twins that fit the same data disagreed by more than a percentage point of weight loss as plug-in estimators, and the correction brought them to within a few hundredths of a point of each other and of the truth. On patients whom the data did not cover, a mechanism-free extrapolation was off by half a point and gave no sign of it, whereas the bounds were empty when the residual was too small to fit the data and covered the truth once it was not; knowledge constraints on the encoder narrowed them. Two findings qualify these results. The variance estimator of the correction was conservative, so coverage exceeded the nominal level; and in the present design back-testing could not improve on fit-based rejection, because the omitted mechanism also acted on supported patients.
The framework complements our earlier work. Cao [5] showed that learned models with the same predictive accuracy can imply different causal conclusions; Theorem 1 shows when such disagreement disappears and Proposition 2 quantifies it when it does not. Cao [6] showed that prediction error is a poor guide to causal performance; accordingly, no result here relies on the predictive accuracy of the twin. Cao [7] studied when a learned representation is an adequate adjustment set; here the adjustment set is the observed history, and the mechanism enters only through the model for outcome dynamics.
The work has limitations. Sequential exchangeability given the observed history is assumed; reasons for stopping such as cost and insurance coverage may be incompletely recorded, and sensitivity analysis for unmeasured confounding of the decision process is a natural extension. The overlap gap of Assumption 2 simplifies the treatment of histories with small but positive decision probabilities. Individual mechanistic parameters may be weakly identified from sparse clinical weights, a difficulty already noted for energy-balance models ([15]); the population estimands studied here are less sensitive to this than individual forecasts. Back-testing relies on invariant dynamics across eras, and its coverage guarantee on the remaining unsupported set relies on an assumption that cannot be checked. Finally, the framework has not yet been applied to clinical data.
Data and Code Availability
No data were analyzed in this version. The simulation code and instructions for reproducing § 7.1 are available at https://github.com/congcao/causal-digital-twins.
Funding
The author received no specific funding for this work.
Competing Interests
The author declares no competing interests.
Proofs
Proposition 1. Part (a) is the law of total expectation. For (b), fix . By Assumption 2, along every continuation reachable under , so each is well defined on those histories. Backward induction using consistency and sequential exchangeability [33] gives for reachable ; at this is , and averaging over gives the result. For (c), let , which has positive probability. On the observed-data law contains no information on the conditional law of , because almost surely. Given any law compatible with the observed data and the assumptions, modify the conditional law of the potential trajectories under given on only, independently of the observed treatments, keeping within . The observed-data law and consistency are unaffected, because potential outcomes under are never observed on . Exchangeability at is preserved because the modified law does not depend on , and exchangeability at conditions on , an event of probability zero on . Under the assumption of part (c), . Taking the modified law of given on to be a point mass at any gives , so every point of the interval is attained; conversely because takes values there. Hence the interval is the sharp identified set.
Lemma 1. Write , with , and , so that . All expectations below include the factor , which is a function of and is omitted from the notation. Because is non-zero only if , and the nuisance estimates are fixed,
where the second equality integrates over given . Writing and using ,
Shifting the index in the first sum and using and gives , which is the stated expression.
Theorem 1. Write , for evaluated at the true nuisances, so that , and for expectation over a new observation with the nuisance estimates held fixed. With folds of sizes , the estimator is , so
where uses nuisances fitted outside fold , is the empirical measure of fold , and because ; is the remainder of Lemma 1 for the fold- nuisances. Conditionally on the data outside fold , the middle term has mean zero and variance at most , so it is by Chebyshev’s inequality ([23]). Since is bounded and on supported histories, the weights satisfy and for a constant depending on , , and the outcome range; the middle term is therefore under the convergence in (b) and under the convergence to limits in (a). By the Cauchy–Schwarz inequality and ,
with norms in over supported histories along which the strategy has been followed. Finally, and the numerator is in case (b), so the ratio equals the numerator divided by up to . For (a), each term of the bound converges to , and the other terms are . For (b), and the central limit theorem applies. Part (c) follows by applying (b) to each procedure, which yields the same leading term , and, under misspecification of the twins, by applying (a) with ; the plug-in estimator converges to .
Proposition 2. (a) and imply , and the infimum and supremum over a larger set are weakly more extreme. (b) Under Assumptions 1 and 3, generates both the potential and the observed trajectories, so it is compatible with ; it belongs to whenever and , and . (c) At every twin is determined by its encoder. By assumption, compatible encoders agree almost surely on the support of among unsupported patients, so they imply the same post-landmark law under for those patients and the same . If no twin is compatible, the observed data are inconsistent with Assumption 3 at with mask . (d) Every compatible twin, combined with the
observed decision process, defines a law that reproduces and satisfies Assumptions 1 and 2, because the twin generates potential trajectories from without reference to later decisions, so that sequential exchangeability holds by construction. Hence for every compatible twin, and . Conversely, for and , richness gives a compatible twin with finite residual size and ; this twin belongs to for , so meets every neighbourhood of every point of .
Proposition 4. (a) By Assumption 4, generates the potential trajectories in both eras, so it is compatible with and belongs to the era-1 set at every . Under the era-2 identification assumptions, , which is the value implied by and therefore lies in . Hence belongs to the set whose infimum defines . (b) By monotonicity, for every , and by validity this is impossible if Assumption 3 held at level . (c) Let denote the infimum in the stated condition, so . For there is with , and monotonicity gives membership at . If the infimum is attained, the same argument applies at .
Proposition 3. Let . On the event , whose probability tends to one because , every satisfies , so ; and every satisfies . By compactness and continuity of , for every there is such that implies ; since , lies in the -neighbourhood of with probability tending to one. This is Hausdorff convergence (compare [9 Theorem 3.1]. Uniform continuity of on the compact set and uniform convergence of its sample analogue then give convergence of the endpoints.
Corollary 1. At the null hypothesis holds by Proposition 4 and monotonicity. By Proposition 3 the estimated bounds at converge to their population values, which contain in their interior, and by Theorem 1(b) the Wald interval covers with probability tending to or more. On the intersection of these events the interval intersects the estimated bounds, is not rejected, and .
Simulation details
The simulation is implemented in a single Python script, twin_sim.py, using NumPy, SciPy, pandas, and scikit-learn. All constants of Section 7 are set at the top of the script, and python twin_sim.py --calibrate prints the calibration targets reported there. Twins are fitted by nonlinear least squares with the penalty of Remark 1. For the extremal twins of Algorithm 1, the constraint is imposed by writing the residual coefficients as , with the Gram matrix of § 3, and each endpoint is found by continuation: an added least-squares term pulls the out-of-support value toward successive targets, and the last target reached within the fit threshold, with relative slack , is recorded. Each replicate runs on one core. In the first 50 replicates, with a four-point grid of residual sizes, the median time per replicate was 13 minutes (interquartile range 11–16); the 200 replicates reported in § 7.1 used a six-point grid and ran with 30 parallel jobs on a 32-core virtual machine.
References
- [2]Heejung Bang and James M. Robins. Doubly robust estimation in missing data and causal inference models. Biometrics, 61(4):962–973, 2005.pubmed.ncbi.nlm.nih.gov/16401269
- [3]Bergthor Björnsson, Carl Borrebaeck, Nils Elander, et al. Digital twins to personalize medicine. Genome Medicine, 12:4, 2020.DOI
- [4]Brajan Budini, Steven Luo, Martin Tam, Isabel Stead, Andrew Lee, Angelica Akrami, Antonio Vidal-Puig, and Adrian Park. Trajectory of weight regain after cessation of GLP-1 receptor agonists: A systematic review and nonlinear meta-regression. eClinicalMedicine, 93:103796, 2026. doi: 10.1016/j.eclinm.2026.103796.DOI
- [5]Cong Cao. Causal inference under interference with learned exposure mappings, 2026a. arXiv:2608.19224.arxiv.org/abs/2608.19224
- [6]Cong Cao. When prediction error is not enough: Evaluating nuisance-function prediction for causal estimation, 2026b. arXiv:2609.00071.arxiv.org/abs/2609.00071
- [7]Cong Cao. When reconstruction is not enough: Doubly robust counterfactual and interventional mediation analysis with learned multimodal representations, 2026c. Manuscript; code archived at https://doi.org/10.5281/zenodo.23524452.
- [8]Cong Cao, Ramit Debnath, and R. Michael Alvarez. Physics-based machine learning for predicting urban air pollution using decadal time series data. Environmental Research Communications, 7:051009, 2025.
- [9]Victor Chernozhukov, Han Hong, and Elie Tamer. Estimation and confidence regions for parameter sets in econometric models. Econometrica, 75(5):1243–1284, 2007.DOI
- [10]Rob Cornish, Muhammad Faaiz Taufiq, Arnaud Doucet, and Chris Holmes. Causal falsification of digital twins. Journal of Machine Learning Research, 27(152):1–52, 2026.
- [11]Richard K. Crump, V. Joseph Hotz, Guido W. Imbens, and Oscar A. Mitnik. Dealing with limited overlap in estimation of average treatment effects. Biometrika, 96(1):187–199, 2009.DOI
- [12]Dennis Frauen, Tobias Hatt, Valentýn Melnychuk, and Stefan Feuerriegel. Estimating average causal effects from patient trajectories. In Proceedings of the AAAI Conference on Artificial Intelligence, 2023.
- [13]Hamlet Gasoyan, Rebecca Schulte, Christopher B. Boyer, Nicholas J. Casacchia, W. Scott Butsch, Phuc Le, Ali Aminian, Marcio L. Griebeler, Bartolome Burguera, and Michael B. Rothberg. Obesity treatments and weight changes in clinical practice after discontinuation of semaglutide or tirzepatide. Diabetes, Obesity and Metabolism, 28(6):4795–4805, 2026. doi: 10.1111/dom.70660.DOI
- [14]Juen Guo, Danielle C. Brager, and Kevin D. Hall. Simulating long-term human weight-loss dynamics in response to calorie restriction. The American Journal of Clinical Nutrition, 107(4):558–565, 2018. doi: 10.1093/ajcn/nqx080.DOI
- [15]Kevin D. Hall. Physiology of the weight-loss plateau in response to diet restriction, GLP-1 receptor agonism, and bariatric surgery. Obesity, 32(6):1163–1168, 2024. doi: 10.1002/oby.24027.DOI
- [16]Kevin D. Hall, Gary Sacks, Dhruva Chandramohan, et al. Quantification of the effect of energy imbalance on bodyweight. The Lancet, 378(9793):826–837, 2011.DOI
- [17]Miguel A. Hernán and James M. Robins. Using big data to emulate a target trial when a randomized trial is not available. American Journal of Epidemiology, 183(8):758–764, 2016.DOI
- [18]Konstantin Hess, Valentýn Melnychuk, Dennis Frauen, and Stefan Feuerriegel. Bayesian neural controlled differential equations for treatment effect estimation. In International Conference on Learning Representations, 2024.arxiv.org/abs/2310.17463
- [19]Konstantin Hess, Dennis Frauen, Niki Kilbertus, and Stefan Feuerriegel. Debiased neural operators for estimating functionals, 2026. arXiv:2604.19296.
- [20]Samuel Holt, Tennison Liu, and Mihaela van der Schaar. Automatically learning hybrid digital twins of dynamical systems. In Advances in Neural Information Processing Systems, volume 37, 2024.arxiv.org/abs/2410.23691
- [21]Guido W. Imbens and Charles F. Manski. Confidence intervals for partially identified parameters. Econometrica, 72(6):1845–1857, 2004.
- [22]Myrto Kalouptsidi, Yuichi Kitamura, Lucas Lima, and Eduardo Souza-Rodrigues. Partial identification and inference for dynamic models and counterfactuals. Discussion Paper 14402, Centre for Economic Policy Research, 2020.
- [23]Edward H. Kennedy. Semiparametric theory and empirical processes in causal inference. In Hua He, Pan Wu, and Ding-Geng Chen, editors, Statistical Causal Inferences and Their Applications in Public Health Research, pages 141–167. Springer, 2016.arxiv.org/abs/1510.04740
- [24]Rui Li, Stephanie Hu, Mingyu Lu, Yuria Utsumi, Pritwhish Chakraborty, Daby M. Sow, Piyush Madan, Jun Li, Mohamed Ghalwash, Zach Shahn, and Li-wei Lehman. G-net: A recurrent network approach to G-computation for counterfactual prediction under a dynamic treatment regime. In Proceedings of Machine Learning for Health, volume 158 of Proceedings of Machine Learning Research, 2021.arxiv.org/abs/2003.10551
- [25]Alexander R. Luedtke, Oleg Sofrygin, Mark J. van der Laan, and Marco Carone. Sequential double robustness in right-censored longitudinal models, 2017. arXiv:1705.02459.arxiv.org/abs/1705.02459
- [26]Jared K. Lunceford and Marie Davidian. Stratification and weighting via the propensity score in estimation of causal treatment effects: A comparative study. Statistics in Medicine, 23(19):2937–2960, 2004.
- [27]Yuanzhe Ma, Yian Huang, and Hongseok Namkoong. A sensitivity approach to causal inference under limited overlap, 2025. arXiv:2511.22003.arxiv.org/abs/2511.22003
- [28]Tomer Meir, Ori Linial, Danny Eytan, and Uri Shalit. Structured hybrid mechanistic models for robust estimation of time-dependent intervention outcomes, 2026. arXiv:2602.11350.arxiv.org/abs/2602.11350
- [29]Tim P. Morris, Ian R. White, and Michael J. Crowther. Using simulation studies to evaluate statistical methods. Statistics in Medicine, 38(11):2074–2102, 2019.DOI
- [31]Rachel C. Nethery, Fabrizia Mealli, and Francesca Dominici. Estimating population average causal effects in the presence of non-overlap: The effect of natural gas compressor station exposure on cancer mortality. The Annals of Applied Statistics, 13(2):1242–1267, 2019. doi: 10.1214/18-A OAS1231.DOI
- [32]Maziar Raissi, Paris Perdikaris, and George E. Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378:686–707, 2019.DOI
- [33]James M. Robins. A new approach to causal inference in mortality studies with a sustained exposure period: Application to control of the healthy worker survivor effect. Mathematical Modelling, 7(9–12):1393–1512, 1986.DOI
- [34]Domenica Rubino, Niclas Abrahamsson, Melanie Davies, et al. Effect of continued weekly subcutaneous semaglutide vs placebo on weight loss maintenance in adults with overweight or obesity: The STEP 4 randomized clinical trial. JAMA, 325(14):1414–1425, 2021.DOI
- [35]Nabeel Seedat, Fergus Imrie, Alexis Bellot, Zhaozhi Qian, and Mihaela van der Schaar. Continuous-time modeling of counterfactual outcomes using neural controlled differential equations. In Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 19497–19521, 2022.arxiv.org/abs/2206.08311
- [36]Mark J. van der Laan and Susan Gruber. Targeted minimum loss based estimation of causal effects of multiple time point interventions. The International Journal of Biostatistics, 8(1), 2012.DOI
- [37]Sam West, Jadine Scragg, Paul Aveyard, Jason L. Oke, et al. Weight regain after cessation of medication for weight management: Systematic review and meta-analysis. BMJ, 392:e085304, 2026. doi: 10.1136/bmj-2025-085304.DOI
- [38]John P. H. Wilding, Rachel L. Batterham, Salvatore Calanna, et al. Once-weekly semaglutide in adults with overweight or obesity. New England Journal of Medicine, 384(11):989–1002, 2021.DOI
- [39]John P. H. Wilding, Rachel L. Batterham, Melanie Davies, et al. Weight regain and cardiometabolic effects after withdrawal of semaglutide: The STEP 1 trial extension. Diabetes, Obesity and Metabolism, 24(8):1553–1564, 2022. doi: 10.1111/dom.14725.DOI
- [40]Dingling Yao, Kahaan Gandhi, Valentin Duruisseaux, Boris Bonev, Francesco Locatello, and Anima Anandkumar. Counterfactual predictions in scientific emulators without controlled experiments, 2026. arXiv:2610.02252.arxiv.org/abs/2610.02252
- [41]Yuan Yin, Vincent Le Guen, Jérémie Dona, Emmanuel de Bézenac, Ibrahim Ayed, Nicolas Thome, and Patrick Gallinari. Augmenting physical models with deep networks for complex dynamics forecasting. In International Conference on Learning Representations, 2021.
- [42]Bob Junyi Zou, Matthew E. Levine, Dessi P. Zaharieva, Ramesh Johari, and Emily B. Fox. Hybrid² neural ODE causal modeling and an application to glycemic response. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 62934–62963, 2024.arxiv.org/abs/2402.17233