Placebo Tests¶
A placebo test is used to assess the significance of a synthetic control study by running the study once for each control unit set as treated unit and the remaining control units set as controls. See [ADH15] (section I.B) for a motivation. An example of usage is in the python notebook reproducing the weights from that paper in the package repository here
The PlaceboTest
class¶
- class pysyncon.utils.PlaceboTest¶
Class that carries out placebo tests by running a synthetic control study using each possible control unit as the treated unit and the remaining control units as controls. See [ADH15] for more details.
- fit(dataprep: Dataprep, scm: BaseSynth, scm_options: dict = {}, max_workers: int | None = None, verbose: bool = True)¶
Run the placebo tests. This method is multi-process and by default will use all available processors. Use the max_workers option to change this behaviour.
- Parameters:
dataprep (Dataprep) –
Dataprep
object containing data to model, by default None.scm_options (dict, optional) – Options to provide to the fit method of the synthetic control study, valid options are any valid option that the scm_type takes, by default {}
max_workers (Optional[int], optional) – Maximum number of processes to use, if not provided then will use all available, by default None
verbose (bool, optional) – Whether or not to output progress, by default True
- gaps_plot(time_period: Iterable | Series | dict | None = None, grid: bool = True, treatment_time: int | None = None, mspe_threshold: float | None = None, exclude_units: list | None = None)¶
Plot the gaps between the treated unit and the synthetic control for each placebo test.
- Parameters:
time_period (Iterable | pandas.Series | dict, optional) – Time range to plot, if none is supplied then the time range used is the time period over which the optimisation happens, by default None
grid (bool, optional) – Whether or not to plot a grid, by default True
treatment_time (int, optional) – If supplied, plot a vertical line at the time period that the treatment time occurred, by default None
mspe_threshold (float, optional) – Remove any non-treated units whose MSPE pre-treatment is \(>\) mspe_threshold \(\times\) the MSPE of the treated unit pre-treatment. This serves to exclude any non-treated units whose synthetic control had a poor pre-treatment match to the actual relative to how the actual treated unit matched pre-treatment.
- Raises:
ValueError – if no placebo test has been run yet
ValueError – if mspe_threshold is supplied but treatment_year is not.
- pvalue(treatment_time: int) float ¶
Calculate p-value of Abadie et al’s version of Fisher’s exact hypothesis test for no effect of treatment null, see also section 2.2. of [FP18].
- Parameters:
treatment_time (int) – The time period that the treatment time occurred
- Returns:
p-value for null hypothesis of no effect of treatment
- Return type:
float
- Raises:
ValueError – if no placebo test has been run yet