Skip to content

chc.dynamics_id

Stability tier: stable.

Causal identification of the residual's control channel, not just of a scalar effect.

chc.train fits a residual by prediction error. Under a confounded logging policy that is the wrong object: if the historical action was chosen from a covariate that also drives the state, then d(dx/dt)/du fitted on (x, u, x_next) is the observational response, and a controller that optimises against it moves the state the wrong way. That is the same failure the scalar headline benchmark shows -- and until now nothing protected the residual from it.

This module closes that gap with Robinson partialling-out lifted from a scalar effect to a state-dependent matrix. With nuisances g(x,z) = E[y | x,z] and m(x,z) = E[u | x,z], where y = (x_next - x)/dt - f_known(t, x, u) is the part the residual must explain::

y - g(x,z)  =  B_θ(x) (u - m(x,z))  +  eps,     E[eps | x, z, u - m] = 0

so the estimator regresses the residualised state rate on the residualised action, with K-fold cross-fitting of both nuisances. Neyman orthogonality is what buys the guarantee: the channel error is second order in nuisance error, which is exactly the order transfer p -> 2p of chc.research.regret.composition_transfer_certificate and the per-channel debiasing by cross-fit Robinson DML of chc.research.regret.multichannel_control_certificate. This module is those results' missing consumer, not a new one.

HONEST SCOPE, four limits worth stating before the code:

  • Only the channel B_θ is interventional. a_θ is fitted on the remainder and therefore absorbs whatever the omitted confounder contributes to the drift in-sample, so it is an observational-conditional drift. Planning is unbiased in the direction the optimiser moves; the predicted trajectory level still shifts if the confounder's distribution does. On real data this bites harder than it sounds: a confounder that trends with the state gets charged to positive feedback in x, so the fitted drift can come back unstable even where the channel is clean -- and an MPC uses the drift too. Check the drift's spectrum, and give measured exogenous drivers a place in the drift as regressors instead of leaving them only in adjust_for. The adjustment set joins the drift regression under either integrator, so a_θ is conditional on it, at its mean on the log; under integrator="rk4" a push left out would reach the channel as well, since RK4 carries the drift into it.
  • The residual must be control-affine (chc.residual.ControlAffineResidual). A general r_θ(x, u) has no partialling-out moment and gets no guarantee here.
  • With no adjustment set and no instrument nothing in the log identifies the channel, unless the caller knows the actions are unconfounded given the state (unconfounded=True), and an instrument identifies it only along the directions it moves the action. The estimator reports identified=False in both cases rather than returning a confident wrong answer -- that case belongs to chc.research.sensitivity, which prices the radius instead of pretending it away.
  • The premise is Markov: given x, z and u, a transition's noise does not depend on the past. Where the noise persists within a unit and a lever persists too, the state is a common effect of the past lever and the past noise, so E[eps | x, z, u - m] is not 0 and the channel is biased by an amount channel_error does not cover. persistence_check reads the noise's persistence off the moment's residual; adjusting for the state, the levers and z a period earlier removes the bias where the noise is AR(1) (ADR 0064).

Integrator = Literal['euler', 'rk4'] module-attribute

Which one-step map the fit is asked to be consistent with. See fit_causal_residual.

RegionForm = Literal['ridge', 'grid'] module-attribute

channel_region's radius. ridge: Abbasi-Yadkori, Pal and Szepesvari's (2011), its log-determinant read against the fit's own ridge. grid: Simpson, Baumgartner, Koehler and Diehl's (2026, Theorem 2), the least over a fixed grid of prior matrices, the prior's term inside the root. Experimental.

ConfoundedControlAffineSystem dataclass

Euler-logged dx/dt = f_known(x,u) + A x + B_true u + C z under u = K z + eta.

The vector-state analogue of chc.causal.ConfoundedLinearSystem and the DGP fit_causal_residual is scored against. z is the confounder: it drives the logged action through K and the state rate through C, so with z withheld the response of the rate to the action is B_true + C sigma_z^2 K^T / var(u) rather than B_true, where var(u) = K K^T sigma_z^2 + G G^T + sigma_eta^2 collects every source of action variance.

A scalar channel with B=1, C=2, K=-1.5, sigma_z=1, sigma_eta=0.5 and no instrument gives 1 - 2*1.5/2.5 = -0.2: the sign flip of the headline benchmark, reproduced per channel. Turning the instrument on adds G G^T to that denominator and dilutes the bias toward zero -- the exogenous shifter makes the log more informative, so the observational fit looks less wrong while being no more identified. Worth knowing before reading a number off it.

The Euler discretisation is deliberately the one fit_causal_residual inverts, so a failing recovery test means the identification is wrong, not that the integrator disagreed.

sample(n, key, known)

Draw n transitions: x (n,d_x), z, u, x_next, w (instrument).

CausalDynamicsFit dataclass

A fitted causal residual next to what is and is not known about it.

identified is the load-bearing field: False means nothing the fit was given pins the channel down from the log -- no adjustment set and no instrument, an instrument whose moment falls short of rank (instrument_rank), or a log that moves no direction of the channel (unmoved) -- and the residual is then the observational fit, kept only so the caller can compare.

error_cosines property

nu, the cosines of the periods the channel's error was read with where the fit was given periods, counted over the distinct periods, and the degrees of freedom of the t a test read off it is sized against; None where it was given none.

OmittedConfounderBound dataclass

How far a confounder the adjustment set left out could move a linear functional of the channel, and how strong it would have to be to move it to null. Experimental.

bias_scale is identified; strength is the analyst's, as Gamma is (docs/concepts/gamma.md), in partial R^2s rather than odds.

ChannelRegion dataclass

A region that holds the fitted channel's coefficients at a stated level, from one log.

Experimental: it may change or be withdrawn in any release. State s's coefficients c_s (the channel's row s, raveled lever by lever, each lever's features in turn) lie in {c : ||c_hat_s - c||_V <= radius[s]} for every state at once with probability at least level. V = D'D + ridge P is the matrix the fit's least squares solved, D the channel's design on the action residuals. channel_region says where it holds, and form which radius it reads (RegionForm).

contains(channel)

Whether every state's row of channel, shaped as channel, lies in its ellipsoid.

operator_radius(state)

A bound, at the region's level, on ||B_hat(x) - B(x)||_2 at the state x: the largest move of the rate that the channel's error makes per unit action norm. It holds at every state at once, since each is read off the same ellipsoids.

rate_error(states, reach)

A bound, at the region's level, on ||(B_hat(x) - B(x)) a|| over the (N, n) states and every action deviation a with |a_j| <= reach[j]: the rate error that the plan's tube reads as a standard error at its studentised quantile (chc.decision's _model_error and _field_scale), read here at a level. The largest of a convex form over a box is at a corner, so it reads the 2^m corners.

stability_level(rho, state)

The largest level at which operator_radius at state is within rho: the probability the region gives that the channel's error there is at most rho, 0 where no level reaches it.

A certainty-equivalent gain whose stability holds within a radius rho of the channel (chc.research.regret.ce_explicit_constant_certificate) then stabilises the plant with at least this probability. That certificate's rho is the true plant's, and its channel is the discrete step's, dt times this one under Euler: pass its radius over dt. Read at the estimate, rho is the estimate's, which the region does not check.

Solves sum_s (R_s A + b_s)^2 = (rho / g)^2 for A, g the operator radius per unit of the radii, and A^2 = 2 log(n / delta) + log_det_ratio for delta (validation/tube_levels.mac).

PersistenceCheck dataclass

Whether a fit's transition noise persists within units, read off its channel moment's residual by persistence_check. Experimental.

The fit's premise is Markov: given the state, the levers and the adjustment set, a transition's noise does not depend on the past. Where the noise persists within a unit and a lever persists too, the state is a common effect of the past lever and the past noise, so given the state this period's lever and noise move together, and the channel is biased by an amount its error does not cover (ADR 0064). And a fit given neither clusters nor periods reads the error of its drift and of the adjustment set's push at its mean on the log, which the tube carries, from its rows taken as independent: where the push persists as AR(0.8), that read of the mean's variance is 1/8.8 of the mean's own at 200 rows, 1/9 on a long log (ADR 0133). Given either, both are read from the clusters' sums or the periods' cosines, as the channel's error is.

InterferenceCheck dataclass

Whether a fit's transitions move with their neighbours' levers, read off its channel moment's residual by interference_check. Experimental.

The fit's premise is that a unit's transition depends on its own levers alone. Where a unit's levers move its neighbours' states as well, drivers or customers moving between zones, the residual carries the neighbours' push, and the channel is the effect of moving one unit with its neighbours held, not of a plan that moves them all (ADR 0113).

LagCheck dataclass

Whether a fit's moment residual moves with its levers some periods back, read by lag_check. Experimental.

The fit's premise is that a period's lever moves the state over that period alone. Where the plant takes the lever some periods late, a dead time, the residual carries the late levers' push, and the channel reads the share of it the current lever is correlated with.

ClosedLoopAttribution dataclass

Which coefficients of a control-affine fit the log identifies, on a tracked plant.

ClosedLoopAttributionCertificate dataclass

Two arms: an interaction the plant has, and one the tracking loop manufactures.

solve_channel_moment(state_residual, action_residual, states, *, instrument_action=None, degree=1, ridge=1e-06, weights=None)

Solve E[(y_res - B_θ(x) u_res) (x) (z (x) phi(x))] = 0 for the channel.

The Robinson moment on its own, separated from the nuisance estimation fit_causal_residual wraps around it. Public for two reasons: cross-fitted ridge-sieve nuisances are a default rather than a commitment, and the point of a debiased score is that g and m may come from any learner -- gradient boosting, a neural net, a model the caller already had -- so the caller needs a way in that does not go through ours.

It solves the moment it is handed and checks no rank. Along a direction of the channel that instrument_action does not move, the moment holds at every channel, and the ridge picks one. Whether an instrument identifies the channel is the caller's to settle before the solve, which sees neither the raw shifter nor the covariates the nuisances took out, and a rank that decides it reads both.

Parameters:

Name Type Description Default
state_residual Array

y - g(x, z), shape (N, n).

required
action_residual Array

u - m(x, z), shape (N, m) -- the regressor.

required
states Array

x, shape (N, n) -- the channel's own feature argument, which is not residualised: B_θ is allowed to depend on the state.

required
instrument_action Array | None

the action-shaped variable z that enters the moment, when it differs from the regressor: the projection of the action on an exogenous shifter, for the case where the confounder is latent. None means the action residual instruments itself, which is the orthogonal (adjusted) case.

None
degree int

monomial degree of B_θ's dependence on the state.

1
ridge float

Tikhonov term on the moment's Gram matrix, on each coefficient scaled by its regressor column's mean square, weighted as the rows are, so that it reads the same in any units of the actions and the state. Added as a constant, it outweighed actions logged in units a millionth of their own, and set their channel near zero.

1e-06
weights Array | None

one weight per transition, shape (N,), on its moment; None weighs all alike. A weight that is a function of the state alone keeps the moment orthogonal (see fit_causal_residual). Experimental: it may change or be withdrawn in any release.

None

Returns:

Type Description
Array

The channel coefficients, shape (n, m, n_features), consumable directly as

Array

attr:chc.residual.ControlAffineResidual.channel.

fit_causal_residual(known, data, dt, *, adjust_for=(), instrument=None, unconfounded=False, degree=1, channel_degree=None, nuisance_degree=2, nuisance_knots='auto', nuisance_choice='prediction', folds=2, ridge=1e-06, seed=0, integrator='euler', drivers=(), weights=None, influence=False, clusters=None, periods=None, times=None)

Fit a ControlAffineResidual whose channel is the interventional control response.

Parameters:

Name Type Description Default
known Dynamics

the physics kept fixed; its own control dependence is known, not estimated.

required
data dict[str, Array]

columns x (N,n), u (N,m), x_next (N,n), plus any named in adjust_for and instrument.

required
adjust_for tuple[str, ...]

observed confounders. Empty, with no instrument and unconfounded false, => identified=False. identified says what the fit was handed, not that the set is enough: a column of noise adjusted for reads identified.

Each covariate that is not a driver also joins the drift regression, held over the step at its value at the start, about its mean on the log, under either integrator. A push the drift leaves out moves the drift by its lean on the state. On x' = x + (-0.7 x + 0.8 u + z), the Euler map at dt = 1, a confounder z leaning on the state by 0.5 and left out of the drift, as "euler" left it up to 0.20.1, set the decay at -0.195 over 60 logs of 1000 transitions, its 95 % interval covering -0.7 on none; drawn apart from the state, it left the drift's error 99 times what it is with the push held. Held, the decay reads -0.700 on both, covering on 93 % and 98 %. Under "rk4" the drift also reaches the channel, through RK4's growth factor, where the moment cannot see it: on x' = -0.7 x + 0.8 u + z at dt = 1, the confounder leaning on the state by 0.5 and left out of the drift set the channel at 0.618 over 60 logs, its 95 % interval covering 0.800 on none; drawn apart from the state, it scattered the channel 13 times as far as its error said, which covered on 10 %. Held in the drift, both read 0.800 and covered on 97 %. The push is held in the nuisances' own basis in those covariates alone: their polynomial of nuisance_degree, at 1 at the least, and their spline where nuisance_knots gives one. Held linearly, as up to 0.19.0, a push the nuisances hold and the drift did not, 2 z + 1.5 (z^2 - 1) on x' = -7 x + 8 u at dt = 0.1, scattered the channel 42 times as far as its error said over 100 logs of 1000 transitions, which covered on 3 %; held in their basis, 1.02 times over 60, covering on 93 %, as the linear push does. A push that moves with the state, x z, is not one a step holds, and is not held. The returned field carries no covariate: its drift is the one at their mean, and its defect keeps their push.

A push outside the polynomial's span, 3 tanh(2 z) on that plant, is in neither with the polynomial alone (nuisance_knots=None), and channel_error reads it in the moment's residual as if it were noise: there the channel scattered 0.73 as far as its error said under "euler" and 0.75 under "rk4", and its interval covered on 98 % of 60 logs. Conservative, not wrong; a push the nuisances miss is a sign they miss the policy too (nuisance_shift). At the default the spline was read on 28 of those 60 logs, and there it holds the push: under "euler" the channel's error came out 40 to 62 times smaller on the four of the first twelve logs that read it, and over the 60 the interval covered on 97 % under either integrator.

()
instrument str | None

name of an exogenous action shifter, for when the confounder is latent. It enters as the moment's instrument, not as the regressor, so this is real 2SLS. Expect a variance premium, not a free lunch: identification here rides on however much of the action the shifter explains, and on the reference DGP that is 18%, which costs roughly an order of magnitude in channel error against adjusting for a logged confounder (0.10 vs 0.002 at N=4000). Still ~10x better than not identifying at all.

It identifies the channel only where its moment has rank: where the first stage's push on the actions moves with the actions along every direction of the channel the actions move (all but unmoved's), each less what the covariates' features predict, read without the ridge and in any units (CausalDynamicsFit.instrument_relevance), and the actions move one at least. Short of that rank, the moment holds at every channel along a direction it misses, and the fit reads as one with no adjustment and no instrument: identified=False, method="observational", the channel of the action residuals as their own instrument, kept to compare, and no error. It does so beside adjust_for too: naming an instrument says the covariates leave a confounder, so the fit does not fall back on them. Without the check an instrument of zeros read identified, the channel set by the moment's ridge and noise: on the reference plant [0.81, -0.06] with an error of 6.0, where the truth is [1.0, 0.5]. At nuisance_degree=0 the first stage is a constant, which no instrument enters, so no instrument has rank there.

The rank does not grade an instrument: a column of noise drawn apart from the action keeps it, and reads identified with a channel that misses. Its relevance grades it: on the reference plant such columns read 0.002 to 0.035, the medians of eight at 500, 2000 and 8000 rows, of the order of 1 / sqrt(N), where the plant's instrument read 0.39 to 0.48. No inference here is robust to a weak instrument.

None
unconfounded bool

the caller's claim that the state and the drivers alone leave the actions unconfounded -- a randomised lever, or one set by the state alone -- as a graph whose adjustment set is empty proves. The fit is then the orthogonal one with the state and the drivers as its only covariates, identified=True with its errors, as with an adjustment set. Without it an empty set read "observational", with no error and no moment residual, though its channel is the same number. Not with instrument, which says the actions are confounded.

False
degree int

the feature degree of the drift, and of the channel unless channel_degree says otherwise. 1 fits an affine drift and, by default, a channel affine in the state, which contains the constant channel the orthogonality results cover without being restricted to it.

1
channel_degree int | None

the feature degree of the channel; None is degree. 0 fits the constant channel the orthogonality results cover beside a drift of degree degree: n m coefficients where the affine channel has n m (n + 1), and as many fewer tangents in the rk4 fixed point. An affine channel is as accurate as a constant one only where the log is centred. On eight logs of chc.zones.ZoneMarketSystem, against one RK4 period's response (scripts/bench_channel_degree.py), the constant channel was 3.6% (linear matching) and 4.6% (harmonic) off in relative RMS wherever it was read; the affine one was as close at the logs' mean state, 16% off at the do-nothing point and 159% and 123% at x = 0, where chc.decision.Prescription.reach read it up to 0.12.

None
nuisance_degree int

flexibility of g and m. Richer nuisances are the whole point of cross-fitting -- orthogonality is what makes their error enter only at second order. Second order in an error that shrinks: the nuisances are polynomials of this fixed degree, and a policy or a drift outside their span leaves an error that does not shrink with the log, and a bias in the channel that does not either, which channel_error does not cover. On a lever set by -1.5 tanh(2 x) and a drift with sin(2 x) in it, with the polynomial alone (nuisance_knots=None) at the default degree 2, the channel came back 0.61 below its truth of 1 at 1000 rows and 0.62 at 4000, 26 and 57 of its errors, on none of twelve logs within its 95 % interval. Refit at a higher degree, or with more knots, and read how far the channel moves in its errors (nuisance_shift): a move of more than one or two says the nuisances miss. There, at 4000 rows, degree 3 moved the polynomial's by 0.22, 20 of its errors, and degree 5 by 0.44. A higher degree is no cure: a polynomial of high degree fitted on one fold runs off in the other's tails, and at degrees 5 to 11 the channel scattered up to 2.3 times as far as its error said.

2
nuisance_knots int | Literal['auto'] | None

a natural cubic spline in each covariate, at this many of its quantiles, beside the polynomial of nuisance_degree; "auto", the default, takes ceil(N^(1/3)) knots, which grow with the log; None adds none, and the nuisances are the polynomial alone, the default up to 0.19.0. The spline's error at a smooth nuisance shrinks as its knots grow, so the moment's second-order bias shrinks faster than its error. The spline with a covariate's powers past the first, the spline without them, or the polynomial alone is read, whichever predicts the other fold the better (_chosen_sieve, under the default nuisance_choice): beside a spline the powers are read off the rows past the outer knots alone, and on heavy tails a row of the other fold far out read them at the power of its distance; without them a quadratic nuisance is a line there. On the plant above, "auto" left a bias of 0.0021, 0.0003 and 0.0002 at 1000, 4000 and 16000 rows, 0.13, 0.04 and 0.08 of the channel's error, and its 95 % interval covered on 0.960 and 0.965 of 200 logs and 0.967 of 30. Where the polynomial holds the truth it scattered as wide as the polynomial alone, or less: 1.00 times on a linear plant over 200 logs of 1000 rows, both covering on 0.965; 1.01 and 1.00 times at 500 and 2000 rows with normal covariates, 0.67 and 1.00 with t(3) ones, 0.43 and 0.76 with lognormal ones, and 1.00 with a nuisance quadratic in a normal or t(5) confounder at 1000 and 4000 rows, each over 100 logs. The spline is additive: the covariates' joint shape beyond it is the polynomial's, so a confounder that enters through a nonlinear interaction of two covariates is still outside the span. Read nuisance_shift against a fit with more knots or a higher degree. At None, an identified, unweighted fit without an instrument solves its channel's moment once more on "auto"'s nuisances, at its own target, and warns where that moves the channel by more than three errors of the move, or as far into a t's tail where the error is read off few clusters or periods, t(9)'s 4.1: the polynomial then misses the log's nuisances, and channel_error does not cover the bias. The fit returned is the polynomial's. Under euler that channel is a refit's; under rk4 one Newton step through the fit's own Newton matrix carries it to a refit's fixed point. The move's error pairs the two fits' scores row by row, so it holds whichever fit is the more efficient. It fits nothing more. On the plant above, at 2000 rows, the move read 31 to 44 of its errors and the fit warned on 40 of 40 logs; on 200 logs of the linear plant it read 0.90 at most, and 1.6 where the noise grows as exp(x), and warned on none. Read in the fit's own errors, as up to 0.19.0, a spline that scatters more than the polynomial moved it past three on 12.5 % of linear logs with t(3) covariates, and a log the known physics solves exactly read a ratio of two roundings. Under a weight exp(-x) that reading passed three on 23 %, so a weighted fit is not checked.

'auto'
nuisance_choice Literal['prediction', 'score']

what the three sieves are chosen on. "prediction", the default, reads each nuisance's out-of-fold mean square over its column's variance, summed. "score" reads the logs of the out-of-fold mean squares of the action's residual and of the moment's score, the target's residual less its least-squares fit on the action's in the channel's design, each column in its own units (ADR 0165). The target's residual holds the channel times the action's noise, and beside it a push the polynomial misses can be small in the target's units and large in the score's. On x' = -7 x + 8 u + 3 tanh(2 z), RK4 at dt = 0.1, u = -z + 0.5 a, noise 1e-3 and 1000 rows, the polynomial's channel error was 50 to 55 times the spline's on average; "prediction" chose the spline on 28 of 60 logs and "score" on 60, and the channel's root mean square miss fell from 0.029 to 0.00083 under euler and from 0.045 to 0.0012 under rk4, both covering on 0.967. On every design above, and on the quadratic pushes under rk4, the two choices agreed on 84 to 100 % of the logs and the channel's scatter moved by at most 1.4 of its paired Monte Carlo errors. Experimental: it may change or be withdrawn in any release.

'prediction'
folds int

cross-fitting folds. 1 fits the nuisances on the same rows it residualises. That is not biased for the default nuisances and should not be sold as such: residualising y and u by the same linear projection whose span contains the truth is Frisch-Waugh-Lovell, so own-sample partialling-out is exactly unbiased and out-of-fold prediction only adds variance -- measurably worse at small N. Cross-fitting earns its keep against learners whose fit is adaptive to the sample (feature selection, trees, early stopping) or saturated enough to memorise it, where own-sample residuals collapse; folds>=2 is the safe default for that reason. With one fold the sieve's choice (nuisance_knots) reads its own rows, where the spline with the powers, the larger basis, always predicts better and is read.

2
ridge float

the Tikhonov term of the nuisances, the channel's moment, the drift regression and the instrument's first stage. The nuisances read standardised covariates. The drift regression and the first stage scale each slope's term by its column's variance, beside a free bias; the moment, which has no bias, scales each coefficient's by its column's mean square, on the log's raw actions. So the ridge reads the same in any units of the state, the actions, the drivers and the instrument. Added as a constant, it outweighed a column logged in units a millionth of its own: such actions read a channel near zero, and such a state a drift slope near zero.

1e-06
integrator Integrator

the one-step map the fitted field is made consistent with.

"euler" (default, and what every release so far did) reads the rate off the log as (x_next - x)/dt, which is exactly right if the caller treats the result as a discrete-time model and steps it the same way, as chc.decision.prescribe does under integrator="euler". It is not right if the caller then integrates the field with RK4, as chc.plan.causal_plan and chc.integrate.rollout do with any field not marked as an Euler map: the two disagree by the RK4 amplification factor 1 + z + z^2/2 + z^3/6 + z^4/24 at z = A dt. On a linear plant at theta*dt = 0.7 that is a decay fitted at -0.502 against a true -0.700 and, more to the point, a control channel fitted at 0.574 against a true 0.800.

"rk4" makes the field consistent with RK4 instead, without inverting RK4 in closed form, which does not exist for a nonlinear field. Coefficients read a rate off the log: their own fitted rate plus what their RK4 step leaves of x_next. The rk4 fit is the one the estimator returns when handed its own reading, found by Newton's method from the Euler fit in three to six steps between |A|dt = 0.05 and 1.2. Measured on the same plant, it recovers -0.699 and 0.800. Its standard errors are the fixed point's own (CausalDynamicsFit.channel_error).

Up to 0.6.0 the fixed point was iterated instead -- add the leftover to the target, refit -- and each state stopped once its defect's RMS stopped falling. That is not where the fixed point is: the RMS flattens under the noise first, and the iteration contracts the drift only by 1 - (1 + z + z^2/2 + z^3/6) a pass, 0.51 at z = -0.7. Even run until the RMS stopped falling at all, it stopped 0.9 standard errors of the channel and 1.4 of the decay short at theta*dt = 0.7 and N = 1000, and 0.09 of the decay short at 1.25 on a log solved exactly.

A log that falls by more in one step than RK4 can follow has no rk4 reading at all. RK4's growth factor bottoms out at 0.2704, at z = -1.596, and an exact linear mode falls below that past |A|dt = 1.308. The fit raises there rather than return a field that is neither reading. A channel that reads the state can run out sooner: on the plant in chc.research.mmm with its fastest channel decaying at theta*dt = 1.2, one seed in eight stalls in that channel's dependence on its own adstock, at a gap a damped Newton cannot close either, at both precisions. integrator_defect floors at the noise under both.

The default stays "euler" so no shipped fit changes meaning. chc.decision.prescribe defaults the other way, because it knows the field goes to the planner.

'euler'
drivers tuple[str, ...]

exogenous columns that push the state and that nothing the plan does can move -- weather, a demand forecast. data carries each at the start of the transition under its own name and at the end under f"{name}_next", and between the two it moves linearly, which is how chc.dynamics.DrivenDynamics replays a forecast and what the rk4 fit steps. Each enters the drift regression jointly with the state features, so the drift stops carrying the driver's correlation with the state (this module's first scope note): at its mean over the step under rk4, the push a linear path puts into a step, and at the start under euler, all the Euler map reads. Both ends join the channel's nuisance covariates. A logging policy that reads the forecast sets the action on where the driver is going, and with the start alone that is confounding: on a random-walk driver logged that way the euler channel came back 0.656 against the Euler map's own 0.780. Partialling out is safe for any driver, since a column nothing downstream of the action moves can be neither a mediator nor a collider of its effect. The fitted gain is CausalDynamicsFit.driver_gain; its standard error is inside drift_error.

()
weights Callable[[Array], Array] | None

a weight on each transition's channel moment, a function of its state alone. Experimental: it may change or be withdrawn in any release. A callable is called with x (N, n) and nothing else, since a weight that reads the action or the next state biases the channel at first order, while any weight on the state keeps the moment orthogonal. The weights are scaled to mean 1. The channel's standard error is robust, as for every fit, and here it has to be: a weight that loads a few rows loads the nuisances' error at them too. effective_sample_size says how few.

Under a channel class that contains the truth every weight estimates the same channel, and only the variance moves. The inverse of the rate's noise variance is the efficient weight in the limit, but it loads the states where the noise is small, which can be where the nuisances extrapolate: on a log whose rate noise ran exp(-x/2) against the action's exp(x/2), the channel scattered 0.87 as far as the unweighted fit's at N = 64000, its limit, and 1.15 as far at N = 4000.

Under a class that misses the truth, each weight estimates a different channel: the projection of the true one under w s^2 times the log's law of states, where s^2(x) is the variance the adjustment set leaves in the action at x. The weight then chooses where the fit is right. For a one-shot decision on a scalar action, made at states drawn from Q with regret curvature kappa(x) in the channel, w = kappa (dQ/dP) / s^2 makes the fit the best of its class for that decision. A weight that has to be estimated first -- s^2, or the inverse noise -- carries its own error into the channel at first order there, since the estimand moves with the weight. No weight on the state alone serves a dynamic plan, which reads the channel's slope along its path as well as its level: there the costate weight left 36 to 178 times the regret of the best fit in the class.

None
influence bool

whether to keep each transition's influence on the fitted parameters, CausalDynamicsFit.influence, which chc.misspecification.misspecification_cost reads to compare two fits of one log, and beside it the channel's representer, which omitted_confounder_bound reads with the moment residual. Off by default: under euler it costs a reverse pass per parameter rather than per channel coefficient, and it is N n p numbers the fit then carries, and N n q more.

False
clusters ndarray | Array | None

each transition's cluster, N labels of any one sortable kind, at least two distinct; one cluster's transitions are read across their periods by periods instead. The channel's covariance then sums each cluster's scores over its transitions and states before squaring them, CR1 with the factor G / (G - 1) (N - 1) / (N - k) over G clusters and k coefficients a state, so it holds whatever the dependence within a cluster; and a reader of influence sums its rows the same way, as drift_error and the error of the adjustment set's push at its mean on the log, which the tube reads, are read (ADR 0133). None takes every transition as independent of the rest, its states summed first since they may share its noise, which a log of units followed over time breaks wherever the model leaves out something that persists: the transitions of one unit then share it. The estimate does not move; only its error does. On panels of 5 to 80 units whose noise persists within each unit, a 5 % test of a zero channel rejects 12.25 % to 35 % of the time row by row and 4 % to 14 % by unit: CR1 still over-rejects with few clusters (ADR 0053). Two labels a transition, shape (N, 2), cluster it two ways, by its unit and by its period say. The error is then the largest of three (MacKinnon, Nielsen and Webb 2024): the two dimensions' sums less their intersection's (Cameron, Gelbach and Miller 2011), at CR1's factor for the smaller dimension's G and less any part that reads below nothing; and each dimension's sums alone, at its own. A shock every unit shares in a period, met by levers every unit moves together, makes one period's scores move together across units, which a sum within units leaves out (ADR 0061). A missing label, None, nan, NaT or pandas' NA, is refused.

None
periods ArrayLike | None

each transition's period, a whole number of steps, on a log whose transitions fall in one group, one unit's or the units' of one declared cluster, which leaves no second cluster to sum within: one label a transition, two periods at least. The channel's covariance then sums the scores of each period's transitions over them and their states, and reads the sums' dependence across the periods by nu cosines of them, the equal-weighted cosine estimate with nu the most whole cosines at or below 0.4 T^(2/3) for T distinct periods (Lazarus, Lewis, Stock and Watson 2018), at the rows' factor N / (N - k), and a reader of influence sums its rows the same way, as drift_error and the error of the push's mean on the log are read (ADR 0133). Summed within each period first, it holds whatever the dependence between one period's transitions, as between units that share a shock (Driscoll and Kraay 1998). A test read off it is sized against t(nu) (CausalDynamicsFit.error_cosines). None takes the transitions as independent, which a unit's persistent noise met by a lever that persists breaks: the scores, each the lever's residual times the noise, then persist too. On one unit of 200 transitions whose noise is AR(0.9) and whose lever is AR(0.7), a 95 % interval covered the channel on 0.740 of 1000 logs row by row and on 0.938 by cosines, and with the polynomial nuisances alone on 0.724 and 0.941 of the same logs (0.703 and 0.925 on ADR 0075's draws); where the noise is drawn afresh, the cosines' interval is 11 % wider. On three units of one cluster over 200 periods, which share a shock AR(0.9) and half their lever AR(0.7), it covered 0.692 row by row and 0.934 by the period sums (ADR 0075). Periods no two of which are one step apart are read as given, each step between them holding no score, and the fit logs a WARNING naming their least spacing: periods counted in a finer unit than the step, as days of a weekly log, stretch the span the cosines read by it.

None
times ArrayLike | None

each transition's start time, N finite numbers, where known reads the time: the known physics is called, and each step is taken, from there. None starts every transition at t = 0, which is right for a known that does not read the time and nothing else: a seasonal known push read at t = 0 throughout leaves the season in the rate, and a logging policy that follows the season then confounds the channel with it: on a log of 3000 Euler steps the channel came back 1.35 where it is 1.0, 37 of its errors off. So None is refused where known reads the time: where its rate on the log's first 8 transitions moves by more than rounding between t = 0 and t = 1000 sqrt(2), irrational so that no rational period hides the move.

None

Returns:

Name Type Description
A CausalDynamicsFit

class:CausalDynamicsFit. Read identified before residual. A log that moves

CausalDynamicsFit

no direction of the channel apart from what the states and the covariates predict, a lever

CausalDynamicsFit

held constant or set by its own covariate, leaves identified=False and no error, as

CausalDynamicsFit

with no adjustment set; where it leaves any direction unmoved, the fit logs a WARNING

CausalDynamicsFit

naming the levers by their columns of u (CausalDynamicsFit.unmoved).

Raises:

Type Description
ValueError

on an integrator that is neither "euler" nor "rk4", which up to 0.18.0 was read as "euler"; on a negative channel_degree; on nuisance_knots other than "auto" or an integer of at least 3; on clusters that do not label every transition once or once in each of two dimensions, or name fewer than two clusters in a dimension; on periods that do not label every transition once with a whole number, or name one period alone, or that come with clusters; on an rk4 fixed point that does not converge; on a covariate named u or x_next, an instrument or a driver named x, u or x_next, a driver named twice, or an instrument that is also a covariate or a driver, at the step's start or its end. Each would read a column the fit reads in another role: adjusted for the action, the channel came back as the confounded regression's. On unconfounded=True with an instrument. On times that are not one finite number a transition, and on times=None where known reads the time. On clusters that hold a missing or a masked label.

omitted_confounder_bound(fit, functional, *, cf_y, cf_d, rho=1.0, level=0.95, null=0.0)

Bound a linear functional of the channel against a confounder adjust_for left out. Experimental.

Chernozhukov, Cinelli, Newey, Sharma and Syrgkanis (2022) bound the bias of a linear functional of a partially linear fit by |rho| sqrt(cf_y cf_d / (1 - cf_d)) sigma nu: sigma^2 the rate's residual variance after the fit, nu^2 the second moment of the functional's Riesz representer, both identified, and two shares that are not. cf_y is the share of that residual variance the latent explains; cf_d the share of the long representer's second moment the fit's short one misses, which for one lever is the latent's partial R^2 with it. rho is the correlation between the two gaps, 1 at the worst. On a linear Gaussian plant with one latent the bound is attained, for any functional of any number of levers, and with two latents it is strict unless they move the lever and the rate in proportion (validation/omitted_confounder_bound.mac). Over several states the bound sums sigma_s nu_s, taking the shares as common to them; under Euler a functional of one state's channel reads that state alone.

functional weighs the channel's coefficients, in its shape (n, m, n_features). One lever's effect on one state is a single 1. Moving spend from lever a to lever b is +1 at b and -1 at a, and since its value is linear in the channel, its robustness_value is the confounding at which the move stops paying.

The sampling error follows DoubleML's: each confidence bound is one-sided at level, and carries the estimate's influence and bias_scale's, whose nu^2 part is nu^2 - alpha^2 for a representer alpha. Its sign convention for the estimate differs from this one in the cross term of the two influences, which vanishes in expectation. A fit given clusters has both influences summed within each cluster, as its channel's error is, and one given periods reads them across its periods by cosines, each period's transitions summed first. The bounds take a t's quantile with G - 1 degrees of freedom, G the clusters, two-way the smaller dimension's count, or the rows where there are none; or nu, the cosines', under periods (ADR 0075). At 5 units, a 5 % test of the channel read off its error rejected 9.75 % and 14.75 % of panels against the normal's quantile, and 3.25 % and 5.75 % against t(4)'s (ADR 0062). DoubleML takes the normal's.

Parameters:

Name Type Description Default
fit CausalDynamicsFit

an identified fit of fit_causal_residual, by adjustment, unweighted, made with influence=True.

required
functional Array

the weight on each channel coefficient.

required
cf_y float

the share of the residual variance the latent explains, in [0, 1).

required
cf_d float

the share of the long representer's second moment the short one misses, in [0, 1).

required
rho float

the correlation of the two gaps, in [-1, 1].

1.0
level float

each confidence bound's one-sided level, in [0.5, 1).

0.95
null float

the value the robustness values measure the distance to.

0.0

Raises:

Type Description
ValueError

on a fit whose channel is not identified by adjustment -- an instrument's representer is not the moment's -- or that is weighted, or kept no representer; on a functional of another shape; on shares, rho or level outside their ranges.

channel_region(fit, level=0.95, *, bound=None, form='ridge')

The self-normalised confidence ellipsoid of the fitted channel, at level.

Experimental: it may change or be withdrawn in any release. Abbasi-Yadkori, Pal and Szepesvari (NeurIPS 2011, Theorems 1 and 2): for y_t = <X_t, c> + eta_t with X_t predictable and eta_t conditionally R-sub-Gaussian, the ridge estimate c_hat satisfies ||c_hat - c||_V <= R sqrt(2 log(det(V)^(1/2) det(V0)^(-1/2) / delta)) + ||c||_V0 with probability at least 1 - delta, V = V0 + X'X. The regressors need only be predictable, so a log the plant was controlled in qualifies: a closed-loop policy's actions move with the states and the noise before them. Here V0 = ridge P, the fit's own ridge, one ellipsoid a state at delta / n.

It gives the plan's rate error a level (ChannelRegion.rate_error) and the certainty-equivalent certificate a probability (ChannelRegion.stability_level), beside the standard errors the tube carries at their studentised quantile, which it does not move.

Premises, and where they fail:

  • No hidden confounder. The noise must be mean zero given the actions; a confounder the fit does not adjust for pushes the rate with the action, and the ellipsoid misses the channel, at any level.
  • No persistent noise. eta must be a martingale difference; AR noise is not, unless its lags are in the fit (persistence_check).
  • No shared shock the fit was not told of. Rows are read one at a time, so a shock every unit shares in a period, met by levers the units move together, adds up across the period's rows beyond each row's R: on 30 units over 20 periods sharing each period's shock, the 0.95 region missed the channel on 6.9 % of 1000 logs read row by row. A fit given clusters says which rows share their noise, and R is then read within them, below.
  • R is read off the log: each state's root mean square of the moment's residual, over N - q rows, a plug-in for the theorem's known R, which also counts the cross-fitted nuisances' error. The action residuals use nuisances fitted on other rows, so the regressors are predictable to the nuisance's first order only. Under the fit's clusters, R^2 is the larger of that and the most the state's scores D_i e_i, summed within the clusters and squared at CR1's factor, two ways the largest of the three reads the fit's error takes, reach in V's norm: the clusters' sums are then read as the theorem's terms.
  • The prior term ||c||_V0 is bound where given, else the estimate's own, a plug-in; at the default ridge it is about 1e-3 of the coefficients' effect on the rate.
  • The prior's scale is read off the log too. P is the diagonal of the log's mean squares of the channel's regressors, so V0 is a plug-in as R is: the theorem's V0 is fixed before the log. The grid's members are multiples of it, on the same terms.

form="grid", experimental, reads the radius of Simpson, Baumgartner, Koehler and Diehl (arXiv 2603.19073, 2026, Theorem 2), proved under the same premises: the noise conditionally sub-Gaussian with a known R, the regressors predictable, the true coefficients within ||c||_V0 of nought. It puts the prior's term inside the root, sqrt(||c||_V0^2 + R^2 (...)) where Abbasi-Yadkori et al. add it outside, and reads the log-determinant against a prior matrix V_bar near D'D rather than the fit's ridge, paying sqrt(1 + rho((V0 + D'D)^-1 V_bar)) for it: the least over a fixed grid of 65 members, V_bar = 0 and 2^j V0, each at delta / 65 (_grid_members). At the fit's ridge of 1e-6 the log-determinant against the ridge is the larger part of the radius, and the grid's is smaller: on 2000 closed-loop logs of x' = 0.9 x + 0.5 u + e, u = -0.6 x + e', 2400 rows, V0 = 1e-6 I, the median radius of the region of (0.9, 0.5) read 7.06 by Abbasi-Yadkori et al.'s form and 4.76 by the grid's; on 100 logs of 1500 rows of a feedback policy with an adjusted confounder, the channel's region at 0.95 read 1.69 and 1.16. Each held the truth on every log.

Under a hidden confounder an instrument's sign-perturbed sums (Szentpeteri and Csaji, 2023) stay valid; they are not built here.

Parameters:

Name Type Description Default
fit CausalDynamicsFit

an identified Euler fit by adjustment, unweighted, whose actions move every direction of the channel.

required
level float

the joint level over the states, in (0, 1).

0.95
bound float | None

an upper bound, for every state, on the true coefficients' norm in the ridge's metric, sqrt(sum_l ridge P_l c_l^2); None reads the estimate's.

None
form RegionForm

the radius (RegionForm): "ridge", the default, or "grid".

'ridge'

Raises:

Type Description
ValueError

on a fit that is not identified, read through an instrument, fitted under rk4, weighted, with a direction its actions never move, or with no ridge; a level outside (0, 1); a negative bound; or a form not named.

persistence_check(fit, units, periods)

The lag-1 autocorrelation of fit's moment residual within units. Experimental.

units and periods label the fit's transitions, N each: the unit, of any one sortable kind, and the period the transition starts in, a whole number of steps. Two transitions of one unit whose periods differ by one are a pair. Each state's residual is divided by its root mean square, so each state counts alike in any units. The pairs' products, summed over the states, are summed within each unit before the test, since the transitions of one unit need not be independent; the statistic is their total over its CR1 spread, each unit's sum less its pairs' share of the total, against t(G - 1) (ADR 0062). A fit given clusters says its units' noise moves together within them, several units' or one period's, so the units' sums are not independent: the products are summed within the fit's clusters instead, each less its pairs' share, two ways the largest of the three reads its error takes, against t(G - 1) for G the clusters, two ways the smaller count. On panels of 4 units a cluster over 10 periods, whose noise and levers share a shock each period within a cluster and do not persist, the 5 % test summed within units rejected 12.5 % of 1000 at 5 clusters and 16.2 % at 30; within the clusters, 4.9 % and 7.0 %. Two ways, the largest of the three is conservative where the noise moves with neither label: on panels of 50 and 200 units over 12 periods, clustered by unit and period, the 5 % test rejected 3.5 % and 2.0 % of 200 logs, where Cameron, Gelbach and Miller's sum of the two less their intersection rejected 7.5 % and 6.5 %; under AR(0.2) noise at 50 units it rejected 64.5 %, theirs 72.0 %. The unit clusters alone, at 5.5 % and 7.5 % there, rejected 43 % and 63 % of logs whose units shared a shock each period that did not persist, and the three 5.5 % and 6.0 %: the largest of the three stays, a test that undershoots its size where the units alone would hold it. Pairs of one unit alone, or of a fit given periods, whose units share one group's noise, are read across their periods instead: the products summed within each period, and the total over the spread of their projections on nu cosines of the pairs' periods, against t(nu), as the fit reads its error (ADR 0075). Pairs that all fall in one period leave no spread to read.

A rejection says the premise fails, not by how much the channel is off: that depends on how far a lever persists as well (PersistenceCheck). Adjusting the fit for the state, the levers and the adjustment set a period earlier removes the bias where the noise is AR(1): on panels of 200 units over 100 periods whose noise and lever are AR(0.7), a channel of 0.8 read 0.0130 low, 0.0007 low with them, and 0.0250 low with the state's lag alone (ADR 0064).

A residual that moves with a lever some periods back, a dead time, is lag_check's to read: the lag-1 autocorrelation does not name it.

Raises:

Type Description
ValueError

the fit kept no moment residual, as where its channel is not identified; the labels are not one a transition; a period is not a whole number; a unit has two transitions starting in one period; or the log spans two periods or more and no unit has two transitions one period apart, as on periods counted in days a week apart, where the check read no pair and returned nan without a word.

nuisance_shift(fit, refit, states)

How far a refit of one log with richer nuisances moves the channel, in the fit's errors: the root mean square over states, (N, n), and the channel's entries of B_refit(x) - B_fit(x), over fit.channel_error. Experimental.

The moment is orthogonal, so the nuisances' error moves the channel at second order only, but a policy or a drift outside their span leaves an error that does not shrink with the log, and a bias that channel_error does not cover. Refit with nuisance_knots, more knots or a higher nuisance_degree, and read the shift: within the span, both fits estimate one channel and the shift is a fraction of an error; a shift of more than one or two says the fit's nuisances miss. On a lever set by -1.5 tanh(2 x) and a drift with sin(2 x) in it, at 4000 rows, the degree-2 polynomial fit (nuisance_knots=None) read 53 to 61 errors from its refit with nuisance_knots="auto" on five logs, and that refit 0.02 to 1.9 from its own at twice the knots.

Raises:

Type Description
ValueError

if fit is not identified, so has no error, or the two channels differ in shape, so read different features of the state.

interference_check(fit, exposure, groups, periods)

Regress fit's moment residual on its neighbours' levers, within periods. Experimental.

exposure is (N, m): for each of the fit's transitions, the mean of each lever over the unit's neighbours in the period the transition starts in, nan where no neighbour is logged then; such a transition is left out. groups and periods label the transitions, N each: the group the errors are summed within, a unit or a declared cluster, and the period. The residual and the exposure are taken about their means within each period, so a shock every unit shares in a period, which the neighbours' levers may chase, moves neither. Each state's residual is regressed on the exposure; a slope's error is the CR1 sandwich over the groups' sums of scores, against t(G - 1), and the check's p-value Bonferroni's over the slopes.

Under the fit's premise the residual has mean zero given the unit's own states, levers and adjustment set, and a neighbour's lever is another unit's: its slope is zero. A rejection says the premise fails, by spillover or by a nuisance the fit misses that the neighbours' levers track; it does not say by how much the channel is off. Neighbours that are every other unit leave an exposure that within a period is the unit's own lever mirrored, which the check cannot tell from the unit's own effect.

Raises:

Type Description
ValueError

the fit kept no moment residual, as where its channel is not identified; or the exposure or the labels are not one row a transition.

lag_check(fit, data, units, periods, *, lags=3, adjust_for=())

Regress fit's moment residual on its levers 1 to lags periods back. Experimental.

data holds the columns the fit was given, x (N, n) and u (N, m), and those named in adjust_for, the fit's adjustment set; units and periods label the transitions as persistence_check reads them. A transition's lever k periods back is its unit's transition's that many periods earlier; a transition without all lags of them is left out. The residual and the late levers are each taken less their least-squares fit on a constant, the states, the levers and the adjustment set, the fit's own regressors, and each state's residual is regressed on the late levers (Frisch and Waugh 1933). A slope's error is the CR1 sandwich over the units' sums of scores, or the fit's clusters' where it was given them; each state's slopes are tested together by Wald's statistic against F(k, G - 1), and the check's p-value is Bonferroni's over the states. This is the residual test of a model's dynamic part, the residual's cross-correlation with past inputs (Ljung 1999, chapter 16).

Under the fit's premise the residual has mean zero given this period's state, levers and adjustment set, and an earlier lever reaches it only through the state: its slope is zero. A rejection says the plant reads a lever late. lag then names the lag that carries it; chc.irf.delay_estimate reads the delay off the response with an interval, and a state that carries the levers' last lag values holds a discrete dead time exactly (chc.delay.DelayedDynamics holds a continuous one). It sees what persistence_check cannot name: on the misspecification suite's two-state plant whose lever reaches it two periods late, 200 units over 12 periods, the check rejected on 6 logs of 6 and named lag 2 on each; on the same plant without the dead time it rejected at 0.05 on 5 logs of 60, its size.

It reads across groups, the units or the fit's clusters, and not along one group's periods as persistence_check does: on one unit, or one cluster, it has no spread to read and returns p_value nan and lag None, as it does where no late lever moves once the fit's regressors are held. With few groups it has little power: F(k, G - 1)'s tail is heavy at small G, and at two groups F(1, 1) rejects at 0.05 only past tan(0.475 pi)^2 = 161.

Raises:

Type Description
ValueError

the fit kept no moment residual, as where its channel is not identified; the columns or the labels are not one row a transition; lags is not a positive whole number; a unit has two transitions starting in one period; or the log spans two periods or more and no transition has its unit's transitions 1 to lags periods earlier, as on periods counted in days a week apart, where the check read no transition and returned nan without a word.

closed_loop_gain_attribution(states, actions, rates)

Attribute a control-affine fit's coefficients to the controller and to the plant.

The question is why the interaction coefficient b1 of dx/dt = d + a*x + (b0 + b1*x)*u comes out large and negative on a setpoint-tracked zone. The answer is a property of the log, not of the plant. A proportional loop u = gain*(setpoint - x) + u0 puts every sample on an affine manifold x = c + m*u with m = -1/gain, and restricted to that manifold the four-term class collapses to a quadratic in the action::

d + a*x + (b0 + b1*x)*u  =  (d + a*c) + (a*m + b0 + b1*c)*u + (b1*m)*u^2

Only b1 reaches the u^2 term, so b1 is the identified coefficient and the pole is not -- the inverse of the usual reading, and the reason the reported pole is a units artefact while lambda(u) = a + b1*u holds. Matching against an observed response A + B*u + C*u^2 gives

``b1 = C/m = -gain*C``,

so the sign is decided by the curvature of the response in the action and the magnitude by the controller: a tighter tracker reports a bigger interaction from identical physics. proofs/closed_loop_attribution.v proves the matching identity and exhibits the explicit one-parameter family that leaves d, a and b0 free.

This also refutes the standing guess that b1 = -1/gain. That is the manifold slope, not the interaction; equating them forces C = 1/gain^2, a constraint on the plant rather than an identity (guess_is_a_constraint_not_an_identity).

exploration_budget is what buys the rest back: variation off the manifold restores the design's rank, and with it the separation of a from b0. Reading a pole off a fit whose budget is ~0 is reading the regulariser.

closed_loop_attribution_certificate(gains=(0.5, 1.0, 2.6, 8.0), exploration=(0.0, 0.05, 0.25, 1.0), samples=4000, seed=0)

Separate the interaction a plant HAS from the one a tracking loop MANUFACTURES.

Arm A: the plant really is d + a*x + (b0 + b1*x)*u. Under exact tracking the design is singular, yet b1 comes back exactly while the drift a does not -- the non-identification is real and it is the pole that suffers, not the interaction.

Arm B: the plant has no interaction, but its response carries a u^2 term the fitted class cannot represent. The fit answers with b1 = -gain*curvature: a coefficient that is entirely an artefact of misspecification amplified by the loop, growing linearly with the controller's gain. That is the mechanism behind a large negative b1 on a tracked log, and why the number cannot be read as authority-falls-with-temperature without checking the budget.

The exploration sweep is the remedy: variation off the manifold restores the design's rank and the drift with it. All three claims are measured here, and the middle one is the one that would embarrass the entry if b1 turned out to be as unstable as a.