cleverly.validation.RefutationTest#
- class cleverly.validation.RefutationTest(name: str, estimand: str, original: float, values: tuple[float, ...], expectation: str, passed: bool, detail: str, standard_errors: tuple[float, ...] = (), declaration: Any = None, rule: EmpiricalInclusionRule | None = None, records: tuple[EmpiricalRefitRecord, ...] = (), failures: tuple[ReplicationFailure, ...] = (), family: str | None = None, empirical_pvalue: float | None = None, declared_effect: float | None = None, requested_draws: int | None = None, resampling: str | None = None, 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', mean_kind: Literal['arithmetic', 'geometric'] = 'arithmetic', spread_kind: Literal['reported', 'log'] = 'reported')[source]#
The outcome of one refutation test.
- Parameters:
- name
str Which refutation was run.
- estimand
str Alias the test was run for.
- original
float The estimate before the refutation.
- values
tupleoffloat Estimates the refutation produced.
- expectation
str What those values should look like if the fit is sound.
- passedbool
Whether they did.
- detail
str What was seen, in the test’s own terms.
- standard_errors
tupleoffloat Standard errors from successful empirical refits.
- declaration
objectorNone Immutable declaration, for an empirical refit test. It holds the outcome process, or the measurement-error request.
- rule
EmpiricalInclusionRuleorNone Recorded inclusion rule, for an empirical refit test.
- records
tupleofEmpiricalRefitRecord Successful empirical refit draws.
- failures
tupleofReplicationFailure Failed empirical draws retained by the shared failure contract. Every operation retains a refit failure.
bootstrap_measurement_erroralso retains a draw it cannot sample or perturb.- family
strorNone Family supplied by successful refitted results.
- empirical_pvalue
floatorNone Two-sided empirical rank p-value for the declared effect.
Nonewhen no draw succeeded, and on an older refuter.- declared_effect
floatorNone Effect the declared process implies for this test’s own contrast direction, and
Nonefor an older refuter. It carries the sign of the parameter key: a fit that reports code zero against code one declares the negated process effect.- requested_draws
intorNone Requested empirical draw count.
- resampling
strorNone Resolved bootstrap mode for a bootstrap-based refuter.
- inference
str Inference status of the refitted estimates. One of
InferenceStatus, which the inference reference lists. On a fit that supplies no inference,standard_errorsand each record’sstd_errorhold the plug-in diagnosticplugin_std_error, andto_frame()publishes that column asplugin_std_error.- mean_kind
str "geometric"for a ratio placebo or noise refutation tested on the log scale. Other tests use the arithmetic mean. The underlyingvaluesremain on the reported scale.- spread_kind
str "log"for ratio subset scatter tested on the log scale. Other reports use reported-scale scatter. The underlyingvaluesremain on the reported scale.
- name
Methods#
- RefutationTest.to_frame(data: Any = None, *, backend: str | None = None) Any[source]#
Return one row per empirical refit draw.
- Parameters:
- Returns:
dataframeSuccessful estimates and standard errors alongside retained failures. The standard-error column is
plugin_std_errorwheninferenceis a diagnostic status.
Attributes#
- RefutationTest.child_seeds#
Return every successful and failed draw seed in draw-index order.
- RefutationTest.failures: tuple[ReplicationFailure, ...] = ()#
- RefutationTest.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'#
- RefutationTest.mean#
Return the displayed mean of refitted estimates.
- Returns:
floatArithmetic mean by default, or geometric mean for a ratio placebo or noise refutation.
nanwhen no replicate is finite. Failed replicates are dropped.
- RefutationTest.n_failed#
Return the number of retained failed empirical draws.
- RefutationTest.n_replicates#
Return the number of requested draws represented by this test.
- RefutationTest.process#
Return the empirical refit declaration, or
Nonefor older refuters.
- RefutationTest.records: tuple[EmpiricalRefitRecord, ...] = ()#
- RefutationTest.rule: EmpiricalInclusionRule | None = None#