Skip to main content

Crate antecedent

Crate antecedent 

Source
Expand description

Unified static/temporal CausalAnalysis facade (identify → estimate → refute).

Antecedent is an identification-first causal inference engine: identification is evaluated before estimation, refuters run against the estimate, and uncertainty about causal structure (equivalence classes, graph posteriors) is retained rather than silently resolved.

§Quick start

use antecedent::prelude::*;
use antecedent::RefuteSuite;

let schema = CausalSchemaBuilder::new()
    .continuous("t")
    .treatment()
    .continuous("y")
    .outcome()
    .continuous("z")
    .context()
    .build()
    .unwrap();
let data = TabularData::from_f64_columns([
    ("t", &[0.0_f64, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0][..]),
    ("y", &[1.0_f64, 3.1, 1.2, 2.9, 0.9, 3.0, 1.1, 3.2][..]),
    ("z", &[0.0_f64, 1.0, 0.2, 0.8, 0.1, 0.9, 0.3, 0.7][..]),
])
.unwrap();
let dag = Dag::from_named_edges(&schema, &[("z", "t"), ("z", "y"), ("t", "y")]).unwrap();
let q = AverageEffectQuery::binary_ate(schema.id_of("t").unwrap(), schema.id_of("y").unwrap());
let result = CausalAnalysis::builder()
    .data(data)
    .graph(dag)
    .query(q)
    .refute(RefuteSuite::None)
    .bootstrap_replicates(0)
    .build()
    .unwrap()
    .run(&ExecutionContext::for_tests(1))
    .unwrap();
assert!(result.effect().is_finite());

Prefer prelude for day-1 imports. Component crates remain available for stage-specific work.

SPDX-License-Identifier: MIT OR Apache-2.0

Re-exports§

pub use analysis::AnalysisStageEvent;
pub use analysis::BatchAnalysis;
pub use analysis::CausalAnalysis;
pub use analysis::CausalAnalysisBuilder;
pub use analysis::ComputeBudget;
pub use analysis::LatencyMode;
pub use analysis::PreparedAnalysis;
pub use analysis::RdConfig;
pub use analysis::RefuteSuite;
pub use analysis::StageResultSink;
pub use error::AnalysisError;Deprecated
pub use error::CausalError;
pub use estimate::EstimatorId;
pub use estimate::IdentifierId;
pub use inference::BayesianConfig;
pub use inference::InferenceMode;
pub use options::DiscoveryAccept;
pub use options::FdrControl;
pub use planner::CompiledAnalysis;
pub use planner::GraphInput;
pub use result::CausalAnalysisResult;
pub use query::*;

Modules§

analysis
Unified CausalAnalysis facade.
callback_plan
Physical-plan marking for Python / slow-path callbacks.
design
experiment / measurement design facade helpers.
discovery
Coarse discovery stage APIs for the facade.
discovery_defaults
Shared discovery constraint defaults and CI resolution.
error
Facade errors.
estimate
Estimation stage types and strategy identifiers.
gcm
GCM workflow helpers (fit → sample → CF → anomaly).
graph
Graph types and construction helpers.
identify
Identification stage types.
inference
Bayesian inference configuration for the facade.
io
Graph interchange and durable artifacts.
options
Shared facade option enums (API hygiene).
planner
Logical / physical analysis planning.
prelude
Day-1 imports for the antecedent facade.
query
Typed causal queries (re-exported from antecedent-core).
result
Analysis result artifact.
review
Graph review gate for discovery outputs.
state
incremental antecedent-state facade helpers.
strategy_table
Identifier / estimator strategy tables for plan compilation and static execution . Incremental extraction from the analysis workflow — does not replace crate::CausalAnalysis / plans / crate::CausalAnalysisResult.
validate
Validation / refutation types.

Structs§

CausalPosterior
Causal posterior over an identified functional.
Dag
Static directed acyclic graph over variables.
DenseNodeId
Compact dense node index used in algorithmic paths.
EffectEstimate
Point estimate with uncertainty.
TemporalDag
Directed acyclic graph over lagged (VariableId, Lag) nodes.