chc.research.stepwise_confounding¶
Stability tier: research.
A plan's value under unobserved confounding that acts one step at a time, and the confounding that overturns it.
Logged transitions (s, a, r, s') of a plant with a discrete state and a discrete action identify
the plan's value only where nothing unobserved moves both the logger's action and the transition.
Where an unobserved U_t does, and U_t is memoryless, independent of the past given the
state S_t (Bruns-Smith and Zhou, "Robust fitted-Q-evaluation and iteration under sequentially
exogenous unobserved confounders", arXiv 2302.00662, Definition 1), the plant seen by a plan that
does not read U_t is still a Markov decision process on the observed state, and each step's
transition law under the plan is the logged one reweighted by w = e(a|s) / e(a|s, U), with
E[w | s, a] = 1 (their Theorem 1).
The sensitivity level is CHC's Gamma. The model bounding w is Tan's (2006) marginal
sensitivity model on the odds of the logged action, the one
chc.uncertainty.msm_worst_case_mean reads with propensity= and
chc.uncertainty.benchmark_gamma calibrates: the odds of a given (s, U) lie within
a factor Gamma of its odds given s. Bruns-Smith and Zhou call the same number Lambda
(their Assumption 3): Gamma here is their Lambda, and their
tau = Lambda / (1 + Lambda) is Gamma / (Gamma + 1). The weight then lies in
[alpha, beta] = [e + (1 - e) / Gamma, e + (1 - e) Gamma], e = e(a|s) the logger's
propensity, read off the log as the share of the state's transitions that took a.
weight_box="density" takes the box [1/Gamma, Gamma] instead, the continuous-dose model
msm_worst_case_mean reads without a propensity (Jesson et al. 2022; the
paper's Appendix 4.1); on a discrete action it is the wider of the two, the limit e -> 0.
The closed form (validation/stepwise_confounding.mac). The least E[w Y] over weights
in [alpha, beta] with mean 1 puts beta on the lowest outcomes, a share
(1 - alpha) / (beta - alpha) = 1 / (Gamma + 1) of them whatever e, and alpha on the
rest: lower(Y) = alpha E[Y] + (1 - alpha) LTM(Y), and the largest is
upper(Y) = alpha E[Y] + (1 - alpha) UTM(Y). LTM is the mean of the lowest
1 / (Gamma + 1) of the law, below its quantile at 1 - tau, and UTM that of the
highest, above its quantile at tau: the paper's Proposition 5. At Gamma = 1 both are
E[Y]. Read on the empirical law of a cell, the share falls between two transitions and the
tail takes the fraction of the next one, as msm_worst_case_mean does;
the bound is then that function's own at the cell's propensity, the knapsack the tests compare it
with.
The robust fitted-Q evaluation. Over the plan's horizon H, from V_H = 0 back to step
0, each state s the plan reaches at step t reads the cell of its action
a = plan[t, s]: Y = r + V_{t+1}(s') over the cell's logged transitions, and
V_t(s) = lower(Y) (upper for the upper value). On a discrete state the fitted Q is the
cell's mean and the fitted quantile the cell's own, so the fit is the saturated one and nothing is
smoothed. The value is V_0 averaged over the initial law.
The bound holds under the model: the true value lies in [lower, upper] at any Gamma at or
above the confounding's own, since each step's operator is monotone in V and each step's true
law is one of the reweightings it ranges over. It is sharp for each step's cell where the logger
has two actions (the paper's Proposition 4 and note 5). Two things can make the interval wider than
the model allows. With more actions the cells of one state are bounded apart, the paper's
rectangular relaxation. And the cells are pooled over the log's periods, a time-homogeneous plant,
whose one transition law each step's worst case may read differently.
The premise is checked, not assumed. Where U persists, as an unobserved state the plant
carries from one period to the next, the observed process is not Markov, and this evaluation has no
guarantee. The log's transitions are labelled by "unit" and "period", and the innovations of
each transition, its reward and its next state less their cell's means, are read for a lag-1
autocorrelation within units: chc.dynamics_id.persistence_check's statistic and test, on
these innovations instead of a fitted channel's moment residual. Under memoryless confounding the
innovation of a step is uncorrelated with the step before it; where a persistent U moves the
reward or the next state, they move together. A rejection at persistence_alpha raises
PersistentConfounding. A clean check does not prove the premise: the test reads one lag
and a correlation, where the paper's test is of conditional independence. Where a persistent U
is suspected, Bruns-Smith and Zhou's k-order memoryless model adds the k - 1 previous states
and actions to the state, and the check then reads the augmented log.
The breakdown. stepwise_breakdown bisects for Gamma*, the least Gamma at which
the plan's lower value falls below a comparator: a threshold, or the nominal value of a baseline
plan on the same log. The lower value falls with Gamma, continuously, toward its limit at
Gamma -> inf, e E[Y] + (1 - e) min Y per cell (min Y under the density box), so
Gamma* is one crossing, and inf where the limit stays at or above the comparator: no
confounding of this kind can overturn the plan. As every Gamma in CHC, Gamma* is a level of
the sensitivity model, not a measured amount of confounding.
Scope. Discrete states and actions, integer codes from 0; a low-dimensional continuous state must be
binned first, and the premise then concerns the bins. A plan is deterministic: a fixed action
sequence over the horizon, or an action per step and state. Rewards are rewards, larger is better;
a cost enters negated. The bounds are plug-in: they are the sharp bounds on the log's empirical law
and carry none of its sampling error, which a cell of few transitions reads in full: its tails are
then a few points. StepwiseRobustValue.least_count reports the fewest any cell read. The
premise's check holds one float a transition and state, so a log of many states and transitions
takes their product in memory. The paper's orthogonalised estimator, its confidence bounds, and
the infinite-horizon estimator of Bennett and Kallus (NeurIPS 2024) are not built.
WeightBox = Literal['odds', 'density']
module-attribute
¶
The box the weight e(a|s) / e(a|s, U) lies in at Gamma: Tan's odds box at the logged
propensity, or the density box [1/Gamma, Gamma].
PersistentConfounding
¶
Bases: ValueError
The log's innovations persist within units: the confounding may not be memoryless, and the
evaluation is refused. check is the reading that refused it.
StepwiseRobustValue
dataclass
¶
A plan's value bounded under memoryless confounding at gamma, by
stepwise_robust_value. Research.
StepwiseBreakdown
dataclass
¶
The least sensitivity level at which a plan's lower value falls below a comparator, by
stepwise_breakdown. Research.
stepwise_robust_value(logs, plan, gamma, *, initial=None, weight_box='odds', persistence_alpha=_PERSISTENCE_ALPHA)
¶
The lower and upper values of plan under memoryless confounding at gamma.
Research.
logs holds one entry a transition under each of "state", "action",
"reward", "next_state", "unit" and "period": states and actions as integer
codes from 0, the reward as a real number, the unit as any label and the period as the whole
number of steps the transition starts in. plan is a sequence of action codes (H,), one
a step, or a table (H, S), one a step and state; H is the horizon. initial is a
state code or a law over the states, by default the law of each unit's state in its earliest
period. gamma is the sensitivity level, CHC's MSM Gamma and Bruns-Smith and Zhou's
Lambda (the module says how the two meet), on weight_box: "odds", Tan's model at
the logged propensity, or "density", the box [1/Gamma, Gamma].
The premise, that the confounding is memoryless, is checked first, as the module says: where
the log's innovations persist within units at persistence_alpha, the evaluation is refused.
At gamma = 1 the three values are the plain fitted evaluation, each cell's mean, exactly.
Raises:
| Type | Description |
|---|---|
PersistentConfounding
|
where the premise's check rejects at |
KeyError
|
on logs without one of the six entries. |
ValueError
|
on |
stepwise_breakdown(logs, plan, *, threshold=None, baseline=None, initial=None, weight_box='odds', persistence_alpha=_PERSISTENCE_ALPHA)
¶
Gamma*, the least sensitivity level at which plan's lower value falls below
threshold, or below baseline's nominal value on the same log. Research.
logs, plan, initial, weight_box and persistence_alpha are
stepwise_robust_value's; baseline is a plan over the same horizon, evaluated at
Gamma = 1 from the same initial law. Exactly one of threshold and baseline is given.
The lower value is continuous and non-increasing in Gamma, so Gamma* is the crossing
of the comparator: a search doubling Gamma from 1 brackets it, and a bisection in
log Gamma narrows the bracket to a relative 1e-6. gamma_star is its upper end, a
level at which the lower value was read below the comparator, and gamma_held its lower
end, at which it was not. gamma_star is 1 where the nominal value is below the comparator
already, and inf where the lower value's limit as Gamma -> inf,
e E[Y] + (1 - e) min Y per cell on the odds box and min Y on the density box, is not.
Raises:
| Type | Description |
|---|---|
PersistentConfounding
|
as |
KeyError
|
as |
ValueError
|
where neither or both of |