pub struct BackdoorCriterion {
pub graph: CausalGraph,
}Expand description
Checks whether a set of variables satisfies the backdoor criterion for
identifying the causal effect of treatment on outcome.
The backdoor criterion holds if:
- No variable in
adjustment_setis a descendant oftreatment. adjustment_setblocks all backdoor paths fromtreatmenttooutcome.
Fields§
§graph: CausalGraphThe causal graph.
Implementations§
Source§impl BackdoorCriterion
impl BackdoorCriterion
Sourcepub fn new(graph: CausalGraph) -> Self
pub fn new(graph: CausalGraph) -> Self
Create a new backdoor criterion checker.
Sourcepub fn check(
&self,
treatment: usize,
outcome: usize,
adjustment_set: &[usize],
) -> bool
pub fn check( &self, treatment: usize, outcome: usize, adjustment_set: &[usize], ) -> bool
Check if adjustment_set satisfies the backdoor criterion for the
causal effect of treatment on outcome.
Returns true if the criterion is satisfied.
Sourcepub fn adjusted_effect(
data_x: &[f64],
data_y: &[f64],
data_z: &[f64],
x_val: f64,
_tolerance: f64,
) -> f64
pub fn adjusted_effect( data_x: &[f64], data_y: &[f64], data_z: &[f64], x_val: f64, _tolerance: f64, ) -> f64
Compute the backdoor-adjusted causal effect estimate from observational data.
Uses the adjustment formula: E[Y|do(X=x)] = Σ_z E[Y|X=x, Z=z] * P(Z=z)
This simplified version takes pre-computed conditional means.
§Arguments
data_x— treatment valuesdata_y— outcome valuesdata_z— confounder values (single confounder for simplicity)x_val— the intervention value
Trait Implementations§
Source§impl Clone for BackdoorCriterion
impl Clone for BackdoorCriterion
Source§fn clone(&self) -> BackdoorCriterion
fn clone(&self) -> BackdoorCriterion
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BackdoorCriterion
impl RefUnwindSafe for BackdoorCriterion
impl Send for BackdoorCriterion
impl Sync for BackdoorCriterion
impl Unpin for BackdoorCriterion
impl UnsafeUnpin for BackdoorCriterion
impl UnwindSafe for BackdoorCriterion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.