Class for automated derivation of influence functions.

class ananke.estimation.automated_if.AutomatedIF(graph, treatment, outcome)[source]

Bases: object

IF for a single treatment and single outcome.


Class that provides an interface to estimation strategies for the counterfactual mean E[Y(t)]

class ananke.estimation.counterfactual_mean.CausalEffect(graph, treatment, outcome)[source]

Bases: object

Provides an interface to various estimation strategies for the ACE: E[Y(1) - Y(0)].

compute_effect(data, estimator, model_binary=None, model_continuous=None, n_bootstraps=0, alpha=0.05, report_log_odds=True)[source]

Bootstrap functionality to compute the Average Causal Effect if the outcome is continuous or the Causal Odds Ratio if the outcome is binary. Returns the point estimate as well as lower and upper quantiles for a user specified confidence level.

  • data – pandas data frame containing the data.

  • estimator – string indicating what estimator to use: e.g. eff-apipw.

  • model_binary – string specifying modeling strategy to use for binary variables: e.g. glm-binary.

  • model_continuous – string specifying modeling strategy to use for continuous variables: e.g. glm-continuous.

  • n_bootstraps – number of bootstraps.

  • alpha – the significance level with the default value of 0.05.

  • report_log_odds – if set to True, and the outcome variable is binary, then reports the log odds ratio.


one float corresponding to ACE/OR if n_bootstraps=0, else three floats corresponding to ACE/OR, lower quantile, upper quantile.


ananke.estimation.empirical_plugin.compute_district_factor(graph: ananke.graphs.admg.ADMG, obs_dist, fixing_order)[source]

Compute the interventional distribution associated with a district (or equivalently, its fixing order)

  • graph (ananke.ADMG) – Graph representing the problem

  • obs_dist (pgmpy.discrete.DiscreteFactor) – Probability distribution corresponding to the graph

  • fixing_order – A fixing sequence for the implied district D

ananke.estimation.empirical_plugin.estimate_effect_from_discrete_dist(oid, obs_dist, treatment_dict, outcome_dict)[source]

Performs the ID algorithm to identify a causal effect given a discrete probability distribution representing the observed data distribution.

  • oid (OneLineID) – Ananke OneLineID object

  • obs_dist – observed data distribution

  • treatment_dict – dictionary of treatment variables and values

  • outcome_dict – dictionary of outcome variables and values

ananke.estimation.empirical_plugin.get_obs_dist_from_net(net, graph)[source]