causal_testing.estimation.abstract_estimator

This module contains the Estimator abstract class

Module Contents

Classes

Estimator

An estimator contains all of the information necessary to compute a causal estimate for the effect of changing

Attributes

logger

causal_testing.estimation.abstract_estimator.logger
class causal_testing.estimation.abstract_estimator.Estimator(treatment_variable: str, outcome_variable: str, control_value: float = None, treatment_value: float = None, adjustment_config: dict[str, Any] = None, alpha: float = 0.05)

Bases: abc.ABC

An estimator contains all of the information necessary to compute a causal estimate for the effect of changing a set of treatment variables to a set of values.

All estimators must implement the following two methods:

1) add_modelling_assumptions: The validity of a model-assisted causal inference result depends on whether the modelling assumptions imposed by a model actually hold. Therefore, for each model, is important to state the modelling assumption upon which the validity of the results depend. To achieve this, the estimator object maintains a list of modelling assumptions (as strings). If a user wishes to implement their own estimator, they must implement this method and add all assumptions to the list of modelling assumptions.

2) estimate_*: The Causal Testing Framework expects causal effects to be calculated by methods that start with estimate_, followed by the name of the causal effect measure being estimated, for example ate or risk_ratio. Naming methods this way enables estimators to hook nicely into the endpoints further up the chain.

abstract add_modelling_assumptions()

Add modelling assumptions to the estimator. This is a list of strings which list the modelling assumptions that must hold if the resulting causal inference is to be considered valid.

to_dict() → dict

Convert the estimator to a python dictionary for easy serialisation as JSON or CSV.

Returns:

A JSON serialisable dict representing the estimator.