cleverly.sensitivity.SensitivityBounds#

class cleverly.sensitivity.SensitivityBounds(estimand: str, psi: float, cf_y: float, cf_d: float, rho: float, confounding_strength: float, max_bias: float, lower: float, upper: float, ci_lower: float | None, ci_upper: float | None, level: float, robustness_value: float | None, robustness_value_ci: float | None, null_hypothesis: float, inference: Literal['influence_curve', 'working_mechanism_plugin', 'generated_design_plugin', 'estimated_weight_plugin', 'adaptive_baseline_plugin', 'no_cluster_variance_plugin', 'few_cluster_plugin', 'constant_node_plugin', 'stack_failure_plugin'] = 'influence_curve', nu2_estimator: str = 'doubly_robust')[source]#

Bias-adjusted bounds under an assumed confounder strength.

Parameters:
estimandstr

Alias of the estimand these bounds describe.

psifloat

The unadjusted point estimate.

cf_yfloat

Share of the residual outcome variation the assumed confounder explains.

cf_dfloat

Share of the Riesz representer’s second moment that only the assumed confounder adds. For the ATE it is the gain in precision of the treatment model.

rhofloat

How adversarially the two are aligned. 1.0 is the worst case.

confounding_strengthfloat

The product those three imply, |rho| sqrt(cf_y cf_d / (1 - cf_d)).

max_biasfloat

The bias scale sqrt(sigma^2 nu^2). bias multiplies it by confounding_strength, which can exceed 1. The name follows DoubleML.

lowerfloat

Bias-adjusted lower bound on the estimate.

upperfloat

Bias-adjusted upper bound on the estimate.

ci_lowerfloat

Lower one-sided confidence limit of the adjusted bound. It refuses at a non-inferential status, where plugin_interval_lower keeps the diagnostic. It refuses under the plug-in estimator of nu^2, which has no derived standard error (docs/roadmap.md F26).

ci_upperfloat

Upper one-sided confidence limit of the adjusted bound. It follows ci_lower.

levelfloat

Coverage level of those limits.

robustness_valuefloat or None

Equal confounding strength that moves the point estimate to the null. None means no strength below one reaches it.

robustness_value_cifloat or None

The same strength for the confidence limit. It refuses with ci_lower; robustness_value_plugin_interval keeps the diagnostic. None means the available limit does not reach the null at any equal strength below one.

null_hypothesisfloat

The value the robustness values are measured against.

inferencestr, default=”influence_curve”

The inference status of the estimate the bound adjusts. One of InferenceStatus, which the inference reference lists.

nu2_estimatorstr, default=”doubly_robust”

The resolved estimator of nu^2 that built the bound. Under "plugin" the six limit accessors refuse.

Methods#

SensitivityBounds.summary() → str[source]#

Return a printable summary.

Returns:
str

A printable report, one line per reported quantity.

SensitivityBounds.to_dict() → dict[str, Any][source]#

Return a JSON-compatible representation.

At a non-inferential inference the mapping carries inference, and the three quantities read off the influence curve take the names spread_name() gives them: plugin_interval_lower, plugin_interval_upper and robustness_value_plugin_interval. When no derivation in a source this package cites gives the limits’ standard error, the mapping carries nu2_estimator and omits those three keys under every name.

Returns:
dict

A JSON-compatible mapping of every reported field.

Attributes#

SensitivityBounds.bias#

Magnitude of the bias the assumed confounder could produce.

SensitivityBounds.ci_lower#

Lower confidence limit, when this bound supplies inference.

SensitivityBounds.ci_upper#

Upper confidence limit, when this bound supplies inference.

SensitivityBounds.inference: Literal['influence_curve', 'working_mechanism_plugin', 'generated_design_plugin', 'estimated_weight_plugin', 'adaptive_baseline_plugin', 'no_cluster_variance_plugin', 'few_cluster_plugin', 'constant_node_plugin', 'stack_failure_plugin'] = 'influence_curve'#
SensitivityBounds.nu2_estimator: str = 'doubly_robust'#
SensitivityBounds.plugin_interval_lower#

Lower plug-in limit, a diagnostic at a non-inferential status.

SensitivityBounds.plugin_interval_upper#

Upper plug-in limit, a diagnostic at a non-inferential status.

SensitivityBounds.robustness_value_ci#

Robustness value for a confidence limit, when inference is supplied.

SensitivityBounds.robustness_value_plugin_interval#

Robustness value from the plug-in limit, a diagnostic when inference is absent.

SensitivityBounds.estimand: str#
SensitivityBounds.psi: float#
SensitivityBounds.cf_y: float#
SensitivityBounds.cf_d: float#
SensitivityBounds.rho: float#
SensitivityBounds.confounding_strength: float#
SensitivityBounds.max_bias: float#
SensitivityBounds.lower: float#
SensitivityBounds.upper: float#
SensitivityBounds.level: float#
SensitivityBounds.robustness_value: float | None#
SensitivityBounds.null_hypothesis: float#