InterventionalDistribution<T>

Models & Types · AiDotNet.CausalDiscovery

Represents the interventional distribution P(Y | do(X = x)) from Pearl’s do-calculus.

For Beginners

Imagine you discover that ice cream sales and drowning rates are correlated. The observational distribution P(Drowning | IceCream = high) is high. But the interventional distribution P(Drowning | do(IceCream = high)) — what happens if we FORCE ice cream sales to be high — is NOT high, because the causal arrow is actually Temperature → IceCream and Temperature → Drowning. Interventions break the confounding by the temperature variable.

How It Works

An interventional distribution answers the question: “What would happen to variable Y if we actively SET variable X to value x?” This is fundamentally different from conditioning (P(Y | X = x)) because it breaks all causal arrows INTO X, simulating an experiment.

Truncated Factorization Formula: P(Y | do(X = x)) = Σ_pa(X) P(Y | X, pa(X)) * P(pa(X)) where pa(X) are the parents of X in the causal graph.

Usage:

Reference: Pearl (2009), “Causality: Models, Reasoning, and Inference”, Cambridge University Press, Ch. 3.

Properties

Property Summary
T InterventionValue { get; } Gets the value the intervention variable is set to.
double AverageCausalEffect { get; } Gets the Average Causal Effect (ACE): E[Y | do(X=x)] - E[Y_observational].
double Max { get; } Gets the maximum value in the interventional samples.
double Mean { get; } Gets the mean of the interventional distribution.
double Median { get; } Gets the median of the interventional distribution.
double Min { get; } Gets the minimum value in the interventional samples.
double StandardDeviation { get; } Gets the standard deviation of the interventional distribution.
double Variance { get; } Gets the variance of the interventional distribution.
double[] Samples { get; } Gets the interventional samples of the target variable under the do-intervention.
int InterventionVariableIndex { get; } Gets the index of the intervention variable.
int SampleCount { get; } Gets the number of interventional samples.
int TargetVariableIndex { get; } Gets the index of the target variable.
string InterventionVariableName { get; } Gets the name of the intervention variable (the variable being set via do-operator).
string TargetVariableName { get; } Gets the name of the target variable whose distribution is being computed.

Methods

Method Summary
ValueTuple<double, double> ConfidenceInterval(double confidence) Computes a confidence interval for the interventional mean.
double EstimateDensity(double value) Computes an empirical estimate of the probability density at a given value using a Gaussian kernel.
double Quantile(double p) Computes the specified quantile of the interventional distribution.
string ToString()