cleverly.sensitivity.robustness_value#

cleverly.sensitivity.robustness_value(result: TMLEResult, estimand: str = 'ate', *, rho: float = 1.0, level: float = 0.95, null_hypothesis: float = 0.0, nu2_estimator: str = 'auto') → dict[str, Any][source]#

The confounding strength that would explain the effect away.

Returns {"rv": ..., "rva": ...}: the value of cf_y = cf_d at which the point estimate reaches null_hypothesis, and the value at which its confidence bound does. None means no equal strength below one reaches the null. A confidence limit that already crosses the null has rva = 0. This is the single most useful number in this module, because it requires no guess about how strong an unmeasured confounder might be – it reports the threshold and lets the reader judge whether it is plausible.

The confidence bound is read off the estimate’s influence curve, so at a non-inferential status "rva" takes the name spread_name() gives it, "rv_plugin_interval", and the mapping opens with "inference" naming the status, as SensitivityBounds.to_dict() does. Under nu2_estimator="plugin" no derivation gives the confidence bound’s standard error, so the mapping carries "nu2_estimator" and no confidence-limit value under any name (docs/roadmap.md F26).

Parameters:
resultTMLEResult

A fitted result.

estimandstr

Alias to report on.

rhofloat

How adversarially the two sensitivity parameters are aligned.

levelfloat

Coverage level used for the confidence-limit value.

null_hypothesisfloat

Value the strength is measured against.

nu2_estimator{“auto”, “doubly_robust”, “plugin”}

Which estimator of the Riesz second moment to use.

Returns:
dict of str to Any

The strength that moves the point estimate to the null, the one that moves the confidence limit there, and max_bias. A threshold is None when unreachable. At a non-inferential status, also the status under "inference". Under the plug-in estimator, "nu2_estimator" in place of the confidence-limit value.

Raises:
ValueError

If nu2_estimator is not one of NU2_ESTIMATORS, or if |rho| exceeds one, or if level lies outside [0.5, 1).

CapabilityError

On every refusal sensitivity_elements() raises: a fit the rule table refuses, an estimand the bound does not cover, or a doubly robust estimate of nu^2 that is not positive.