EstimateEffect#

class causalpy.steps.estimate_effect.EstimateEffect[source]#

Pipeline step that fits a causal experiment.

Captures the experiment class and its keyword arguments. When the pipeline runs, instantiates the experiment with the pipeline’s data (which triggers fitting) and stores the result in the context.

Parameters:
  • method (type[BaseExperiment]) – The experiment class to instantiate (e.g. cp.InterruptedTimeSeries).

  • **kwargs (Any) – Keyword arguments forwarded to the experiment constructor. The data argument is supplied by the pipeline and must not be included here.

Examples

>>> import causalpy as cp
>>> step = cp.EstimateEffect(
...     method=cp.InterruptedTimeSeries,
...     treatment_time=pd.Timestamp("2020-01-01"),
...     formula="y ~ 1 + t",
...     model=cp.pymc_models.LinearRegression(),
... )

Methods

EstimateEffect.__init__(method, **kwargs)

EstimateEffect.run(context)

Instantiate and fit the experiment.

EstimateEffect.validate(context)

Check that the step is properly configured.

__init__(method, **kwargs)[source]#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#