InterruptedTimeSeries#
- class causalpy.experiments.prepostfit.InterruptedTimeSeries[source]#
A wrapper around PrePostFit class
- 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, ...[, ...])InterruptedTimeSeries.bayesian_plot
([round_to])Plot the results
InterruptedTimeSeries.input_validation
(data, ...)Validate the input data and model formula for correctness
InterruptedTimeSeries.ols_plot
([round_to])Plot the results
InterruptedTimeSeries.plot
(*args, **kwargs)Plot the model.
Ask the model to print its coefficients.
InterruptedTimeSeries.summary
([round_to])Print summary of main results and model coefficients.
Attributes
expt_type
idata
Return the InferenceData object of the model.
supports_bayes
supports_ols
- __init__(data, treatment_time, formula, model=None, **kwargs)#
- __new__(**kwargs)#