DifferenceInDifferences#
- class causalpy.experiments.diff_in_diff.DifferenceInDifferences[source]#
A class to analyse data from Difference in Difference settings.
Note
There is no pre/post intervention data distinction for DiD, we fit all the data available.
- Parameters:
Example
>>> import causalpy as cp >>> df = cp.load_data("did") >>> seed = 42 >>> result = cp.DifferenceInDifferences( ... df, ... formula="y ~ 1 + group*post_treatment", ... time_variable_name="t", ... group_variable_name="group", ... model=cp.pymc_models.LinearRegression( ... sample_kwargs={ ... "target_accept": 0.95, ... "random_seed": seed, ... "progressbar": False, ... } ... ) ... )
Methods
DifferenceInDifferences.__init__
(data, ...)DifferenceInDifferences.bayesian_plot
([round_to])Plot the results
Validate the input data and model formula for correctness
DifferenceInDifferences.ols_plot
([round_to])Generate plot for difference-in-differences
DifferenceInDifferences.plot
(*args, **kwargs)Plot the model.
Ask the model to print its coefficients.
DifferenceInDifferences.summary
([round_to])Print summary of main results and model coefficients.
Attributes
idata
Return the InferenceData object of the model.
supports_bayes
supports_ols
- __new__(**kwargs)#