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, it constructs the experiment with the pipeline’s data, calls
fit()explicitly (constructors are lazy and do not fit), and stores the fitted experiment in the context.- Parameters:
method (
type[BaseExperiment]) – The experiment class to instantiate (e.g.cp.InterruptedTimeSeries).**kwargs (
Any) – Keyword arguments accepted bymethod’s constructor, exceptdata, which the pipeline supplies. This is a deliberately narrow dynamic forwarder:methodmay be an integrator-providedBaseExperimentsubclass, so its accepted constructor keys cannot be enumerated here. Built-in experiment constructors declare every supported key explicitly; unsupported, misspelled, or incomplete arguments raiseTypeErrorduring pipeline validation.
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.run(context)Instantiate, fit, and register the experiment.
EstimateEffect.validate(context)Check that the step is properly configured.
- __init__(method, **kwargs)[source]#
- Parameters:
method (type[BaseExperiment])
kwargs (Any)
- Return type:
None
- classmethod __new__(*args, **kwargs)#