dowhy.causal_estimators package

Submodules

dowhy.causal_estimators.causalml module

class dowhy.causal_estimators.causalml.Causalml(*args, **kwargs)[source]

Bases: dowhy.causal_estimator.CausalEstimator

construct_symbolic_estimator(estimand)[source]

dowhy.causal_estimators.econml module

class dowhy.causal_estimators.econml.Econml(*args, **kwargs)[source]

Bases: dowhy.causal_estimator.CausalEstimator

construct_symbolic_estimator(estimand)[source]

dowhy.causal_estimators.generalized_linear_model_estimator module

class dowhy.causal_estimators.generalized_linear_model_estimator.GeneralizedLinearModelEstimator(*args, **kwargs)[source]

Bases: dowhy.causal_estimators.regression_estimator.RegressionEstimator

Compute effect of treatment using a generalized linear model such as logistic regression.

Implementation uses statsmodels.api.GLM. Needs an additional parameter, “glm_family” to be specified in method_params. The value of this parameter can be any valid statsmodels.api families object. For example, to use logistic regression, specify “glm_family” as statsmodels.api.families.Binomial().

construct_symbolic_estimator(estimand)[source]

dowhy.causal_estimators.instrumental_variable_estimator module

class dowhy.causal_estimators.instrumental_variable_estimator.InstrumentalVariableEstimator(*args, **kwargs)[source]

Bases: dowhy.causal_estimator.CausalEstimator

Compute effect of treatment using the instrumental variables method.

This is also a superclass that can be inherited by other specific methods.

Supports additional parameters that can be specified in the estimate_effect() method.

  • ‘iv_instrument_name’: Name of the specific instrumental variable to be used. Needs to be one of the IVs identified in the identification step. Default is to use all the IV variables from the identification step.

construct_symbolic_estimator(estimand)[source]

dowhy.causal_estimators.linear_regression_estimator module

class dowhy.causal_estimators.linear_regression_estimator.LinearRegressionEstimator(*args, **kwargs)[source]

Bases: dowhy.causal_estimators.regression_estimator.RegressionEstimator

Compute effect of treatment using linear regression.

Fits a regression model for estimating the outcome using treatment(s) and confounders. For a univariate treatment, the treatment effect is equivalent to the coefficient of the treatment variable.

Simple method to show the implementation of a causal inference method that can handle multiple treatments and heterogeneity in treatment. Requires a strong assumption that all relationships from (T, W) to Y are linear.

construct_symbolic_estimator(estimand)[source]

dowhy.causal_estimators.propensity_score_estimator module

class dowhy.causal_estimators.propensity_score_estimator.PropensityScoreEstimator(*args, **kwargs)[source]

Bases: dowhy.causal_estimator.CausalEstimator

construct_symbolic_estimator(estimand)[source]

A symbolic string that conveys what each estimator does. For instance, linear regression is expressed as y ~ bx + e

dowhy.causal_estimators.propensity_score_matching_estimator module

class dowhy.causal_estimators.propensity_score_matching_estimator.PropensityScoreMatchingEstimator(*args, **kwargs)[source]

Bases: dowhy.causal_estimators.propensity_score_estimator.PropensityScoreEstimator

construct_symbolic_estimator(estimand)[source]

A symbolic string that conveys what each estimator does. For instance, linear regression is expressed as y ~ bx + e

dowhy.causal_estimators.propensity_score_stratification_estimator module

class dowhy.causal_estimators.propensity_score_stratification_estimator.PropensityScoreStratificationEstimator(*args, num_strata=50, clipping_threshold=10, **kwargs)[source]

Bases: dowhy.causal_estimators.propensity_score_estimator.PropensityScoreEstimator

Estimate effect of treatment by stratifying the data into bins with identical common causes.

Straightforward application of the back-door criterion.

construct_symbolic_estimator(estimand)[source]

A symbolic string that conveys what each estimator does. For instance, linear regression is expressed as y ~ bx + e

dowhy.causal_estimators.propensity_score_weighting_estimator module

class dowhy.causal_estimators.propensity_score_weighting_estimator.PropensityScoreWeightingEstimator(*args, min_ps_score=0.05, max_ps_score=0.95, **kwargs)[source]

Bases: dowhy.causal_estimators.propensity_score_estimator.PropensityScoreEstimator

Estimate effect of treatment by weighing the data by inverse probability of occurrence.

Straightforward application of the back-door criterion.

Supports additional parameters that can be specified in the estimate_effect() method.

  • ‘weighting_scheme’: This is the name of weighting method to use. Can be inverse propensity score (“ips_weight”, default), stabilized IPS score (“ips_stabilized_weight”), or normalized IPS score (“ips_normalized_weight”)

construct_symbolic_estimator(estimand)[source]

A symbolic string that conveys what each estimator does. For instance, linear regression is expressed as y ~ bx + e

dowhy.causal_estimators.regression_discontinuity_estimator module

class dowhy.causal_estimators.regression_discontinuity_estimator.RegressionDiscontinuityEstimator(*args, **kwargs)[source]

Bases: dowhy.causal_estimator.CausalEstimator

Compute effect of treatment using the regression discontinuity method.

Estimates effect by transforming the problem to an instrumental variables problem.

Supports additional parameters that can be specified in the estimate_effect() method.

  • ‘rd_variable_name’: name of the variable on which the discontinuity occurs. This is the instrument.

  • ‘rd_threshold_value’: Threshold at which the discontinuity occurs.

  • ‘rd_bandwidth’: Distance from the threshold within which confounders can be considered the same between treatment and control. Considered band is (threshold +- bandwidth)

construct_symbolic_estimator(estimand)[source]

dowhy.causal_estimators.regression_estimator module

class dowhy.causal_estimators.regression_estimator.RegressionEstimator(*args, **kwargs)[source]

Bases: dowhy.causal_estimator.CausalEstimator

Compute effect of treatment using some regression function.

Fits a regression model for estimating the outcome using treatment(s) and confounders.

dowhy.causal_estimators.two_stage_regression_estimator module

class dowhy.causal_estimators.two_stage_regression_estimator.TwoStageRegressionEstimator(*args, **kwargs)[source]

Bases: dowhy.causal_estimator.CausalEstimator

Compute treatment effect whenever the effect is fully mediated by another variable (front-door) or when there is an instrument available.

Currently only supports a linear model for the effects.

DEFAULT_FIRST_STAGE_MODEL

alias of dowhy.causal_estimators.linear_regression_estimator.LinearRegressionEstimator

DEFAULT_SECOND_STAGE_MODEL

alias of dowhy.causal_estimators.linear_regression_estimator.LinearRegressionEstimator

build_first_stage_features()[source]
construct_symbolic_estimator(first_stage_symbolic, second_stage_symbolic, total_effect_symbolic=None, estimand_type=None)[source]

Module contents

dowhy.causal_estimators.get_class_object(method_name, *args, **kwargs)[source]