A Formal and Causal Analysis of Treatment-Confounded State Construction

Audited for mathematical precision: every claim below is labeled proven, empirical, or open, and every derivation is available on demand without lengthening the page. Full source with references: FORMAL_ANALYSIS.md.

Abstract

This page proves two mechanisms by which a SOFA-based reinforcement-learning state can encode prior treatment, and states precisely what those proofs do and do not imply about whether a model actually exploits that encoding — a question this page treats as open and empirical, not settled by the mathematics alone.

What this proof does NOT establish. These results prove that treatment information can enter the state representation through the construction of SOFA. They do not, by themselves, prove that a learned policy exploits this information to predict the next treatment action. That claim requires empirical testing against treatment persistence and other competing explanations — see §H3.

Terminology — confounding, not ML-sense leakage

$A_{t-1} \to S_t \to A_t$ — prior treatment shaping the current state, which then informs the next decision — is ordinary sequential decision-making, not leakage. True leakage would be $A_t \to S_t \to \hat{A}_t$: the state containing information about the same action epoch it's used to predict, or information not yet available at decision time. Both theorems below are the first pattern — real, provable, and still a genuine problem for offline-RL state design (Proposition 2 shows $S_t$ is formally a descendant of $A_{t-1}$), but a post-treatment-bias / bad-control pathology from causal inference, not a target/temporal leakage pathology from machine learning. This project's own action label was verified to have zero overlap with the state window it follows (analysis notebook, §"Build State Variants A–E and Action Labels") — the second pattern does not occur anywhere in this pipeline. Full derivation: FORMAL_ANALYSIS.md §1.1.

What is actually proven?

Proven
  • Treatment-dose non-identifiability of σ_cardio
  • Exact reconstructibility of σ_cardio from the total
  • Monotonicity of absolute window overlap
  • Non-monotonicity of fractional overlap
  • S_t is a descendant of A_(t-1) in the causal graph
Empirical
  • Frequency of nonzero dose in the cohort (32.3% / 28.6%)
  • AUROC values for variants A–E
  • Window-overlap percentages
  • Offset-decay curve shape
Open / testable
  • Whether the definitional pathway materially explains next-action predictability
  • Whether the AUROC gap survives controlling for treatment persistence
Assumptions used by this analysis
  • Decision times $t=1,\dots,T_i$ are ordered and known; $A_t$ is defined as the vasopressor status in the interval strictly following $t$.
  • The state $S_t$ is built only from information timestamped in $[t-w,t)$ — the lookback window — for some $w>0$.
  • $D_t$ denotes the active drug/dose at $t$, treated as a direct function of the treatment record (not of physiology).
  • Every state variant (A–E) is assumed to contain exactly the feature set defined for it in §Theorem 2 — no additional undocumented features.
  • The causal graph (§Causal structure) assumes no unmeasured common cause of $A_{t-1}$ and $U_t$ beyond what MAP already captures — a simplification stated explicitly so it can be challenged.
  • The fractional-overlap derivative (§Window overlap) assumes $O(w)$ is differentiable; in the actual discrete-event data $O$ is a step function, so the derivative is a continuous-model idealization, not a claim about the raw data.
Notation glossary
$t$Decision time (4-hour bin index)
$A_t$Vasopressor action in the interval following $t$
$A_{t-1}$Prior action, immediately preceding $t$
$S_t$State vector at $t$
$U_t$True, unobserved physiology at $t$
$D_t$Active drug/dose at $t$ (function of the treatment record)
MAP$_t$Mean arterial pressure at $t$
$\sigma_{cardio}$SOFA cardiovascular subscore
SOFA$_{total}$Sum of all six SOFA organ subscores
$O_t(w)$Treatment-hours overlapping window $[t-w,t)$
$c_t(w)$Overlap fraction, $\min(1,O_t(w)/w)$
$w$Lookback window length (hours)
AUROC$(k)$Offset-decay AUROC at offset $k$ decision bins
$\Delta$AUROC$(0)$ $-$ AUROC$(8)$

Theorem 1 — Treatment-dose non-identifiability of σcardio

Proven

Once any vasopressor is running, the cardiovascular SOFA score stops reading blood pressure at all — it becomes purely a readout of the drug and dose.

The cardiovascular SOFA subscore (Vincent et al., 1996) is scored by checking dose thresholds from highest to lowest, falling through only if the higher tier doesn't apply:

$$ \sigma_{cardio}(\text{MAP}, D) = \begin{cases} 0 & \text{if } D=\emptyset \text{ AND MAP} \geq 70 \\ 1 & \text{if } D=\emptyset \text{ AND MAP} < 70 \\ 4 & \text{if } \text{dopa}>15 \text{ OR epi}>0.1 \text{ OR norepi}>0.1 \\ 3 & \text{else if } \text{dopa}>5 \text{ OR } 0{<}\text{epi}{\leq}0.1 \text{ OR } 0{<}\text{norepi}{\leq}0.1 \\ 2 & \text{else if } 0{<}\text{dopa}{\leq}5 \text{ OR dobutamine}>0 \end{cases} $$

Branches are checked in the order shown (nested, not independent) — this resolves the OR/AND ambiguity precisely, and matches the audited implementation exactly.

Statement
For any fixed nonzero drug/dose $D=d$ (any vasopressor active, at any dose), $\sigma_{cardio}$ is constant in MAP: $\sigma_{cardio}(m_1,d)=\sigma_{cardio}(m_2,d)$ for all $m_1,m_2$. This holds for the entire nonzero-dose domain, not merely where a dose exceeds some threshold.

Corrected example. Fix $D=$ dopamine at 6 mcg/kg/min (no epi/norepi active). The first branch (dopa>15) is false; the second (dopa>5) is true — score $=3$. For any $\text{MAP}\in\{40,55,70,90,\dots\}$, $\sigma_{cardio}(\text{MAP},\text{dopa}{=}6)=3$ identically.

Corollary 1.1 — "100% of treated timesteps" is proven, not observed

Proven

It's not a coincidence that every treated timestep in the data turned out dose-determined — the definition guarantees it.

Statement
Whenever $D\ne\emptyset$: the dose branches yield scores in $\{2,3,4\}$ while the $D=\emptyset$ branches yield scores in $\{0,1\}$ — disjoint ranges. So the dose-derived score exceeds the MAP-only score whenever any vasopressor is active, for any dose. Do not equate $A_{t-1}=1$ alone with this — the relevant condition is the actual active drug/dose branch, which Theorem 1 shows is state-determining whenever nonzero.

The empirical content is separate: how often $D\ne\emptyset$ occurs at all in this cohort — 32.3% (4h window) / 28.6% (24h window) of all eligible timesteps. That frequency is a dataset fact; the 100%-conditional-on-treatment claim is a proof.

Theorem 2 — Exact reconstructibility under naive feature removal

Proven

Deleting the cardiovascular score from the feature list doesn't delete the information — it's still recoverable by subtracting the other five scores from the total.

$$\text{SOFA}_{total} = \sigma_{cardio} + \sum_{i\ne cardio}\text{subscore}_i$$

Statement
Define Variant C precisely as the feature set $\{\text{SOFA}_{total},\ \text{subscore}_{resp},\ \text{subscore}_{coag},\ \text{subscore}_{liver},\ \text{subscore}_{renal},\ \text{subscore}_{cns}\}$ — i.e. $\sigma_{cardio}$ removed, everything else (including the total) kept. Every term on the right-hand side of $\sigma_{cardio}=\text{SOFA}_{total}-\sum_{i\ne cardio}\text{subscore}_i$ is observable in Variant C, so $\sigma_{cardio}$ is exactly, algebraically recoverable — not a statistical inference, an identity.

Proposition 1 — Window overlap: absolute monotone, fractional not

Proven

A bigger lookback window can only see more treatment-hours, never fewer — but the fraction of the window that overlaps treatment can go either way.

Proposition 1
For $w_1

Fractional overlap — exact derivative. With $c(w)=O(w)/w$, the quotient rule gives, wherever $O$ is differentiable:

$$c'(w) = \frac{w\,O'(w) - O(w)}{w^2} = \frac{O'(w) - c(w)}{w}$$

So $c'(w)>0 \iff O'(w)>c(w)$ — the fractional overlap rises exactly when the marginal treatment density in the newly-added slice exceeds the average density accumulated so far. This is the same relationship as a marginal-cost curve crossing an average-cost curve, and it correctly predicts the counterintuitive empirical reversal this project measured: the 4-hour window showed a higher overlap rate than the 24-hour window.

Causal structure — why non-identifiability isn't the same as leakage

Theorem 1 is a fact about a scoring function. Whether that fact lets a model predict the next action is a separate, empirical question — this section makes precisely why.

Two distinct causal paths from prior action to next action Prior action A_(t-1) vasopressor at t-1 D_t (dose) sofa_cardio_t Theorem 1 State S_t Next action A_t definitional pathway (proven) persistence pathway (ordinary, unproven either way here) what AUROC(S_t → A_t) actually measures
Proposition 2 — descendant relationship
There exists a directed path $A_{t-1}\to D_t\to\sigma_{cardio,t}\to S_t$ (the definitional pathway, proven via Theorem 1's mechanism). Separately, $A_{t-1}\to A_t$ (ordinary treatment persistence) exists as a ordinary clinical fact — this project neither proves nor needs to prove it exists; it's a competing explanation to be ruled in or out.

An AUROC computed for a classifier predicting $A_t$ from $S_t$ cannot, from the number alone, attribute its performance between these two paths. This is a structural fact about what AUROC measures — a marginal association — not a limitation specific to this dataset. State containing treatment information does not, by itself, prove predictive leakage of the next action.

H3 — run, with the proper statistical test

H3 — does the definitional pathway materially explain next-action predictability?

Run — Prediction A
Result
The test below has been run: $\Delta = 0.147$, 95% CI $[0.140, 0.154]$ (bin-index offsets, common rows, logreg) — Prediction A, per docs/DECISIONS_H3.md. This does not settle which mechanism produces $\Delta$: exploratory work in review (a synthetic ground-truth simulation) finds the same rule fires whenever a state encodes a currently-running treatment under realistic persistence, with or without a SOFA-specific construction effect present — so Prediction A on its own cannot separate the SOFA-construction mechanism (Theorems 1-2) from ordinary treatment persistence. See Status and Evidence for the full run and the exploratory analyses.

Let $\text{AUROC}(k)$ be the offset-decay AUROC at offset $k\in\{0,1,2,4,8\}$ decision bins, and $\Delta=\text{AUROC}(0)-\text{AUROC}(8)$.

Corrected methodology
Checking whether two marginal confidence intervals overlap is not the correct test here, and is a known-weak heuristic in general: $\text{AUROC}(0)$ and $\text{AUROC}(8)$ are computed on the same patients (paired data), so their sampling errors are correlated. The right target is the sampling distribution of $\Delta$ itself.

Recommended procedure: a paired cluster bootstrap — resample patients (not timesteps) with replacement, and on each resample compute both $\text{AUROC}(0)$ and $\text{AUROC}(8)$ using the same resampled patient set, then record $\Delta$ for that resample. Repeat many times; report the resulting bootstrap CI for $\Delta$ directly. A DeLong-type paired test for correlated ROC curves, or a permutation test that permutes offset-labels within patient, are valid alternatives.

Prediction A (definitional pathway dominates): $\Delta$'s bootstrap CI excludes a value near 0 and $\Delta\ge0.10$. Prediction B (persistence dominates): $\Delta$'s CI includes 0, or $\Delta<0.10$. Neither outcome would falsify Theorems 1–2 — only their practical contribution to the measured gap would be smaller under Prediction B.

References

Vincent, J.-L. et al. (1996). The SOFA score. Intensive Care Medicine, 22(7), 707–710.
Hernán, M. A. & Robins, J. M. Causal Inference: What If. Chapman & Hall/CRC, 2020.
DeLong, E. R. et al. (1988). Comparing the areas under two or more correlated ROC curves. Biometrics, 44(3), 837–845.
Komorowski, M. et al. (2018). The Artificial Intelligence Clinician. Nature Medicine, 24(11), 1716–1720.

Derivation