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:
- estimand
str Alias of the estimand these bounds describe.
- psi
float The unadjusted point estimate.
- cf_y
float Share of the residual outcome variation the assumed confounder explains.
- cf_d
float 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.
- rho
float How adversarially the two are aligned.
1.0is the worst case.- confounding_strength
float The product those three imply,
|rho| sqrt(cf_y cf_d / (1 - cf_d)).- max_bias
float The bias scale
sqrt(sigma^2 nu^2).biasmultiplies it byconfounding_strength, which can exceed 1. The name follows DoubleML.- lower
float Bias-adjusted lower bound on the estimate.
- upper
float Bias-adjusted upper bound on the estimate.
- ci_lower
float Lower one-sided confidence limit of the adjusted bound. It refuses at a non-inferential status, where
plugin_interval_lowerkeeps the diagnostic. It refuses under the plug-in estimator ofnu^2, which has no derived standard error (docs/roadmap.md F26).- ci_upper
float Upper one-sided confidence limit of the adjusted bound. It follows
ci_lower.- level
float Coverage level of those limits.
- robustness_value
floatorNone Equal confounding strength that moves the point estimate to the null.
Nonemeans no strength below one reaches it.- robustness_value_ci
floatorNone The same strength for the confidence limit. It refuses with
ci_lower;robustness_value_plugin_intervalkeeps the diagnostic.Nonemeans the available limit does not reach the null at any equal strength below one.- null_hypothesis
float The value the robustness values are measured against.
- inference
str, default=”influence_curve” The inference status of the estimate the bound adjusts. One of
InferenceStatus, which the inference reference lists.- nu2_estimator
str, default=”doubly_robust” The resolved estimator of
nu^2that built the bound. Under"plugin"the six limit accessors refuse.
- estimand
Methods#
- SensitivityBounds.summary() str[source]#
Return a printable summary.
- Returns:
strA printable report, one line per reported quantity.
- SensitivityBounds.to_dict() dict[str, Any][source]#
Return a JSON-compatible representation.
At a non-inferential
inferencethe mapping carriesinference, and the three quantities read off the influence curve take the namesspread_name()gives them:plugin_interval_lower,plugin_interval_upperandrobustness_value_plugin_interval. When no derivation in a source this package cites gives the limits’ standard error, the mapping carriesnu2_estimatorand omits those three keys under every name.- Returns:
dictA 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.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.