#[non_exhaustive]pub struct AverageEffectQuery {
pub treatment: VariableId,
pub outcome: VariableId,
pub effect_modifiers: Arc<[VariableId]>,
pub control: Intervention,
pub active: Intervention,
pub target_population: TargetPopulation,
}Expand description
Average treatment effect (ATE / ATT-style) query.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.treatment: VariableIdTreatment variable.
outcome: VariableIdOutcome variable.
effect_modifiers: Arc<[VariableId]>Optional effect modifiers .
control: InterventionControl intervention level (typically treatment = 0).
active: InterventionActive intervention level (typically treatment = 1).
target_population: TargetPopulationTarget population.
Implementations§
Source§impl AverageEffectQuery
impl AverageEffectQuery
Sourcepub fn new(
treatment: VariableId,
outcome: VariableId,
effect_modifiers: impl Into<Arc<[VariableId]>>,
control: Intervention,
active: Intervention,
target_population: TargetPopulation,
) -> Self
pub fn new( treatment: VariableId, outcome: VariableId, effect_modifiers: impl Into<Arc<[VariableId]>>, control: Intervention, active: Intervention, target_population: TargetPopulation, ) -> Self
Full constructor (required outside this crate because the type is #[non_exhaustive]).
Sourcepub fn binary_ate(treatment: VariableId, outcome: VariableId) -> Self
pub fn binary_ate(treatment: VariableId, outcome: VariableId) -> Self
ATE for binary treatment coded as 0/1 on treatment.
§Examples
use antecedent_core::{AverageEffectQuery, VariableId};
let q = AverageEffectQuery::binary_ate(VariableId::from_raw(0), VariableId::from_raw(1));
assert_eq!(q.treatment, VariableId::from_raw(0));Sourcepub fn with_levels(
treatment: VariableId,
outcome: VariableId,
control_level: f64,
active_level: f64,
) -> Self
pub fn with_levels( treatment: VariableId, outcome: VariableId, control_level: f64, active_level: f64, ) -> Self
ATE with explicit control/active float levels.
Sourcepub fn with_effect_modifiers(
self,
modifiers: impl Into<Arc<[VariableId]>>,
) -> Self
pub fn with_effect_modifiers( self, modifiers: impl Into<Arc<[VariableId]>>, ) -> Self
Attach effect modifiers (IDs already resolved).
Sourcepub fn with_target_population(self, population: TargetPopulation) -> Self
pub fn with_target_population(self, population: TargetPopulation) -> Self
Set target population.
Sourcepub fn validate(&self) -> Result<(), QueryError>
pub fn validate(&self) -> Result<(), QueryError>
Validate that interventions target the treatment variable.
§Errors
Returns QueryError when interventions are inconsistent.
Trait Implementations§
Source§impl Clone for AverageEffectQuery
impl Clone for AverageEffectQuery
Source§fn clone(&self) -> AverageEffectQuery
fn clone(&self) -> AverageEffectQuery
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 moreSource§impl Debug for AverageEffectQuery
impl Debug for AverageEffectQuery
impl Eq for AverageEffectQuery
Source§impl From<AverageEffectQuery> for CausalQuery
impl From<AverageEffectQuery> for CausalQuery
Source§fn from(query: AverageEffectQuery) -> Self
fn from(query: AverageEffectQuery) -> Self
Converts to this type from the input type.
Source§impl Hash for AverageEffectQuery
impl Hash for AverageEffectQuery
Source§impl PartialEq for AverageEffectQuery
impl PartialEq for AverageEffectQuery
impl StructuralPartialEq for AverageEffectQuery
Auto Trait Implementations§
impl Freeze for AverageEffectQuery
impl RefUnwindSafe for AverageEffectQuery
impl Send for AverageEffectQuery
impl Sync for AverageEffectQuery
impl Unpin for AverageEffectQuery
impl UnsafeUnpin for AverageEffectQuery
impl UnwindSafe for AverageEffectQuery
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