InterruptedTimeSeries#
- class causalpy.experiments.interrupted_time_series.InterruptedTimeSeries[source]#
The class for interrupted time series analysis.
- Parameters:
Example
>>> import causalpy as cp >>> df = ( ... cp.load_data("its") ... .assign(date=lambda x: pd.to_datetime(x["date"])) ... .set_index("date") ... ) >>> treatment_time = pd.to_datetime("2017-01-01") >>> seed = 42 >>> result = cp.InterruptedTimeSeries( ... df, ... treatment_time, ... formula="y ~ 1 + t + C(month)", ... model=cp.pymc_models.LinearRegression( ... sample_kwargs={ ... "target_accept": 0.95, ... "random_seed": seed, ... "progressbar": False, ... } ... ), ... )
Methods
InterruptedTimeSeries.__init__(data, ...[, ...])Execute the core interrupted time series algorithm.
InterruptedTimeSeries.get_plot_data(*args, ...)Recover the data of an experiment along with the prediction and causal impact information.
Recover the data of the experiment along with the prediction and causal impact information.
Recover the data of the experiment along with the prediction and causal impact information.
InterruptedTimeSeries.input_validation(data, ...)Validate the input data and model formula for correctness
InterruptedTimeSeries.plot([round_to])Plot the interrupted time series analysis results.
Ask the model to print its coefficients.
InterruptedTimeSeries.summary([round_to])Print summary of main results and model coefficients.
Attributes
expt_typeidataReturn the InferenceData object of the model.
supports_bayessupports_ols- classmethod __new__(*args, **kwargs)#