pub struct WeightingDoSampler {
pub treatment: VariableId,
pub outcome: VariableId,
}Expand description
Weighting do-sampler for hard do(T=t).
- Root treatment: empirical outcomes among units with
T ≈ t. - Confounded continuous treatment: Horvitz–Thompson with a shrinking Gaussian
kernel on the treatment margin (Silverman bandwidth) over the fitted conditional
density
f(T∣parents):wᵢ ∝ Kₕ(Tᵢ − t) / f(Tᵢ∣parents). Hard interventions have a Dirac interventional law, so the kernel is the localization numerator (there is no separatelp_doterm). - Non-density / discrete mechanisms: kernel localization alone (exact match when the bandwidth collapses on tied support).
Fields§
§treatment: VariableIdTreatment variable.
outcome: VariableIdOutcome variable.
Implementations§
Source§impl WeightingDoSampler
impl WeightingDoSampler
Sourcepub fn new(treatment: VariableId, outcome: VariableId) -> Self
pub fn new(treatment: VariableId, outcome: VariableId) -> Self
Construct.
Sourcepub fn estimate(
&self,
model: &CompiledCausalModel,
data: &TabularData,
treatment_value: f64,
_ctx: &ExecutionContext,
) -> Result<DoSampleResult, ModelError>
pub fn estimate( &self, model: &CompiledCausalModel, data: &TabularData, treatment_value: f64, _ctx: &ExecutionContext, ) -> Result<DoSampleResult, ModelError>
Estimate E[Y | do(T=t)] via matching / Horvitz–Thompson on fitted model densities.
§Errors
Missing columns or unfitted treatment mechanism.
Sourcepub fn weighted_mean(result: &DoSampleResult) -> f64
pub fn weighted_mean(result: &DoSampleResult) -> f64
Weighted mean of the sampler result.
Trait Implementations§
Source§impl Clone for WeightingDoSampler
impl Clone for WeightingDoSampler
Source§fn clone(&self) -> WeightingDoSampler
fn clone(&self) -> WeightingDoSampler
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 WeightingDoSampler
impl RefUnwindSafe for WeightingDoSampler
impl Send for WeightingDoSampler
impl Sync for WeightingDoSampler
impl Unpin for WeightingDoSampler
impl UnsafeUnpin for WeightingDoSampler
impl UnwindSafe for WeightingDoSampler
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> ForeignBufferOwner for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more